get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 808872,
    "url": "http://patchwork.ozlabs.org/api/patches/808872/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20170901180340.30009-5-eblake@redhat.com/",
    "project": {
        "id": 14,
        "url": "http://patchwork.ozlabs.org/api/projects/14/?format=api",
        "name": "QEMU Development",
        "link_name": "qemu-devel",
        "list_id": "qemu-devel.nongnu.org",
        "list_email": "qemu-devel@nongnu.org",
        "web_url": "",
        "scm_url": "",
        "webscm_url": "",
        "list_archive_url": "",
        "list_archive_url_format": "",
        "commit_url_format": ""
    },
    "msgid": "<20170901180340.30009-5-eblake@redhat.com>",
    "list_archive_url": null,
    "date": "2017-09-01T18:03:15",
    "name": "[v6,04/29] qtest: Don't perform side effects inside assertion",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "57e37ff004b0661b731a5abb551067a6e2690cb1",
    "submitter": {
        "id": 6591,
        "url": "http://patchwork.ozlabs.org/api/people/6591/?format=api",
        "name": "Eric Blake",
        "email": "eblake@redhat.com"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20170901180340.30009-5-eblake@redhat.com/mbox/",
    "series": [
        {
            "id": 1089,
            "url": "http://patchwork.ozlabs.org/api/series/1089/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/list/?series=1089",
            "date": "2017-09-01T18:03:12",
            "name": "Preliminary libqtest cleanups",
            "version": 6,
            "mbox": "http://patchwork.ozlabs.org/series/1089/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/808872/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/808872/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>",
        "X-Original-To": "incoming@patchwork.ozlabs.org",
        "Delivered-To": "patchwork-incoming@bilbo.ozlabs.org",
        "Authentication-Results": [
            "ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=nongnu.org\n\t(client-ip=2001:4830:134:3::11; helo=lists.gnu.org;\n\tenvelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n\treceiver=<UNKNOWN>)",
            "ext-mx08.extmail.prod.ext.phx2.redhat.com;\n\tdmarc=none (p=none dis=none) header.from=redhat.com",
            "ext-mx08.extmail.prod.ext.phx2.redhat.com;\n\tspf=fail smtp.mailfrom=eblake@redhat.com"
        ],
        "Received": [
            "from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11])\n\t(using TLSv1 with cipher AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xkRwH2tkMz9s3w\n\tfor <incoming@patchwork.ozlabs.org>;\n\tSat,  2 Sep 2017 04:04:47 +1000 (AEST)",
            "from localhost ([::1]:53078 helo=lists.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.71) (envelope-from\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>)\n\tid 1dnqJB-00075j-De\n\tfor incoming@patchwork.ozlabs.org; Fri, 01 Sep 2017 14:04:45 -0400",
            "from eggs.gnu.org ([2001:4830:134:3::10]:55629)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <eblake@redhat.com>) id 1dnqIJ-0006z5-QW\n\tfor qemu-devel@nongnu.org; Fri, 01 Sep 2017 14:03:56 -0400",
            "from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <eblake@redhat.com>) id 1dnqII-0001TC-Dt\n\tfor qemu-devel@nongnu.org; Fri, 01 Sep 2017 14:03:51 -0400",
            "from mx1.redhat.com ([209.132.183.28]:60576)\n\tby eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)\n\t(Exim 4.71) (envelope-from <eblake@redhat.com>) id 1dnqII-0001Sj-5d\n\tfor qemu-devel@nongnu.org; Fri, 01 Sep 2017 14:03:50 -0400",
            "from smtp.corp.redhat.com\n\t(int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15])\n\t(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby mx1.redhat.com (Postfix) with ESMTPS id 310EAC058EDE\n\tfor <qemu-devel@nongnu.org>; Fri,  1 Sep 2017 18:03:49 +0000 (UTC)",
            "from red.redhat.com (ovpn-121-149.rdu2.redhat.com [10.10.121.149])\n\tby smtp.corp.redhat.com (Postfix) with ESMTP id 941D762929;\n\tFri,  1 Sep 2017 18:03:48 +0000 (UTC)"
        ],
        "DMARC-Filter": "OpenDMARC Filter v1.3.2 mx1.redhat.com 310EAC058EDE",
        "From": "Eric Blake <eblake@redhat.com>",
        "To": "qemu-devel@nongnu.org",
        "Date": "Fri,  1 Sep 2017 13:03:15 -0500",
        "Message-Id": "<20170901180340.30009-5-eblake@redhat.com>",
        "In-Reply-To": "<20170901180340.30009-1-eblake@redhat.com>",
        "References": "<20170901180340.30009-1-eblake@redhat.com>",
        "X-Scanned-By": "MIMEDefang 2.79 on 10.5.11.15",
        "X-Greylist": "Sender IP whitelisted, not delayed by milter-greylist-4.5.16\n\t(mx1.redhat.com [10.5.110.32]);\n\tFri, 01 Sep 2017 18:03:49 +0000 (UTC)",
        "X-detected-operating-system": "by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]\n\t[fuzzy]",
        "X-Received-From": "209.132.183.28",
        "Subject": "[Qemu-devel] [PATCH v6 04/29] qtest: Don't perform side effects\n\tinside assertion",
        "X-BeenThere": "qemu-devel@nongnu.org",
        "X-Mailman-Version": "2.1.21",
        "Precedence": "list",
        "List-Id": "<qemu-devel.nongnu.org>",
        "List-Unsubscribe": "<https://lists.nongnu.org/mailman/options/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>",
        "List-Archive": "<http://lists.nongnu.org/archive/html/qemu-devel/>",
        "List-Post": "<mailto:qemu-devel@nongnu.org>",
        "List-Help": "<mailto:qemu-devel-request@nongnu.org?subject=help>",
        "List-Subscribe": "<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=subscribe>",
        "Cc": "pbonzini@redhat.com, armbru@redhat.com",
        "Errors-To": "qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org",
        "Sender": "\"Qemu-devel\"\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>"
    },
    "content": "Assertions should be separate from the side effects, since in\ntheory, g_assert() can be disabled (in practice, we can't really\never do that).\n\nSigned-off-by: Eric Blake <eblake@redhat.com>\n---\n qtest.c | 80 ++++++++++++++++++++++++++++++++++++++++++++++-------------------\n 1 file changed, 57 insertions(+), 23 deletions(-)",
    "diff": "diff --git a/qtest.c b/qtest.c\nindex 88a09e9afc..cbbfb71114 100644\n--- a/qtest.c\n+++ b/qtest.c\n@@ -332,10 +332,13 @@ static void qtest_process_command(CharBackend *chr, gchar **words)\n                strcmp(words[0], \"outl\") == 0) {\n         unsigned long addr;\n         unsigned long value;\n+        int ret;\n\n         g_assert(words[1] && words[2]);\n-        g_assert(qemu_strtoul(words[1], NULL, 0, &addr) == 0);\n-        g_assert(qemu_strtoul(words[2], NULL, 0, &value) == 0);\n+        ret = qemu_strtoul(words[1], NULL, 0, &addr);\n+        g_assert(ret == 0);\n+        ret = qemu_strtoul(words[2], NULL, 0, &value);\n+        g_assert(ret == 0);\n         g_assert(addr <= 0xffff);\n\n         if (words[0][3] == 'b') {\n@@ -352,9 +355,11 @@ static void qtest_process_command(CharBackend *chr, gchar **words)\n         strcmp(words[0], \"inl\") == 0) {\n         unsigned long addr;\n         uint32_t value = -1U;\n+        int ret;\n\n         g_assert(words[1]);\n-        g_assert(qemu_strtoul(words[1], NULL, 0, &addr) == 0);\n+        ret = qemu_strtoul(words[1], NULL, 0, &addr);\n+        g_assert(ret == 0);\n         g_assert(addr <= 0xffff);\n\n         if (words[0][2] == 'b') {\n@@ -372,10 +377,13 @@ static void qtest_process_command(CharBackend *chr, gchar **words)\n                strcmp(words[0], \"writeq\") == 0) {\n         uint64_t addr;\n         uint64_t value;\n+        int ret;\n\n         g_assert(words[1] && words[2]);\n-        g_assert(qemu_strtou64(words[1], NULL, 0, &addr) == 0);\n-        g_assert(qemu_strtou64(words[2], NULL, 0, &value) == 0);\n+        ret = qemu_strtou64(words[1], NULL, 0, &addr);\n+        g_assert(ret == 0);\n+        ret = qemu_strtou64(words[2], NULL, 0, &value);\n+        g_assert(ret == 0);\n\n         if (words[0][5] == 'b') {\n             uint8_t data = value;\n@@ -401,9 +409,11 @@ static void qtest_process_command(CharBackend *chr, gchar **words)\n                strcmp(words[0], \"readq\") == 0) {\n         uint64_t addr;\n         uint64_t value = UINT64_C(-1);\n+        int ret;\n\n         g_assert(words[1]);\n-        g_assert(qemu_strtou64(words[1], NULL, 0, &addr) == 0);\n+        ret = qemu_strtou64(words[1], NULL, 0, &addr);\n+        g_assert(ret == 0);\n\n         if (words[0][4] == 'b') {\n             uint8_t data;\n@@ -427,10 +437,13 @@ static void qtest_process_command(CharBackend *chr, gchar **words)\n         uint64_t addr, len, i;\n         uint8_t *data;\n         char *enc;\n+        int ret;\n\n         g_assert(words[1] && words[2]);\n-        g_assert(qemu_strtou64(words[1], NULL, 0, &addr) == 0);\n-        g_assert(qemu_strtou64(words[2], NULL, 0, &len) == 0);\n+        ret = qemu_strtou64(words[1], NULL, 0, &addr);\n+        g_assert(ret == 0);\n+        ret = qemu_strtou64(words[2], NULL, 0, &len);\n+        g_assert(ret == 0);\n         /* We'd send garbage to libqtest if len is 0 */\n         g_assert(len);\n\n@@ -451,10 +464,13 @@ static void qtest_process_command(CharBackend *chr, gchar **words)\n         uint64_t addr, len;\n         uint8_t *data;\n         gchar *b64_data;\n+        int ret;\n\n         g_assert(words[1] && words[2]);\n-        g_assert(qemu_strtou64(words[1], NULL, 0, &addr) == 0);\n-        g_assert(qemu_strtou64(words[2], NULL, 0, &len) == 0);\n+        ret = qemu_strtou64(words[1], NULL, 0, &addr);\n+        g_assert(ret == 0);\n+        ret = qemu_strtou64(words[2], NULL, 0, &len);\n+        g_assert(ret == 0);\n\n         data = g_malloc(len);\n         cpu_physical_memory_read(addr, data, len);\n@@ -468,10 +484,13 @@ static void qtest_process_command(CharBackend *chr, gchar **words)\n         uint64_t addr, len, i;\n         uint8_t *data;\n         size_t data_len;\n+        int ret;\n\n         g_assert(words[1] && words[2] && words[3]);\n-        g_assert(qemu_strtou64(words[1], NULL, 0, &addr) == 0);\n-        g_assert(qemu_strtou64(words[2], NULL, 0, &len) == 0);\n+        ret = qemu_strtou64(words[1], NULL, 0, &addr);\n+        g_assert(ret == 0);\n+        ret = qemu_strtou64(words[2], NULL, 0, &len);\n+        g_assert(ret == 0);\n\n         data_len = strlen(words[3]);\n         if (data_len < 3) {\n@@ -497,11 +516,15 @@ static void qtest_process_command(CharBackend *chr, gchar **words)\n         uint64_t addr, len;\n         uint8_t *data;\n         unsigned long pattern;\n+        int ret;\n\n         g_assert(words[1] && words[2] && words[3]);\n-        g_assert(qemu_strtou64(words[1], NULL, 0, &addr) == 0);\n-        g_assert(qemu_strtou64(words[2], NULL, 0, &len) == 0);\n-        g_assert(qemu_strtoul(words[3], NULL, 0, &pattern) == 0);\n+        ret = qemu_strtou64(words[1], NULL, 0, &addr);\n+        g_assert(ret == 0);\n+        ret = qemu_strtou64(words[2], NULL, 0, &len);\n+        g_assert(ret == 0);\n+        ret = qemu_strtoul(words[3], NULL, 0, &pattern);\n+        g_assert(ret == 0);\n\n         if (len) {\n             data = g_malloc(len);\n@@ -517,10 +540,13 @@ static void qtest_process_command(CharBackend *chr, gchar **words)\n         uint8_t *data;\n         size_t data_len;\n         gsize out_len;\n+        int ret;\n\n         g_assert(words[1] && words[2] && words[3]);\n-        g_assert(qemu_strtou64(words[1], NULL, 0, &addr) == 0);\n-        g_assert(qemu_strtou64(words[2], NULL, 0, &len) == 0);\n+        ret = qemu_strtou64(words[1], NULL, 0, &addr);\n+        g_assert(ret == 0);\n+        ret = qemu_strtou64(words[2], NULL, 0, &len);\n+        g_assert(ret == 0);\n\n         data_len = strlen(words[3]);\n         if (data_len < 3) {\n@@ -551,11 +577,16 @@ static void qtest_process_command(CharBackend *chr, gchar **words)\n     } else if (strcmp(words[0], \"rtas\") == 0) {\n         uint64_t res, args, ret;\n         unsigned long nargs, nret;\n+        int rc;\n\n-        g_assert(qemu_strtoul(words[2], NULL, 0, &nargs) == 0);\n-        g_assert(qemu_strtou64(words[3], NULL, 0, &args) == 0);\n-        g_assert(qemu_strtoul(words[4], NULL, 0, &nret) == 0);\n-        g_assert(qemu_strtou64(words[5], NULL, 0, &ret) == 0);\n+        rc = qemu_strtoul(words[2], NULL, 0, &nargs);\n+        g_assert(rc == 0);\n+        rc = qemu_strtou64(words[3], NULL, 0, &args);\n+        g_assert(rc == 0);\n+        rc = qemu_strtoul(words[4], NULL, 0, &nret);\n+        g_assert(rc == 0);\n+        rc = qemu_strtou64(words[5], NULL, 0, &ret);\n+        g_assert(rc == 0);\n         res = qtest_rtas_call(words[1], nargs, args, nret, ret);\n\n         qtest_send_prefix(chr);\n@@ -565,7 +596,8 @@ static void qtest_process_command(CharBackend *chr, gchar **words)\n         int64_t ns;\n\n         if (words[1]) {\n-            g_assert(qemu_strtoi64(words[1], NULL, 0, &ns) == 0);\n+            int ret = qemu_strtoi64(words[1], NULL, 0, &ns);\n+            g_assert(ret == 0);\n         } else {\n             ns = qemu_clock_deadline_ns_all(QEMU_CLOCK_VIRTUAL);\n         }\n@@ -575,9 +607,11 @@ static void qtest_process_command(CharBackend *chr, gchar **words)\n                     (int64_t)qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL));\n     } else if (qtest_enabled() && strcmp(words[0], \"clock_set\") == 0) {\n         int64_t ns;\n+        int ret;\n\n         g_assert(words[1]);\n-        g_assert(qemu_strtoi64(words[1], NULL, 0, &ns) == 0);\n+        ret = qemu_strtoi64(words[1], NULL, 0, &ns);\n+        g_assert(ret == 0);\n         qtest_clock_warp(ns);\n         qtest_send_prefix(chr);\n         qtest_sendf(chr, \"OK %\"PRIi64\"\\n\",\n",
    "prefixes": [
        "v6",
        "04/29"
    ]
}