Files
qemu/net
Philippe Mathieu-Daudé 11a64a4b7c io: use g_clear_handle_id() for GSource cleanup
Use g_clear_handle_id() instead of g_source_remove() with
manual ID checking and zeroing.

This simplifies the code and ensures consistent handling of
GSource IDs, since g_clear_handle_id() checks for a non-zero
ID before calling the cleanup function and zeros it afterwards.

No functional change intended.

Mechanical change using the following Coccinelle spatch script:

  @@
  expression TAG;
  @@
  -    if (TAG > 0) {
  +    if (TAG) {
           g_source_remove(TAG);
           <... when != TAG
           TAG = 0;
           ...>
       }

  @@
  expression TAG;
  @@
  -    g_source_remove(TAG);
  -    TAG = 0;
  +    g_clear_handle_id(&TAG, g_source_remove);

  @@
  expression TAG;
  @@
  -    if (TAG) {
           g_clear_handle_id(&TAG, g_source_remove);
  -    }

Inspired-by: Matthew Penney <matt@matthewpenney.net>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Matthew Penney <matt@matthewpenney.net>
Message-Id: <20260408100605.66795-3-philmd@linaro.org>
2026-05-06 16:10:46 +02:00
..
2026-01-23 14:41:26 +08:00
2026-01-23 14:41:26 +08:00
2026-01-23 14:41:26 +08:00
2025-10-04 10:51:02 -04:00
2026-01-23 14:41:26 +08:00
2026-01-23 14:41:26 +08:00
2026-01-23 14:41:26 +08:00