[PATCH] device_conf: Let compiler decide on inlining functions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



There's no point in forcing some functions to be both 'static'
and 'inline' at the same time at the header file level. This
leads to a situation where just linking the file defines those
function (potentially needlessly). Instead, we should let the
compiler (linker) decide whether the function are small enough to
be inlined or not.

Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
---
 src/conf/device_conf.c   | 24 ++++++++++++++++++++++++
 src/conf/device_conf.h   | 21 +++------------------
 src/libvirt_private.syms |  3 +++
 3 files changed, 30 insertions(+), 18 deletions(-)

diff --git a/src/conf/device_conf.c b/src/conf/device_conf.c
index f58b9d0..f34b6c6 100644
--- a/src/conf/device_conf.c
+++ b/src/conf/device_conf.c
@@ -78,6 +78,30 @@ int virPCIDeviceAddressIsValid(virPCIDeviceAddressPtr addr,
 }
 
 
+bool
+virPCIDeviceAddressIsEmpty(const virPCIDeviceAddress *addr)
+{
+    return !(addr->domain || addr->bus || addr->slot);
+}
+
+
+bool
+virDeviceInfoPCIAddressWanted(const virDomainDeviceInfo *info)
+{
+    return info->type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE ||
+        (info->type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI &&
+         virPCIDeviceAddressIsEmpty(&info->addr.pci));
+}
+
+
+bool
+virDeviceInfoPCIAddressPresent(const virDomainDeviceInfo *info)
+{
+    return info->type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI &&
+       !virPCIDeviceAddressIsEmpty(&info->addr.pci);
+}
+
+
 int
 virPCIDeviceAddressParseXML(xmlNodePtr node,
                             virPCIDeviceAddressPtr addr)
diff --git a/src/conf/device_conf.h b/src/conf/device_conf.h
index 8443de6..98eaf3f 100644
--- a/src/conf/device_conf.h
+++ b/src/conf/device_conf.h
@@ -148,26 +148,11 @@ typedef struct _virDomainDeviceInfo {
 int virPCIDeviceAddressIsValid(virPCIDeviceAddressPtr addr,
                                bool report);
 
-static inline bool
-virPCIDeviceAddressIsEmpty(const virPCIDeviceAddress *addr)
-{
-    return !(addr->domain || addr->bus || addr->slot);
-}
+bool virPCIDeviceAddressIsEmpty(const virPCIDeviceAddress *addr);
 
-static inline bool
-virDeviceInfoPCIAddressWanted(const virDomainDeviceInfo *info)
-{
-    return info->type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE ||
-        (info->type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI &&
-         virPCIDeviceAddressIsEmpty(&info->addr.pci));
-}
+bool virDeviceInfoPCIAddressWanted(const virDomainDeviceInfo *info);
 
-static inline bool
-virDeviceInfoPCIAddressPresent(const virDomainDeviceInfo *info)
-{
-    return info->type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI &&
-       !virPCIDeviceAddressIsEmpty(&info->addr.pci);
-}
+bool virDeviceInfoPCIAddressPresent(const virDomainDeviceInfo *info);
 
 int virPCIDeviceAddressParseXML(xmlNodePtr node,
                                 virPCIDeviceAddressPtr addr);
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 89c4511..8c7aef0 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -76,10 +76,13 @@ virCPUModeTypeToString;
 
 
 # conf/device_conf.h
+virDeviceInfoPCIAddressPresent;
+virDeviceInfoPCIAddressWanted;
 virInterfaceLinkFormat;
 virInterfaceLinkParseXML;
 virPCIDeviceAddressEqual;
 virPCIDeviceAddressFormat;
+virPCIDeviceAddressIsEmpty;
 virPCIDeviceAddressIsValid;
 virPCIDeviceAddressParseXML;
 
-- 
2.8.4

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]