Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/1.2/patches/814477/?format=api
{ "id": 814477, "url": "http://patchwork.ozlabs.org/api/1.2/patches/814477/?format=api", "web_url": "http://patchwork.ozlabs.org/project/netdev/patch/20170916075036.28676-1-thomas@m3y3r.de/", "project": { "id": 7, "url": "http://patchwork.ozlabs.org/api/1.2/projects/7/?format=api", "name": "Linux network development", "link_name": "netdev", "list_id": "netdev.vger.kernel.org", "list_email": "netdev@vger.kernel.org", "web_url": null, "scm_url": null, "webscm_url": null, "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<20170916075036.28676-1-thomas@m3y3r.de>", "list_archive_url": null, "date": "2017-09-16T07:50:36", "name": "[V2] tipc: Use bsearch library function", "commit_ref": null, "pull_url": null, "state": "changes-requested", "archived": true, "hash": "f51f4f2bf357f64f5b2911612188dc324e5033a7", "submitter": { "id": 10277, "url": "http://patchwork.ozlabs.org/api/1.2/people/10277/?format=api", "name": "Thomas Meyer", "email": "thomas@m3y3r.de" }, "delegate": { "id": 34, "url": "http://patchwork.ozlabs.org/api/1.2/users/34/?format=api", "username": "davem", "first_name": "David", "last_name": "Miller", "email": "davem@davemloft.net" }, "mbox": "http://patchwork.ozlabs.org/project/netdev/patch/20170916075036.28676-1-thomas@m3y3r.de/mbox/", "series": [ { "id": 3420, "url": "http://patchwork.ozlabs.org/api/1.2/series/3420/?format=api", "web_url": "http://patchwork.ozlabs.org/project/netdev/list/?series=3420", "date": "2017-09-16T07:50:36", "name": "[V2] tipc: Use bsearch library function", "version": 2, "mbox": "http://patchwork.ozlabs.org/series/3420/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/814477/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/814477/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<netdev-owner@vger.kernel.org>", "X-Original-To": "patchwork-incoming@ozlabs.org", "Delivered-To": "patchwork-incoming@ozlabs.org", "Authentication-Results": "ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=vger.kernel.org\n\t(client-ip=209.132.180.67; helo=vger.kernel.org;\n\tenvelope-from=netdev-owner@vger.kernel.org;\n\treceiver=<UNKNOWN>)", "Received": [ "from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3xvPb25gMFz9t2l\n\tfor <patchwork-incoming@ozlabs.org>;\n\tSat, 16 Sep 2017 17:50:54 +1000 (AEST)", "(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1751233AbdIPHuj (ORCPT <rfc822;patchwork-incoming@ozlabs.org>);\n\tSat, 16 Sep 2017 03:50:39 -0400", "from www17.your-server.de ([213.133.104.17]:51543 \"EHLO\n\twww17.your-server.de\" rhost-flags-OK-OK-OK-OK) by vger.kernel.org\n\twith ESMTP id S1751183AbdIPHui (ORCPT\n\t<rfc822;netdev@vger.kernel.org>); Sat, 16 Sep 2017 03:50:38 -0400", "from [95.222.26.195] (helo=localhost.localdomain)\n\tby www17.your-server.de with esmtpsa\n\t(TLSv1.2:DHE-RSA-AES128-GCM-SHA256:128) (Exim 4.85_2)\n\t(envelope-from <thomas@m3y3r.de>)\n\tid 1dt7s4-0008M3-A5; Sat, 16 Sep 2017 09:50:36 +0200" ], "From": "Thomas Meyer <thomas@m3y3r.de>", "To": "jon.maloy@ericsson.com, ying.xue@windriver.com,\n\tnetdev@vger.kernel.org, tipc-discussion@lists.sourceforge.net,\n\tlinux-kernel@vger.kernel.org, davem@davemloft.net", "Cc": "Thomas Meyer <thomas@m3y3r.de>", "Subject": "[PATCH V2] tipc: Use bsearch library function", "Date": "Sat, 16 Sep 2017 09:50:36 +0200", "Message-Id": "<20170916075036.28676-1-thomas@m3y3r.de>", "X-Mailer": "git-send-email 2.11.0", "In-Reply-To": "<20170911.143025.555018840006192902.davem@davemloft.net>", "References": "<20170911.143025.555018840006192902.davem@davemloft.net>", "X-Authenticated-Sender": "thomas@m3y3r.de", "X-Virus-Scanned": "Clear (ClamAV 0.99.2/23839/Sat Sep 16 06:41:17 2017)", "Sender": "netdev-owner@vger.kernel.org", "Precedence": "bulk", "List-ID": "<netdev.vger.kernel.org>", "X-Mailing-List": "netdev@vger.kernel.org" }, "content": "Use common library function rather than explicitly coding\nsome variant of it yourself.\n\nSigned-off-by: Thomas Meyer <thomas@m3y3r.de>\n---\n net/tipc/name_table.c | 30 +++++++++++++++---------------\n 1 file changed, 15 insertions(+), 15 deletions(-)\n\nV2: Coding style", "diff": "diff --git a/net/tipc/name_table.c b/net/tipc/name_table.c\nindex bd0aac87b41a..eeb4d7a13de2 100644\n--- a/net/tipc/name_table.c\n+++ b/net/tipc/name_table.c\n@@ -44,6 +44,7 @@\n #include \"addr.h\"\n #include \"node.h\"\n #include <net/genetlink.h>\n+#include <linux/bsearch.h>\n \n #define TIPC_NAMETBL_SIZE 1024\t\t/* must be a power of 2 */\n \n@@ -168,6 +169,18 @@ static struct name_seq *tipc_nameseq_create(u32 type, struct hlist_head *seq_hea\n \treturn nseq;\n }\n \n+static int nameseq_find_subseq_cmp(const void *key, const void *elt)\n+{\n+\tstruct sub_seq *sseq = (struct sub_seq *)elt;\n+\tu32 instance = *(u32 *)key;\n+\n+\tif (instance < sseq->lower)\n+\t\treturn -1;\n+\telse if (instance > sseq->upper)\n+\t\treturn 1;\n+\treturn 0;\n+}\n+\n /**\n * nameseq_find_subseq - find sub-sequence (if any) matching a name instance\n *\n@@ -176,21 +189,8 @@ static struct name_seq *tipc_nameseq_create(u32 type, struct hlist_head *seq_hea\n static struct sub_seq *nameseq_find_subseq(struct name_seq *nseq,\n \t\t\t\t\t u32 instance)\n {\n-\tstruct sub_seq *sseqs = nseq->sseqs;\n-\tint low = 0;\n-\tint high = nseq->first_free - 1;\n-\tint mid;\n-\n-\twhile (low <= high) {\n-\t\tmid = (low + high) / 2;\n-\t\tif (instance < sseqs[mid].lower)\n-\t\t\thigh = mid - 1;\n-\t\telse if (instance > sseqs[mid].upper)\n-\t\t\tlow = mid + 1;\n-\t\telse\n-\t\t\treturn &sseqs[mid];\n-\t}\n-\treturn NULL;\n+\treturn bsearch(&instance, nseq->sseqs, nseq->first_free,\n+\t\t sizeof(struct sub_seq), nameseq_find_subseq_cmp);\n }\n \n /**\n", "prefixes": [ "V2" ] }