get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 179814,
    "url": "http://patchwork.ozlabs.org/api/patches/179814/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/uboot/patch/1345803102-21110-6-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-6-git-send-email-gerlando.falauto@keymile.com>",
    "list_archive_url": null,
    "date": "2012-08-24T10:11:40",
    "name": "[U-Boot,v4,5/7] env: check and apply changes on delete/destroy",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "91f7f7b04263c95c0e32533190123d1d139c2591",
    "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-6-git-send-email-gerlando.falauto@keymile.com/mbox/",
    "series": [],
    "comments": "http://patchwork.ozlabs.org/api/patches/179814/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/179814/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 2CEDA2C00D8\n\tfor <incoming@patchwork.ozlabs.org>;\n\tFri, 24 Aug 2012 20:19:25 +1000 (EST)",
            "from localhost (localhost [127.0.0.1])\n\tby theia.denx.de (Postfix) with ESMTP id 3A2F92811A;\n\tFri, 24 Aug 2012 12:19:18 +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 hhTsF78L1lPp; Fri, 24 Aug 2012 12:19:17 +0200 (CEST)",
            "from theia.denx.de (localhost [127.0.0.1])\n\tby theia.denx.de (Postfix) with ESMTP id 622B52811B;\n\tFri, 24 Aug 2012 12:18:51 +0200 (CEST)",
            "from localhost (localhost [127.0.0.1])\n\tby theia.denx.de (Postfix) with ESMTP id 971F4280CA\n\tfor <u-boot@lists.denx.de>; Fri, 24 Aug 2012 12:18:42 +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 TOuIJvHqqoih for <u-boot@lists.denx.de>;\n\tFri, 24 Aug 2012 12:18:42 +0200 (CEST)",
            "from mail-de.keymile.com (mail-de.keymile.com [195.8.104.1])\n\tby theia.denx.de (Postfix) with SMTP id C797828101\n\tfor <u-boot@lists.denx.de>; Fri, 24 Aug 2012 12:18:41 +0200 (CEST)",
            "from mailrelay.de.keymile.net ([10.9.1.54]) by eSafe SMTP Relay\n\t1345792219; Fri, 24 Aug 2012 12:18:40 +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 q7OAHMjD026728; Fri, 24 Aug 2012 12:17:31 +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:40 +0200",
        "Message-Id": "<1345803102-21110-6-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 5/7] env: check and apply changes on\n\tdelete/destroy",
        "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": "Signed-off-by: Gerlando Falauto <gerlando.falauto@keymile.com>\n---\n common/cmd_nvedit.c |    2 +-\n include/search.h    |    5 +++--\n lib/hashtable.c     |   16 ++++++++++------\n 3 files changed, 14 insertions(+), 9 deletions(-)",
    "diff": "diff --git a/common/cmd_nvedit.c b/common/cmd_nvedit.c\nindex 983e747..b0860f3 100644\n--- a/common/cmd_nvedit.c\n+++ b/common/cmd_nvedit.c\n@@ -359,7 +359,7 @@ int _do_env_set(int flag, int argc, char * const argv[])\n \n \t/* Delete only ? */\n \tif (argc < 3 || argv[2] == NULL) {\n-\t\tint rc = hdelete_r(name, &env_htab);\n+\t\tint rc = hdelete_r(name, &env_htab, 0);\n \t\treturn !rc;\n \t}\n \ndiff --git a/include/search.h b/include/search.h\nindex 721c8ac..93e1cbc 100644\n--- a/include/search.h\n+++ b/include/search.h\n@@ -73,7 +73,7 @@ struct hsearch_data {\n extern int hcreate_r(size_t __nel, struct hsearch_data *__htab);\n \n /* Destroy current internal hashing table.  */\n-extern void hdestroy_r(struct hsearch_data *__htab);\n+extern void hdestroy_r(struct hsearch_data *__htab, int do_apply);\n \n /*\n  * Search for entry matching ITEM.key in internal hash table.  If\n@@ -98,7 +98,8 @@ extern int hstrstr_r(const char *__match, int __last_idx, ENTRY ** __retval,\n \t\t    struct hsearch_data *__htab);\n \n /* Search and delete entry matching ITEM.key in internal hash table. */\n-extern int hdelete_r(const char *__key, struct hsearch_data *__htab);\n+extern int hdelete_r(const char *__key, struct hsearch_data *__htab,\n+\t\t\tint do_apply);\n \n extern ssize_t hexport_r(struct hsearch_data *__htab,\n \t\t     const char __sep, char **__resp, size_t __size,\ndiff --git a/lib/hashtable.c b/lib/hashtable.c\nindex 6cfba56..f3f47de 100644\n--- a/lib/hashtable.c\n+++ b/lib/hashtable.c\n@@ -142,7 +142,7 @@ int hcreate_r(size_t nel, struct hsearch_data *htab)\n  * be freed and the local static variable can be marked as not used.\n  */\n \n-void hdestroy_r(struct hsearch_data *htab)\n+void hdestroy_r(struct hsearch_data *htab, int do_apply)\n {\n \tint i;\n \n@@ -156,7 +156,10 @@ void hdestroy_r(struct hsearch_data *htab)\n \tfor (i = 1; i <= htab->size; ++i) {\n \t\tif (htab->table[i].used > 0) {\n \t\t\tENTRY *ep = &htab->table[i].entry;\n-\n+\t\t\tif (do_apply && htab->apply != NULL) {\n+\t\t\t\t/* deletion is always forced */\n+\t\t\t\thtab->apply(ep->key, ep->data, NULL, H_FORCE);\n+\t\t\t}\n \t\t\tfree((void *)ep->key);\n \t\t\tfree(ep->data);\n \t\t}\n@@ -401,7 +404,7 @@ int hsearch_r(ENTRY item, ACTION action, ENTRY ** retval,\n  * do that.\n  */\n \n-int hdelete_r(const char *key, struct hsearch_data *htab)\n+int hdelete_r(const char *key, struct hsearch_data *htab, int do_apply)\n {\n \tENTRY e, *ep;\n \tint idx;\n@@ -417,7 +420,8 @@ int hdelete_r(const char *key, struct hsearch_data *htab)\n \n \t/* free used ENTRY */\n \tdebug(\"hdelete: DELETING key \\\"%s\\\"\\n\", key);\n-\n+\tif (do_apply && htab->apply != NULL)\n+\t\thtab->apply(ep->key, ep->data, NULL, H_FORCE);\n \tfree((void *)ep->key);\n \tfree(ep->data);\n \thtab->table[idx].used = -1;\n@@ -682,7 +686,7 @@ int himport_r(struct hsearch_data *htab,\n \t\tdebug(\"Destroy Hash Table: %p table = %p\\n\", htab,\n \t\t       htab->table);\n \t\tif (htab->table)\n-\t\t\thdestroy_r(htab);\n+\t\t\thdestroy_r(htab, do_apply);\n \t}\n \n \t/*\n@@ -748,7 +752,7 @@ int himport_r(struct hsearch_data *htab,\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\tif (hdelete_r(name, htab, do_apply) == 0)\n \t\t\t\tdebug(\"DELETE ERROR ##############################\\n\");\n \n \t\t\tcontinue;\n",
    "prefixes": [
        "U-Boot",
        "v4",
        "5/7"
    ]
}