Show a patch.

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

{
    "id": 22726,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/22726/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/22726/",
    "project": {
        "id": 1,
        "url": "https://patchwork.libcamera.org/api/1.1/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": "<20250203175936.206161-1-pobrn@protonmail.com>",
    "date": "2025-02-03T17:59:39",
    "name": "[RFC,v2,9/9] libcamera: base: log: Store categories in list",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "0ed56027d5d2e1419f075dfcab2cf1bfac446a9a",
    "submitter": {
        "id": 133,
        "url": "https://patchwork.libcamera.org/api/1.1/people/133/?format=api",
        "name": "Pőcze Barnabás",
        "email": "pobrn@protonmail.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/22726/mbox/",
    "series": [
        {
            "id": 4982,
            "url": "https://patchwork.libcamera.org/api/1.1/series/4982/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=4982",
            "date": "2025-01-30T19:58:14",
            "name": "libcamera: base: log: Misc. changes",
            "version": 2,
            "mbox": "https://patchwork.libcamera.org/series/4982/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/22726/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/22726/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 2F8C9BD80A\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon,  3 Feb 2025 17:59:47 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 458E86859D;\n\tMon,  3 Feb 2025 18:59:46 +0100 (CET)",
            "from mail-10630.protonmail.ch (mail-10630.protonmail.ch\n\t[79.135.106.30])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id C40D761876\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon,  3 Feb 2025 18:59:44 +0100 (CET)"
        ],
        "Authentication-Results": "lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=protonmail.com header.i=@protonmail.com\n\theader.b=\"Fl+gSCjd\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com;\n\ts=protonmail3; t=1738605583; x=1738864783;\n\tbh=iS7KFwtgjtdLe3sYFbSNvmj0wqHbsFaZ+7FduZfw03c=;\n\th=Date:To:From:Subject:Message-ID:In-Reply-To:References:\n\tFeedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID:\n\tMessage-ID:BIMI-Selector:List-Unsubscribe:List-Unsubscribe-Post;\n\tb=Fl+gSCjdD3ZRkS96j2znUC3VjR3UJOpW9QNocRJ7D18WNXbsKEtzMZp68sFeM09uy\n\tJxEm4oJurVvBuamBjKWDBEgT8VJT93SmDrZQBcumHHfabbGWMcvk8xGbSXSvzIhJyk\n\tiwgronNvdv3akJEQQe9ByDL07NEKSmK/SD3mZmpe/PI5RfHoj5rk2yypUF5I8eNIxP\n\tdKZNKcL/oY2S8WCUXx+Bh17RXokmxTCqtb+yK3OJIiNjlsA+S8wjKpJykV/uWixEjD\n\tWpPL46k0DG3ublQC1R6L/1EmSVdeFqJ+aryIRBuv1rCvHCjMjAZ0l1t5oqa2BvXg//\n\tUeQ3QpVbkUWbw==",
        "Date": "Mon, 03 Feb 2025 17:59:39 +0000",
        "To": "libcamera-devel@lists.libcamera.org",
        "From": "=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <pobrn@protonmail.com>",
        "Subject": "[RFC PATCH v2 9/9] libcamera: base: log: Store categories in list",
        "Message-ID": "<20250203175936.206161-1-pobrn@protonmail.com>",
        "In-Reply-To": "<20250130195811.1230581-1-pobrn@protonmail.com>",
        "References": "<20250130195811.1230581-1-pobrn@protonmail.com>",
        "Feedback-ID": "20568564:user:proton",
        "X-Pm-Message-ID": "f931f503d745fcf4965e1180b2ff1189a3d7bfee",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=utf-8",
        "Content-Transfer-Encoding": "quoted-printable",
        "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>",
        "Errors-To": "libcamera-devel-bounces@lists.libcamera.org",
        "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"
    },
    "content": "Store the `LogCategory` objects in an `std::list`. This eliminates\nthe need for manually deleting them in the destructor while guaranteeing\naddress stability.\n\nSigned-off-by: Barnabás Pőcze <pobrn@protonmail.com>\n---\n src/libcamera/base/log.cpp | 23 ++++++++++-------------\n 1 file changed, 10 insertions(+), 13 deletions(-)",
    "diff": "diff --git a/src/libcamera/base/log.cpp b/src/libcamera/base/log.cpp\nindex 69aa16c4c..003e2cf3a 100644\n--- a/src/libcamera/base/log.cpp\n+++ b/src/libcamera/base/log.cpp\n@@ -407,7 +407,7 @@ private:\n \tstatic bool destroyed_;\n \n \tMutex mutex_;\n-\tstd::vector<LogCategory *> categories_;\n+\tstd::list<LogCategory> categories_;\n \tstd::list<std::pair<std::string, LogSeverity>> levels_;\n \n \tstd::shared_ptr<LogOutput> output_;\n@@ -524,9 +524,6 @@ void logSetLevel(const char *category, const char *level)\n Logger::~Logger()\n {\n \tdestroyed_ = true;\n-\n-\tfor (LogCategory *category : categories_)\n-\t\tdelete category;\n }\n \n /**\n@@ -659,9 +656,9 @@ void Logger::logSetLevel(const char *category, const char *level)\n \n \tMutexLocker locker(mutex_);\n \n-\tfor (LogCategory *c : categories_) {\n-\t\tif (c->name() == category) {\n-\t\t\tc->setSeverity(severity);\n+\tfor (LogCategory &c : categories_) {\n+\t\tif (c.name() == category) {\n+\t\t\tc.setSeverity(severity);\n \t\t\tbreak;\n \t\t}\n \t}\n@@ -717,12 +714,12 @@ LogCategory *Logger::findOrCreateCategory(std::string_view name)\n {\n \tMutexLocker locker(mutex_);\n \n-\tfor (LogCategory *category : categories_) {\n-\t\tif (category->name() == name)\n-\t\t\treturn category;\n+\tfor (LogCategory &category : categories_) {\n+\t\tif (category.name() == name)\n+\t\t\treturn &category;\n \t}\n \n-\tLogCategory *category = categories_.emplace_back(new LogCategory(name));\n+\tLogCategory &category = categories_.emplace_back(name);\n \n \tfor (const std::pair<std::string, LogSeverity> &level : levels_) {\n \t\tbool match = true;\n@@ -739,12 +736,12 @@ LogCategory *Logger::findOrCreateCategory(std::string_view name)\n \t\t}\n \n \t\tif (match) {\n-\t\t\tcategory->setSeverity(level.second);\n+\t\t\tcategory.setSeverity(level.second);\n \t\t\tbreak;\n \t\t}\n \t}\n \n-\treturn category;\n+\treturn &category;\n }\n \n /**\n",
    "prefixes": [
        "RFC",
        "v2",
        "9/9"
    ]
}