When building GCC reports that it'll never inline this method, so don't
mark it status+inline as that will cause multiple instances of it to be
defined in each source file that includes util.h
In file included from manager.c:4:0:
manager.c: In function ‘virtDBusManagerEnumarateDomains’:
util.h:62:1: error: inlining failed in call to ‘virtDBusUtilVirDomainListFreep.isra.0’:
call is unlikely and code size would grow [-Werror=inline]
virtDBusUtilVirDomainListFreep(virDomainPtr **domainsp)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
manager.c:17:61: note: called from here
_cleanup_(virtDBusUtilVirDomainListFreep) virDomainPtr *domains = NULL;
^~~~~~~
Signed-off-by: Daniel P. Berrange <berrange(a)redhat.com>
---
src/util.c | 14 ++++++++++++++
src/util.h | 15 ++-------------
2 files changed, 16 insertions(+), 13 deletions(-)
diff --git a/src/util.c b/src/util.c
index 8f0796a..2445ce0 100644
--- a/src/util.c
+++ b/src/util.c
@@ -94,3 +94,17 @@ virtDBusUtilVirDomainFromBusPath(virConnectPtr connection,
return virDomainLookupByUUIDString(connection, name);
}
+
+void
+virtDBusUtilVirDomainListFreep(virDomainPtr **domainsp)
+{
+ virDomainPtr *domains = *domainsp;
+
+ if (!domains)
+ return;
+
+ for (int i = 0; domains[i] != NULL; i += 1)
+ virDomainFree(domains[i]);
+
+ free(domains);
+}
diff --git a/src/util.h b/src/util.h
index 782c588..3c80fef 100644
--- a/src/util.h
+++ b/src/util.h
@@ -56,16 +56,5 @@ virtDBusUtilVirDomainFreep(virDomainPtr *domainp)
virDomainFree(*domainp);
}
-static inline void
-virtDBusUtilVirDomainListFreep(virDomainPtr **domainsp)
-{
- virDomainPtr *domains = *domainsp;
-
- if (!domains)
- return;
-
- for (int i = 0; domains[i] != NULL; i += 1)
- virDomainFree(domains[i]);
-
- free(domains);
-}
+void
+virtDBusUtilVirDomainListFreep(virDomainPtr **domainsp);
--
2.13.6