diff options
| author | Michael Biebl <biebl@debian.org> | 2018-06-04 00:08:31 +0200 |
|---|---|---|
| committer | Michael Biebl <biebl@debian.org> | 2018-06-04 00:08:31 +0200 |
| commit | 0dd9df69fdbd475c48a0c8d5b0a1882550fe7321 (patch) | |
| tree | 249cf25643b1fe408e10679bb61613bc6540e894 /shared/nm-test-libnm-utils.h | |
| parent | 2e94a3b93171ab3fb95bf689aab1664d23988809 (diff) | |
| parent | 04bc9e1cd3544445d883ad29ea108c1645c8e7b7 (diff) | |
Update upstream source from tag 'upstream/1.11.4'
Update to upstream version '1.11.4' with Debian dir d0638aa2e32d5bae4e8daa021b9a66b7c4d6647e
Diffstat (limited to 'shared/nm-test-libnm-utils.h')
| -rw-r--r-- | shared/nm-test-libnm-utils.h | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/shared/nm-test-libnm-utils.h b/shared/nm-test-libnm-utils.h index c4731a52..20a15e5f 100644 --- a/shared/nm-test-libnm-utils.h +++ b/shared/nm-test-libnm-utils.h @@ -42,18 +42,22 @@ typedef struct { NMTstcServiceInfo *nmtstc_service_init (void); void nmtstc_service_cleanup (NMTstcServiceInfo *info); +NMTstcServiceInfo *nmtstc_service_available (NMTstcServiceInfo *info); static inline void _nmtstc_auto_service_cleanup (NMTstcServiceInfo **info) { - if (info && *info) { - nmtstc_service_cleanup (*info); - *info = NULL; - } + nmtstc_service_cleanup (g_steal_pointer (info)); } - #define NMTSTC_SERVICE_INFO_SETUP(sinfo) \ NM_PRAGMA_WARNING_DISABLE ("-Wunused-variable") \ - __attribute__ ((cleanup(_nmtstc_auto_service_cleanup))) NMTstcServiceInfo *sinfo = nmtstc_service_init (); \ + __attribute__ ((cleanup(_nmtstc_auto_service_cleanup))) NMTstcServiceInfo *sinfo = ({ \ + NMTstcServiceInfo *_sinfo; \ + \ + _sinfo = nmtstc_service_init (); \ + if (!nmtstc_service_available (_sinfo)) \ + return; \ + _sinfo; \ + }); \ NM_PRAGMA_WARNING_REENABLE /*****************************************************************************/ |