From 16b3522d51b2d097bc9413551fb007ecf8d91c95 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Mon, 7 Feb 2022 19:16:31 +0100 Subject: [PATCH] platform: return self from nmp_route_manager_ref() It's just more convenient. (cherry picked from commit 81f6ba83776a89036983ec226932f5730fa52032) --- src/libnm-platform/nmp-route-manager.c | 5 +++-- src/libnm-platform/nmp-route-manager.h | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/libnm-platform/nmp-route-manager.c b/src/libnm-platform/nmp-route-manager.c index a4cbf2e8bb..6828bb57f9 100644 --- a/src/libnm-platform/nmp-route-manager.c +++ b/src/libnm-platform/nmp-route-manager.c @@ -788,12 +788,13 @@ nmp_route_manager_new(NMPlatform *platform) return self; } -void +NMPRouteManager * nmp_route_manager_ref(NMPRouteManager *self) { - g_return_if_fail(NMP_IS_ROUTE_MANAGER(self)); + g_return_val_if_fail(NMP_IS_ROUTE_MANAGER(self), NULL); self->ref_count++; + return self; } void diff --git a/src/libnm-platform/nmp-route-manager.h b/src/libnm-platform/nmp-route-manager.h index 17af8ee0c5..23e4c2d341 100644 --- a/src/libnm-platform/nmp-route-manager.h +++ b/src/libnm-platform/nmp-route-manager.h @@ -13,8 +13,8 @@ typedef struct _NMPRouteManager NMPRouteManager; NMPRouteManager *nmp_route_manager_new(NMPlatform *platform); -void nmp_route_manager_ref(NMPRouteManager *self); -void nmp_route_manager_unref(NMPRouteManager *self); +NMPRouteManager *nmp_route_manager_ref(NMPRouteManager *self); +void nmp_route_manager_unref(NMPRouteManager *self); #define nm_auto_unref_route_manager nm_auto(_nmp_route_manager_unref) NM_AUTO_DEFINE_FCN0(NMPRouteManager *, _nmp_route_manager_unref, nmp_route_manager_unref);