get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 113358,
    "url": "http://patches.dpdk.org/api/patches/113358/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20220623164245.561371-6-bruce.richardson@intel.com/",
    "project": {
        "id": 1,
        "url": "http://patches.dpdk.org/api/projects/1/?format=api",
        "name": "DPDK",
        "link_name": "dpdk",
        "list_id": "dev.dpdk.org",
        "list_email": "dev@dpdk.org",
        "web_url": "http://core.dpdk.org",
        "scm_url": "git://dpdk.org/dpdk",
        "webscm_url": "http://git.dpdk.org/dpdk",
        "list_archive_url": "https://inbox.dpdk.org/dev",
        "list_archive_url_format": "https://inbox.dpdk.org/dev/{}",
        "commit_url_format": ""
    },
    "msgid": "<20220623164245.561371-6-bruce.richardson@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20220623164245.561371-6-bruce.richardson@intel.com",
    "date": "2022-06-23T16:42:44",
    "name": "[RFC,5/6] telemetry: add escaping of strings in arrays",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "31332263580a8d97d3e7ff264bd38a53f8f47f5d",
    "submitter": {
        "id": 20,
        "url": "http://patches.dpdk.org/api/people/20/?format=api",
        "name": "Bruce Richardson",
        "email": "bruce.richardson@intel.com"
    },
    "delegate": {
        "id": 1,
        "url": "http://patches.dpdk.org/api/users/1/?format=api",
        "username": "tmonjalo",
        "first_name": "Thomas",
        "last_name": "Monjalon",
        "email": "thomas@monjalon.net"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/20220623164245.561371-6-bruce.richardson@intel.com/mbox/",
    "series": [
        {
            "id": 23739,
            "url": "http://patches.dpdk.org/api/series/23739/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=23739",
            "date": "2022-06-23T16:42:39",
            "name": "add json string escaping to telemetry",
            "version": 1,
            "mbox": "http://patches.dpdk.org/series/23739/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/113358/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/113358/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@inbox.dpdk.org",
        "Delivered-To": "patchwork@inbox.dpdk.org",
        "Received": [
            "from mails.dpdk.org (mails.dpdk.org [217.70.189.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id 47883A0093;\n\tThu, 23 Jun 2022 18:43:34 +0200 (CEST)",
            "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 25B1342905;\n\tThu, 23 Jun 2022 18:43:08 +0200 (CEST)",
            "from mga12.intel.com (mga12.intel.com [192.55.52.136])\n by mails.dpdk.org (Postfix) with ESMTP id 1EF464281C\n for <dev@dpdk.org>; Thu, 23 Jun 2022 18:43:03 +0200 (CEST)",
            "from fmsmga005.fm.intel.com ([10.253.24.32])\n by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 23 Jun 2022 09:43:03 -0700",
            "from silpixa00401385.ir.intel.com (HELO\n silpixa00401385.ger.corp.intel.com.) ([10.237.223.125])\n by fmsmga005.fm.intel.com with ESMTP; 23 Jun 2022 09:43:02 -0700"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple;\n d=intel.com; i=@intel.com; q=dns/txt; s=Intel;\n t=1656002584; x=1687538584;\n h=from:to:cc:subject:date:message-id:in-reply-to:\n references:mime-version:content-transfer-encoding;\n bh=p8/jQNoGnup04KD0QRg89eDZA6GFDXqWTb4/qfascmA=;\n b=Uwgxpx9Fw7yydFm/Wta31VFMj18h/RwoioK0N6lMgCeyZ8BDgwfWBVE7\n hgSqRuMqlEw3hwaJ2cSKbSAc2UAzYS4CWqaxIwe74YVum5gDqmJIPn9cD\n 7jh6RxZ845U6dYLnpSFjlkpPsEl24yygQx74aW7X8E70HTk5bOauJYwub\n HkgHaNYI8LqbfseKr+Rq6nbjyCZ2pKkbvj/TFl7shdcjJN3asRDvlaxGE\n wUABdDJ7Fo0+ZL5u2jF4t2q6umRMFkggnQ/Ev2hfmfq5SEeHavkEifJu9\n 4g3y+nmGe7auh4LE9rRpSmI6c08ptlyhxKIu5Im+tjDMeadGRcuriK3ys A==;",
        "X-IronPort-AV": [
            "E=McAfee;i=\"6400,9594,10386\"; a=\"260589102\"",
            "E=Sophos;i=\"5.92,216,1650956400\"; d=\"scan'208\";a=\"260589102\"",
            "E=Sophos;i=\"5.92,216,1650956400\"; d=\"scan'208\";a=\"915267953\""
        ],
        "X-ExtLoop1": "1",
        "From": "Bruce Richardson <bruce.richardson@intel.com>",
        "To": "dev@dpdk.org",
        "Cc": "ciara.power@intel.com, fengchengwen@huawei.com, mb@smartsharesystems.com,\n Bruce Richardson <bruce.richardson@intel.com>",
        "Subject": "[RFC PATCH 5/6] telemetry: add escaping of strings in arrays",
        "Date": "Thu, 23 Jun 2022 17:42:44 +0100",
        "Message-Id": "<20220623164245.561371-6-bruce.richardson@intel.com>",
        "X-Mailer": "git-send-email 2.34.1",
        "In-Reply-To": "<20220623164245.561371-1-bruce.richardson@intel.com>",
        "References": "<20220623164245.561371-1-bruce.richardson@intel.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.29",
        "Precedence": "list",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n <mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "List-Archive": "<http://mails.dpdk.org/archives/dev/>",
        "List-Post": "<mailto:dev@dpdk.org>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "List-Subscribe": "<https://mails.dpdk.org/listinfo/dev>,\n <mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org"
    },
    "content": "When strings are added to an array variable, we need to properly escape\nthe invalid json characters in the strings.\n\nSigned-off-by: Bruce Richardson <bruce.richardson@intel.com>\n---\n lib/telemetry/telemetry_json.h | 28 +++++++++++++++++++---------\n 1 file changed, 19 insertions(+), 9 deletions(-)",
    "diff": "diff --git a/lib/telemetry/telemetry_json.h b/lib/telemetry/telemetry_json.h\nindex 13df5d07e3..c4442a0bf0 100644\n--- a/lib/telemetry/telemetry_json.h\n+++ b/lib/telemetry/telemetry_json.h\n@@ -52,17 +52,22 @@ static const char control_chars[0x20] = {\n \n /**\n  * @internal\n- * Does the same as __json_snprintf(buf, len, \"\\\"%s\\\"\", str)\n- * except that it does proper escaping as necessary.\n+ * This function acts the same as __json_snprintf(buf, len, \"%s%s%s\", prefix, str, suffix)\n+ * except that it does proper escaping of \"str\" as necessary. Prefix and suffix should be compile-\n+ * time constants not needing escaping.\n  * Drops any invalid characters we don't support\n  */\n static inline int\n-__json_format_str(char *buf, const int len, const char *str)\n+__json_format_str(char *buf, const int len, const char *prefix, const char *str, const char *suffix)\n {\n \tchar tmp[len];\n \tint tmpidx = 0;\n \n-\ttmp[tmpidx++] = '\"';\n+\twhile (*prefix != '\\0' && tmpidx < len)\n+\t\ttmp[tmpidx++] = *prefix++;\n+\tif (tmpidx >= len)\n+\t\treturn 0;\n+\n \twhile (*str != '\\0') {\n \t\tif (*str < (int)RTE_DIM(control_chars)) {\n \t\t\tint idx = *str;  /* compilers don't like char type as index */\n@@ -75,7 +80,7 @@ __json_format_str(char *buf, const int len, const char *str)\n \t\t\ttmp[tmpidx++] = *str;\n \t\t} else\n \t\t\ttmp[tmpidx++] = *str;\n-\t\t/* we always need space for closing quote and null character.\n+\t\t/* we always need space for (at minimum) closing quote and null character.\n \t\t * Ensuring at least two free characters also means we can always take an\n \t\t * escaped character like \"\\n\" without overflowing\n \t\t */\n@@ -83,7 +88,12 @@ __json_format_str(char *buf, const int len, const char *str)\n \t\t\treturn 0;\n \t\tstr++;\n \t}\n-\ttmp[tmpidx++] = '\"';\n+\n+\twhile (*suffix != '\\0' && tmpidx < len)\n+\t\ttmp[tmpidx++] = *suffix++;\n+\tif (tmpidx >= len)\n+\t\treturn 0;\n+\n \ttmp[tmpidx] = '\\0';\n \n \tstrcpy(buf, tmp);\n@@ -108,7 +118,7 @@ rte_tel_json_empty_obj(char *buf, const int len, const int used)\n static inline int\n rte_tel_json_str(char *buf, const int len, const int used, const char *str)\n {\n-\treturn used + __json_format_str(buf + used, len - used, str);\n+\treturn used + __json_format_str(buf + used, len - used, \"\\\"\", str, \"\\\"\");\n }\n \n /* Appends a string into the JSON array in the provided buffer. */\n@@ -118,9 +128,9 @@ rte_tel_json_add_array_string(char *buf, const int len, const int used,\n {\n \tint ret, end = used - 1; /* strip off final delimiter */\n \tif (used <= 2) /* assume empty, since minimum is '[]' */\n-\t\treturn __json_snprintf(buf, len, \"[\\\"%s\\\"]\", str);\n+\t\treturn __json_format_str(buf, len, \"[\\\"\", str, \"\\\"]\");\n \n-\tret = __json_snprintf(buf + end, len - end, \",\\\"%s\\\"]\", str);\n+\tret = __json_format_str(buf + end, len - end, \",\\\"\", str, \"\\\"]\");\n \treturn ret == 0 ? used : end + ret;\n }\n \n",
    "prefixes": [
        "RFC",
        "5/6"
    ]
}