get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/179813/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 179813,
    "url": "http://patchwork.ozlabs.org/api/patches/179813/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/uboot/patch/1345803102-21110-4-git-send-email-gerlando.falauto@keymile.com/",
    "project": {
        "id": 18,
        "url": "http://patchwork.ozlabs.org/api/projects/18/?format=api",
        "name": "U-Boot",
        "link_name": "uboot",
        "list_id": "u-boot.lists.denx.de",
        "list_email": "u-boot@lists.denx.de",
        "web_url": null,
        "scm_url": null,
        "webscm_url": null,
        "list_archive_url": "",
        "list_archive_url_format": "",
        "commit_url_format": ""
    },
    "msgid": "<1345803102-21110-4-git-send-email-gerlando.falauto@keymile.com>",
    "list_archive_url": null,
    "date": "2012-08-24T10:11:38",
    "name": "[U-Boot,v4,3/7] env: make himport_r() selective on variables",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "ca0e862a9fa7d3555f844a735e09e585c1a18ff6",
    "submitter": {
        "id": 9154,
        "url": "http://patchwork.ozlabs.org/api/people/9154/?format=api",
        "name": "Gerlando Falauto",
        "email": "gerlando.falauto@keymile.com"
    },
    "delegate": {
        "id": 3651,
        "url": "http://patchwork.ozlabs.org/api/users/3651/?format=api",
        "username": "trini",
        "first_name": "Tom",
        "last_name": "Rini",
        "email": "trini@ti.com"
    },
    "mbox": "http://patchwork.ozlabs.org/project/uboot/patch/1345803102-21110-4-git-send-email-gerlando.falauto@keymile.com/mbox/",
    "series": [],
    "comments": "http://patchwork.ozlabs.org/api/patches/179813/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/179813/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<u-boot-bounces@lists.denx.de>",
        "X-Original-To": "incoming@patchwork.ozlabs.org",
        "Delivered-To": "patchwork-incoming@bilbo.ozlabs.org",
        "Received": [
            "from theia.denx.de (theia.denx.de [85.214.87.163])\n\tby ozlabs.org (Postfix) with ESMTP id 24CCE2C00D2\n\tfor <incoming@patchwork.ozlabs.org>;\n\tFri, 24 Aug 2012 20:19:14 +1000 (EST)",
            "from localhost (localhost [127.0.0.1])\n\tby theia.denx.de (Postfix) with ESMTP id 193EC280C1;\n\tFri, 24 Aug 2012 12:19:10 +0200 (CEST)",
            "from theia.denx.de ([127.0.0.1])\n\tby localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id AJrdNV5+N4wa; Fri, 24 Aug 2012 12:19:09 +0200 (CEST)",
            "from theia.denx.de (localhost [127.0.0.1])\n\tby theia.denx.de (Postfix) with ESMTP id 8DF3F2810D;\n\tFri, 24 Aug 2012 12:18:50 +0200 (CEST)",
            "from localhost (localhost [127.0.0.1])\n\tby theia.denx.de (Postfix) with ESMTP id AEE0E280CA\n\tfor <u-boot@lists.denx.de>; Fri, 24 Aug 2012 12:18:41 +0200 (CEST)",
            "from theia.denx.de ([127.0.0.1])\n\tby localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id ouJ0Q0EdZrlE for <u-boot@lists.denx.de>;\n\tFri, 24 Aug 2012 12:18:41 +0200 (CEST)",
            "from mail-de.keymile.com (mail-de.keymile.com [195.8.104.1])\n\tby theia.denx.de (Postfix) with SMTP id B4E152808F\n\tfor <u-boot@lists.denx.de>; Fri, 24 Aug 2012 12:18:40 +0200 (CEST)",
            "from mailrelay.de.keymile.net ([10.9.1.54]) by eSafe SMTP Relay\n\t1345792219; Fri, 24 Aug 2012 12:18:38 +0200",
            "from chber1-10555x.ch.keymile.net (chber1-10555x.ch.keymile.net\n\t[172.31.40.82]) by mailrelay.de.keymile.net (8.12.2/8.12.2)\n\twith ESMTP id q7OAHMjB026728; Fri, 24 Aug 2012 12:17:29 +0200 (MEST)"
        ],
        "X-Virus-Scanned": [
            "Debian amavisd-new at theia.denx.de",
            "Debian amavisd-new at theia.denx.de"
        ],
        "X-policyd-weight": "NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5\n\tNOT_IN_BL_NJABL=-1.5 (only DNSBL check requested)",
        "From": "Gerlando Falauto <gerlando.falauto@keymile.com>",
        "To": "u-boot@lists.denx.de",
        "Date": "Fri, 24 Aug 2012 12:11:38 +0200",
        "Message-Id": "<1345803102-21110-4-git-send-email-gerlando.falauto@keymile.com>",
        "X-Mailer": "git-send-email 1.7.10.4",
        "In-Reply-To": "<1345803102-21110-1-git-send-email-gerlando.falauto@keymile.com>",
        "References": "<1321634955-5561-1-git-send-email-gerlando.falauto@keymile.com><1345803102-21110-1-git-send-email-gerlando.falauto@keymile.com>",
        "X-ESAFE-STATUS": "[srvhellgate.de.keymile.net] Mail clean",
        "Cc": "marex@denx.de, holger.brunck@keymile.com,\n\tGerlando Falauto <gerlando.falauto@keymile.com>",
        "Subject": "[U-Boot] [PATCH v4 3/7] env: make himport_r() selective on variables",
        "X-BeenThere": "u-boot@lists.denx.de",
        "X-Mailman-Version": "2.1.11",
        "Precedence": "list",
        "List-Id": "U-Boot discussion <u-boot.lists.denx.de>",
        "List-Unsubscribe": "<http://lists.denx.de/mailman/options/u-boot>,\n\t<mailto:u-boot-request@lists.denx.de?subject=unsubscribe>",
        "List-Archive": "<http://lists.denx.de/pipermail/u-boot>",
        "List-Post": "<mailto:u-boot@lists.denx.de>",
        "List-Help": "<mailto:u-boot-request@lists.denx.de?subject=help>",
        "List-Subscribe": "<http://lists.denx.de/mailman/listinfo/u-boot>,\n\t<mailto:u-boot-request@lists.denx.de?subject=subscribe>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=\"us-ascii\"",
        "Content-Transfer-Encoding": "7bit",
        "Sender": "u-boot-bounces@lists.denx.de",
        "Errors-To": "u-boot-bounces@lists.denx.de"
    },
    "content": "Add 2 new arguments to himport_r():\n\n o \"nvars\", \"vars\": number and list of variables to take into account\n   (0 means ALL)\n\nNOTE: This patch does not change the current behaviour.\n\nSigned-off-by: Gerlando Falauto <gerlando.falauto@keymile.com>\n---\n common/cmd_nvedit.c |    3 ++-\n common/env_common.c |    6 ++++--\n include/search.h    |    6 +++++-\n lib/hashtable.c     |   27 ++++++++++++++++++++++++++-\n 4 files changed, 37 insertions(+), 5 deletions(-)",
    "diff": "diff --git a/common/cmd_nvedit.c b/common/cmd_nvedit.c\nindex 2f5dcbc..493aecc 100644\n--- a/common/cmd_nvedit.c\n+++ b/common/cmd_nvedit.c\n@@ -914,7 +914,8 @@ static int do_env_import(cmd_tbl_t *cmdtp, int flag,\n \t\taddr = (char *)ep->data;\n \t}\n \n-\tif (himport_r(&env_htab, addr, size, sep, del ? 0 : H_NOCLEAR) == 0) {\n+\tif (himport_r(&env_htab, addr, size, sep, del ? 0 : H_NOCLEAR,\n+\t\t\t0, NULL) == 0) {\n \t\terror(\"Environment import failed: errno = %d\\n\", errno);\n \t\treturn 1;\n \t}\ndiff --git a/common/env_common.c b/common/env_common.c\nindex d9e990d..8f142ed 100644\n--- a/common/env_common.c\n+++ b/common/env_common.c\n@@ -193,7 +193,8 @@ void set_default_env(const char *s)\n \t}\n \n \tif (himport_r(&env_htab, (char *)default_environment,\n-\t\t\tsizeof(default_environment), '\\0', 0) == 0)\n+\t\t\tsizeof(default_environment), '\\0', 0,\n+\t\t\t0, NULL) == 0)\n \t\terror(\"Environment import failed: errno = %d\\n\", errno);\n \n \tgd->flags |= GD_FLG_ENV_READY;\n@@ -218,7 +219,8 @@ int env_import(const char *buf, int check)\n \t\t}\n \t}\n \n-\tif (himport_r(&env_htab, (char *)ep->data, ENV_SIZE, '\\0', 0)) {\n+\tif (himport_r(&env_htab, (char *)ep->data, ENV_SIZE, '\\0', 0,\n+\t\t\t0, NULL)) {\n \t\tgd->flags |= GD_FLG_ENV_READY;\n \t\treturn 1;\n \t}\ndiff --git a/include/search.h b/include/search.h\nindex a4a5ef4..94d75fc 100644\n--- a/include/search.h\n+++ b/include/search.h\n@@ -94,9 +94,13 @@ extern ssize_t hexport_r(struct hsearch_data *__htab,\n \t\t     const char __sep, char **__resp, size_t __size,\n \t\t     int argc, char * const argv[]);\n \n+/*\n+ * nvars: length of vars array\n+ * vars: array of strings (variable names) to import (nvars == 0 means all)\n+ */\n extern int himport_r(struct hsearch_data *__htab,\n \t\t     const char *__env, size_t __size, const char __sep,\n-\t\t     int __flag);\n+\t\t     int __flag, int nvars, char * const vars[]);\n \n /* Flags for himport_r() */\n #define\tH_NOCLEAR\t(1 << 0) /* do not clear hash table before importing */\ndiff --git a/lib/hashtable.c b/lib/hashtable.c\nindex abd61c8..0610e86 100644\n--- a/lib/hashtable.c\n+++ b/lib/hashtable.c\n@@ -603,6 +603,24 @@ ssize_t hexport_r(struct hsearch_data *htab, const char sep,\n  * himport()\n  */\n \n+/* Check whether variable name is amongst vars[] */\n+static int is_var_in_set(const char *name, int nvars, char * const vars[])\n+{\n+\tint i = 0;\n+\n+\t/* No variables specified means process all of them */\n+\tif (nvars == 0)\n+\t\treturn 1;\n+\n+\tfor (i = 0; i < nvars; i++) {\n+\t\tif (!strcmp(name, vars[i]))\n+\t\t\treturn 1;\n+\t}\n+\tdebug(\"Skipping non-listed variable %s\\n\", name);\n+\n+\treturn 0;\n+}\n+\n /*\n  * Import linearized data into hash table.\n  *\n@@ -639,7 +657,8 @@ ssize_t hexport_r(struct hsearch_data *htab, const char sep,\n  */\n \n int himport_r(struct hsearch_data *htab,\n-\t      const char *env, size_t size, const char sep, int flag)\n+\t\tconst char *env, size_t size, const char sep, int flag,\n+\t\tint nvars, char * const vars[])\n {\n \tchar *data, *sp, *dp, *name, *value;\n \n@@ -726,6 +745,8 @@ int himport_r(struct hsearch_data *htab,\n \t\t\t*dp++ = '\\0';\t/* terminate name */\n \n \t\t\tdebug(\"DELETE CANDIDATE: \\\"%s\\\"\\n\", name);\n+\t\t\tif (!is_var_in_set(name, nvars, vars))\n+\t\t\t\tcontinue;\n \n \t\t\tif (hdelete_r(name, htab) == 0)\n \t\t\t\tdebug(\"DELETE ERROR ##############################\\n\");\n@@ -743,6 +764,10 @@ int himport_r(struct hsearch_data *htab,\n \t\t*sp++ = '\\0';\t/* terminate value */\n \t\t++dp;\n \n+\t\t/* Skip variables which are not supposed to be processed */\n+\t\tif (!is_var_in_set(name, nvars, vars))\n+\t\t\tcontinue;\n+\n \t\t/* enter into hash table */\n \t\te.key = name;\n \t\te.data = value;\n",
    "prefixes": [
        "U-Boot",
        "v4",
        "3/7"
    ]
}