mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-04-17 20:50:40 +02:00
libnm/tests: add NMTSTC_SERVICE_INFO_SETUP() macro
This commit is contained in:
parent
f354d5f0fc
commit
bdfcf02da3
1 changed files with 17 additions and 0 deletions
|
|
@ -22,6 +22,8 @@
|
|||
|
||||
#include "nm-test-utils.h"
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
typedef struct {
|
||||
GDBusConnection *bus;
|
||||
GDBusProxy *proxy;
|
||||
|
|
@ -32,6 +34,21 @@ typedef struct {
|
|||
NMTstcServiceInfo *nmtstc_service_init (void);
|
||||
void nmtstc_service_cleanup (NMTstcServiceInfo *info);
|
||||
|
||||
static inline void _nmtstc_auto_service_cleanup (NMTstcServiceInfo **info)
|
||||
{
|
||||
if (info && *info) {
|
||||
nmtstc_service_cleanup (*info);
|
||||
*info = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
#define NMTSTC_SERVICE_INFO_SETUP(sinfo) \
|
||||
NM_PRAGMA_WARNING_DISABLE ("-Wunused-variable") \
|
||||
__attribute__ ((cleanup(_nmtstc_auto_service_cleanup))) NMTstcServiceInfo *sinfo = nmtstc_service_init (); \
|
||||
NM_PRAGMA_WARNING_REENABLE
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
#if ((NETWORKMANAGER_COMPILATION) == NM_NETWORKMANAGER_COMPILATION_LIB)
|
||||
|
||||
NMDevice *nmtstc_service_add_device (NMTstcServiceInfo *info,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue