get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 2221041,
    "url": "http://patchwork.ozlabs.org/api/1.1/patches/2221041/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20260408010026.4611-5-matt@matthewpenney.net/",
    "project": {
        "id": 14,
        "url": "http://patchwork.ozlabs.org/api/1.1/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": ""
    },
    "msgid": "<20260408010026.4611-5-matt@matthewpenney.net>",
    "date": "2026-04-08T01:02:28",
    "name": "[4/8] net: use g_clear_handle_id() for GSource cleanup",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "dca7270fb70dbfed3da0c0cf2a88420747989022",
    "submitter": {
        "id": 92789,
        "url": "http://patchwork.ozlabs.org/api/1.1/people/92789/?format=api",
        "name": "Matthew Penney",
        "email": "matt@matthewpenney.net"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20260408010026.4611-5-matt@matthewpenney.net/mbox/",
    "series": [
        {
            "id": 499175,
            "url": "http://patchwork.ozlabs.org/api/1.1/series/499175/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/list/?series=499175",
            "date": "2026-04-08T01:02:28",
            "name": "[1/8] hw/char: use g_clear_handle_id() for GSource cleanup",
            "version": 1,
            "mbox": "http://patchwork.ozlabs.org/series/499175/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/2221041/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/2221041/checks/",
    "tags": {},
    "headers": {
        "Return-Path": "<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>",
        "X-Original-To": "incoming@patchwork.ozlabs.org",
        "Delivered-To": "patchwork-incoming@legolas.ozlabs.org",
        "Authentication-Results": [
            "legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=matthewpenney.net header.i=@matthewpenney.net\n header.a=rsa-sha256 header.s=protonmail header.b=SD35viJH;\n\tdkim-atps=neutral",
            "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org\n (client-ip=209.51.188.17; helo=lists.gnu.org;\n envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n receiver=patchwork.ozlabs.org)"
        ],
        "Received": [
            "from lists.gnu.org (unknown [209.51.188.17])\n\t(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4frWnw1PV1z1xv0\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 09 Apr 2026 04:30:10 +1000 (AEST)",
            "from localhost ([::1] helo=lists1p.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.90_1)\n\t(envelope-from <qemu-devel-bounces@nongnu.org>)\n\tid 1wAXeX-00051l-Of; Wed, 08 Apr 2026 14:29:25 -0400",
            "from eggs.gnu.org ([2001:470:142:3::10])\n by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <matt@matthewpenney.net>)\n id 1wAXeM-00051J-Ql\n for qemu-devel@nongnu.org; Wed, 08 Apr 2026 14:29:16 -0400",
            "from mail-0701.mail-europe.com ([51.83.17.38]\n helo=mail-07.mail-europe.com)\n by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <matt@matthewpenney.net>)\n id 1wAHJT-0001Ms-5r\n for qemu-devel@nongnu.org; Tue, 07 Apr 2026 21:02:36 -0400"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=matthewpenney.net;\n s=protonmail; t=1775610151; x=1775869351;\n bh=9F4Xx4c3jF43Xnw6KAruoShQx+2+40qZvkXLmvmeME0=;\n h=Date:To:From:Cc:Subject:Message-ID:Feedback-ID:From:To:Cc:Date:\n Subject:Reply-To:Feedback-ID:Message-ID:BIMI-Selector;\n b=SD35viJHgfZohqTk1zpN4hHHqA0ZRIFRRzHioXDAPxT5IFe3muPzgDR11PK4OxgDR\n hXiWkXGfP/1EF50GhyGh20P4HlvqHeiNlkyQQsixnDjaeivjrFg1y3Gm8xhEAeSE8j\n 69ZQJqoFe04JXFmR2HI0kEhz1gz1NmAV0EfM18iRf0Xm2h04L/3RkctQxCje+bNf44\n BkN3ippjiPM4IQPhDVRwBoPLR8wWh9QoHaaMmV11p9LqB3mTMh7TWhkRtmwALh2I60\n JWpaEIjvtBkbgG9OZrztsxJg2pnXVzQ7sZxWYyph4tmBkIgfQH9QGUxl3lwtEX/270\n yFQ7pHv6H/bBA==",
        "Date": "Wed, 08 Apr 2026 01:02:28 +0000",
        "To": "qemu-devel@nongnu.org",
        "From": "Matthew Penney <matt@matthewpenney.net>",
        "Cc": "Matthew Penney <matt@matthewpenney.net>, jasowang@redhat.com,\n \"Michael S. Tsirkin\" <mst@redhat.com>, sgarzare@redhat.com",
        "Subject": "[PATCH 4/8] net: use g_clear_handle_id() for GSource cleanup",
        "Message-ID": "<20260408010026.4611-5-matt@matthewpenney.net>",
        "Feedback-ID": "185185778:user:proton",
        "X-Pm-Message-ID": "071cba2470b64e0fd5634307ed693e55c0147b63",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=utf-8",
        "Content-Transfer-Encoding": "quoted-printable",
        "Received-SPF": "softfail client-ip=51.83.17.38;\n envelope-from=matt@matthewpenney.net; helo=mail-07.mail-europe.com",
        "X-Spam_score_int": "-13",
        "X-Spam_score": "-1.4",
        "X-Spam_bar": "-",
        "X-Spam_report": "(-1.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,\n DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,\n RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001,\n SPF_HELO_NONE=0.001, SPF_SOFTFAIL=0.665 autolearn=no autolearn_force=no",
        "X-Spam_action": "no action",
        "X-BeenThere": "qemu-devel@nongnu.org",
        "X-Mailman-Version": "2.1.29",
        "Precedence": "list",
        "List-Id": "qemu development <qemu-devel.nongnu.org>",
        "List-Unsubscribe": "<https://lists.nongnu.org/mailman/options/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>",
        "List-Archive": "<https://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 <mailto:qemu-devel-request@nongnu.org?subject=subscribe>",
        "Errors-To": "qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org",
        "Sender": "qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org"
    },
    "content": "Use g_clear_handle_id() instead of g_source_remove() with manual ID\nchecking and zeroing.\n\nThis simplifies the code and ensures consistent handling of GSource IDs,\nsince g_clear_handle_id() checks for a non-zero ID before calling the\ncleanup function and zeros it afterwards.\n\nNo functional change intended.\n\nSigned-off-by: Matthew Penney <matt@matthewpenney.net>\n---\n net/passt.c       |  8 ++------\n net/stream.c      | 15 +++------------\n net/stream_data.c | 10 ++--------\n net/vhost-user.c  |  8 ++------\n 4 files changed, 9 insertions(+), 32 deletions(-)",
    "diff": "diff --git a/net/passt.c b/net/passt.c\nindex 4ff94ee509..d3b5ab426c 100644\n--- a/net/passt.c\n+++ b/net/passt.c\n@@ -90,10 +90,7 @@ static void net_passt_cleanup(NetClientState *nc)\n         g_free(s->vhost_net);\n         s->vhost_net = NULL;\n     }\n-    if (s->vhost_watch) {\n-        g_source_remove(s->vhost_watch);\n-        s->vhost_watch = 0;\n-    }\n+    g_clear_handle_id(&s->vhost_watch, g_source_remove);\n     qemu_chr_fe_deinit(&s->vhost_chr, true);\n     if (s->vhost_user) {\n         vhost_user_cleanup(s->vhost_user);\n@@ -421,8 +418,7 @@ static void passt_vhost_user_event(void *opaque, QEMUChrEvent event)\n         if (s->vhost_watch) {\n             AioContext *ctx = qemu_get_current_aio_context();\n \n-            g_source_remove(s->vhost_watch);\n-            s->vhost_watch = 0;\n+            g_clear_handle_id(&s->vhost_watch, g_source_remove);\n             qemu_chr_fe_set_handlers(&s->vhost_chr, NULL, NULL,  NULL, NULL,\n                                      NULL, NULL, false);\n \ndiff --git a/net/stream.c b/net/stream.c\nindex ea83f4a763..6df4e251fe 100644\n--- a/net/stream.c\n+++ b/net/stream.c\n@@ -71,24 +71,15 @@ static gboolean net_stream_send(QIOChannel *ioc,\n static void net_stream_cleanup(NetClientState *nc)\n {\n     NetStreamState *s = DO_UPCAST(NetStreamState, data.nc, nc);\n-    if (s->timer_tag) {\n-        g_source_remove(s->timer_tag);\n-        s->timer_tag = 0;\n-    }\n+    g_clear_handle_id(&s->timer_tag, g_source_remove);\n     if (s->addr) {\n         qapi_free_SocketAddress(s->addr);\n         s->addr = NULL;\n     }\n     if (s->data.ioc) {\n         if (QIO_CHANNEL_SOCKET(s->data.ioc)->fd != -1) {\n-            if (s->data.ioc_read_tag) {\n-                g_source_remove(s->data.ioc_read_tag);\n-                s->data.ioc_read_tag = 0;\n-            }\n-            if (s->data.ioc_write_tag) {\n-                g_source_remove(s->data.ioc_write_tag);\n-                s->data.ioc_write_tag = 0;\n-            }\n+            g_clear_handle_id(&s->data.ioc_read_tag, g_source_remove);\n+            g_clear_handle_id(&s->data.ioc_write_tag, g_source_remove);\n         }\n         object_unref(OBJECT(s->data.ioc));\n         s->data.ioc = NULL;\ndiff --git a/net/stream_data.c b/net/stream_data.c\nindex 03740e9f73..eafc11041b 100644\n--- a/net/stream_data.c\n+++ b/net/stream_data.c\n@@ -84,10 +84,7 @@ void net_stream_data_rs_finalize(SocketReadState *rs)\n     if (qemu_send_packet_async(&d->nc, rs->buf,\n                                rs->packet_len,\n                                net_stream_data_send_completed) == 0) {\n-        if (d->ioc_read_tag) {\n-            g_source_remove(d->ioc_read_tag);\n-            d->ioc_read_tag = 0;\n-        }\n+        g_clear_handle_id(&d->ioc_read_tag, g_source_remove);\n     }\n }\n \n@@ -108,10 +105,7 @@ gboolean net_stream_data_send(QIOChannel *ioc, GIOCondition condition,\n         /* end of connection */\n     eoc:\n         d->ioc_read_tag = 0;\n-        if (d->ioc_write_tag) {\n-            g_source_remove(d->ioc_write_tag);\n-            d->ioc_write_tag = 0;\n-        }\n+        g_clear_handle_id(&d->ioc_write_tag, g_source_remove);\n         if (d->listener) {\n             qemu_set_info_str(&d->nc, \"listening\");\n             qio_net_listener_set_client_func(d->listener,\ndiff --git a/net/vhost-user.c b/net/vhost-user.c\nindex a4bb49bbcf..2d0fc49b4d 100644\n--- a/net/vhost-user.c\n+++ b/net/vhost-user.c\n@@ -215,10 +215,7 @@ static void net_vhost_user_cleanup(NetClientState *nc)\n         s->vhost_net = NULL;\n     }\n     if (nc->queue_index == 0) {\n-        if (s->watch) {\n-            g_source_remove(s->watch);\n-            s->watch = 0;\n-        }\n+        g_clear_handle_id(&s->watch, g_source_remove);\n         qemu_chr_fe_deinit(&s->chr, true);\n         if (s->vhost_user) {\n             vhost_user_cleanup(s->vhost_user);\n@@ -356,8 +353,7 @@ static void net_vhost_user_event(void *opaque, QEMUChrEvent event)\n         if (s->watch) {\n             AioContext *ctx = qemu_get_current_aio_context();\n \n-            g_source_remove(s->watch);\n-            s->watch = 0;\n+            g_clear_handle_id(&s->watch, g_source_remove);\n             qemu_chr_fe_set_handlers(&s->chr, NULL, NULL, NULL, NULL,\n                                      NULL, NULL, false);\n \n",
    "prefixes": [
        "4/8"
    ]
}