Signed-off-by: Pavel Hrdina <phrdina@xxxxxxxxxx> --- src/util.c | 34 ++++++++++++++++++++++++++++++++++ src/util.h | 38 ++++++++------------------------------ 2 files changed, 42 insertions(+), 30 deletions(-) diff --git a/src/util.c b/src/util.c index d0649fa..962eaab 100644 --- a/src/util.c +++ b/src/util.c @@ -104,6 +104,40 @@ virtDBusUtilVirDomainFromBusPath(virConnectPtr connection, return virDomainLookupByUUIDString(connection, name); } +void +virtDBusUtilFreep(void *p) +{ + free(*(void **)p); +} + +void +virtDBusUtilClosep(int *fdp) +{ + if (*fdp >= 0) + close(*fdp); +} + +void +virtDBusUtilStrvFreep(void *p) +{ + char **strv = *(char ***)p; + + if (strv == NULL) + return; + + for (unsigned i = 0; strv[i] != NULL; i++) + free(strv[i]); + + free(strv); +} + +void +virtDBusUtilVirDomainFreep(virDomainPtr *domainp) +{ + if (*domainp) + virDomainFree(*domainp); +} + void virtDBusUtilVirDomainListFreep(virDomainPtr **domainsp) { diff --git a/src/util.h b/src/util.h index 9779d29..a772ffe 100644 --- a/src/util.h +++ b/src/util.h @@ -33,39 +33,17 @@ virtDBusUtilVirDomainFromBusPath(virConnectPtr connection, const char *path, const char *domainPath); -static inline void -virtDBusUtilFreep(void *p) -{ - free(*(void **)p); -} - -static inline void -virtDBusUtilClosep(int *fdp) -{ - if (*fdp >= 0) - close(*fdp); -} - -static inline void -virtDBusUtilStrvFreep(void *p) -{ - char **strv = *(char ***)p; - - if (strv == NULL) - return; +void +virtDBusUtilFreep(void *p); - for (unsigned i = 0; strv[i] != NULL; i += 1) - free(strv[i]); +void +virtDBusUtilClosep(int *fdp); - free(strv); -} +void +virtDBusUtilStrvFreep(void *p); -static inline void -virtDBusUtilVirDomainFreep(virDomainPtr *domainp) -{ - if (*domainp) - virDomainFree(*domainp); -} +void +virtDBusUtilVirDomainFreep(virDomainPtr *domainp); void virtDBusUtilVirDomainListFreep(virDomainPtr **domainsp); -- 2.14.3 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list