Patch Detail
Show a patch.
GET /api/patches/10107/?format=api
{ "id": 10107, "url": "https://patchwork.libcamera.org/api/patches/10107/?format=api", "web_url": "https://patchwork.libcamera.org/patch/10107/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/projects/1/?format=api", "name": "libcamera", "link_name": "libcamera", "list_id": "libcamera_core", "list_email": "libcamera-devel@lists.libcamera.org", "web_url": "", "scm_url": "", "webscm_url": "" }, "msgid": "<20201020014005.12783-2-laurent.pinchart@ideasonboard.com>", "date": "2020-10-20T01:40:01", "name": "[libcamera-devel,v2,1/5] utils: checkstyle.py: Add d-pointer formatter", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "1c4918e7ed3d3711ffe7cc9044e209a54e99e22a", "submitter": { "id": 2, "url": "https://patchwork.libcamera.org/api/people/2/?format=api", "name": "Laurent Pinchart", "email": "laurent.pinchart@ideasonboard.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/10107/mbox/", "series": [ { "id": 1386, "url": "https://patchwork.libcamera.org/api/series/1386/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=1386", "date": "2020-10-20T01:40:00", "name": "libcamera: Implement d-pointer design pattern", "version": 2, "mbox": "https://patchwork.libcamera.org/series/1386/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/10107/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/10107/checks/", "tags": {}, "headers": { "Return-Path": "<libcamera-devel-bounces@lists.libcamera.org>", "X-Original-To": "parsemail@patchwork.libcamera.org", "Delivered-To": "parsemail@patchwork.libcamera.org", "Received": [ "from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 16A74BDB1F\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 20 Oct 2020 01:40:59 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id A5718613BF;\n\tTue, 20 Oct 2020 03:40:57 +0200 (CEST)", "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 9B61E60CE6\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 20 Oct 2020 03:40:56 +0200 (CEST)", "from pendragon.lan (62-78-145-57.bb.dnainternet.fi [62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 35A39309\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 20 Oct 2020 03:40:56 +0200 (CEST)" ], "Authentication-Results": "lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"Z4inkzAW\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1603158056;\n\tbh=Ac66USv+unUkNJVSXkjyKOsX4yhDCvlIGajTFo/mnzk=;\n\th=From:To:Subject:Date:In-Reply-To:References:From;\n\tb=Z4inkzAWPAsumfns/Ylpd5bfFeotAi16bAYr/6gDUMj/b6lzdTVbOfZ7ieVeVq8O8\n\tMOoH28nUuGXOOs7d1DhoMWw5leJxvpKRFiAz/HgHNSbmLsK8fFmDMn/du67ahpTy0b\n\t9RqCI+iL7YxTUM1P8FTg+c2e4WUKLfHxwRHadSho=", "From": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Tue, 20 Oct 2020 04:40:01 +0300", "Message-Id": "<20201020014005.12783-2-laurent.pinchart@ideasonboard.com>", "X-Mailer": "git-send-email 2.27.0", "In-Reply-To": "<20201020014005.12783-1-laurent.pinchart@ideasonboard.com>", "References": "<20201020014005.12783-1-laurent.pinchart@ideasonboard.com>", "MIME-Version": "1.0", "Subject": "[libcamera-devel] [PATCH v2 1/5] utils: checkstyle.py: Add\n\td-pointer formatter", "X-BeenThere": "libcamera-devel@lists.libcamera.org", "X-Mailman-Version": "2.1.29", "Precedence": "list", "List-Id": "<libcamera-devel.lists.libcamera.org>", "List-Unsubscribe": "<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>", "List-Archive": "<https://lists.libcamera.org/pipermail/libcamera-devel/>", "List-Post": "<mailto:libcamera-devel@lists.libcamera.org>", "List-Help": "<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>", "List-Subscribe": "<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>", "Content-Type": "text/plain; charset=\"us-ascii\"", "Content-Transfer-Encoding": "7bit", "Errors-To": "libcamera-devel-bounces@lists.libcamera.org", "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>" }, "content": "Add a formatter to ensure consistent naming of 'd' and 'o' variables\nrelated to the d-pointer design pattern, as implemented by the\nExtensible class. The formatter also ensures that the pointer is always\nconst. const-correctness issues related to the data pointed to will be\ncaught by the compiler, and thus don't need to be checked here.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n utils/checkstyle.py | 32 ++++++++++++++++++++++++++++++++\n 1 file changed, 32 insertions(+)", "diff": "diff --git a/utils/checkstyle.py b/utils/checkstyle.py\nindex d5dc26c0f666..7225cac47a4e 100755\n--- a/utils/checkstyle.py\n+++ b/utils/checkstyle.py\n@@ -481,6 +481,38 @@ class DoxygenFormatter(Formatter):\n return '\\n'.join(lines)\n \n \n+class DPointerFormatter(Formatter):\n+ # Ensure consistent naming of variables related to the d-pointer design\n+ # pattern.\n+ patterns = ('*.cpp', '*.h')\n+\n+ # The clang formatter runs first, we can thus rely on appropriate coding\n+ # style.\n+ declare_regex = re.compile(r'^(\\t*)(const )?([a-zA-Z0-9_]+) \\*( ?const )?([a-zA-Z0-9_]+) = (LIBCAMERA_[DO]_PTR)\\(([a-zA-Z0-9_]+)\\);$')\n+\n+ @classmethod\n+ def format(cls, filename, data):\n+ lines = []\n+\n+ for line in data.split('\\n'):\n+ match = cls.declare_regex.match(line)\n+ if match:\n+ indent = match.group(1) or ''\n+ const = match.group(2) or ''\n+ macro = match.group(6)\n+ klass = match.group(7)\n+ if macro == 'LIBCAMERA_D_PTR':\n+ var = 'Private *const d'\n+ else:\n+ var = f'{klass} *const o'\n+\n+ line = f'{indent}{const}{var} = {macro}({klass});'\n+\n+ lines.append(line)\n+\n+ return '\\n'.join(lines)\n+\n+\n class IncludeOrderFormatter(Formatter):\n patterns = ('*.cpp', '*.h')\n \n", "prefixes": [ "libcamera-devel", "v2", "1/5" ] }