sdbus++: interface: move basic constructor inline
This saves 100k out of the libphosphor_dbus.so on x86.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: Iadd57bdb6517ac3dcb92c2165d9913f622511c6e
diff --git a/tools/sdbusplus/templates/interface.server.cpp.mako b/tools/sdbusplus/templates/interface.server.cpp.mako
index fe91780..6edc845 100644
--- a/tools/sdbusplus/templates/interface.server.cpp.mako
+++ b/tools/sdbusplus/templates/interface.server.cpp.mako
@@ -14,19 +14,10 @@
<%
namespaces = interface.name.split('.')
classname = namespaces.pop()
-
- def interface_instance():
- return "_".join(interface.name.split('.') + ['interface'])
%>
namespace sdbusplus::${interface.cppNamespace()}
{
-${classname}::${classname}(bus_t& bus, const char* path)
- : _${interface_instance()}(
- bus, path, interface, _vtable, this), _intf(bus.getInterface())
-{
-}
-
% if interface.properties:
${classname}::${classname}(bus_t& bus, const char* path,
const std::map<std::string, PropertiesVariant>& vals,
diff --git a/tools/sdbusplus/templates/interface.server.hpp.mako b/tools/sdbusplus/templates/interface.server.hpp.mako
index 771c6ac..a98a3c4 100644
--- a/tools/sdbusplus/templates/interface.server.hpp.mako
+++ b/tools/sdbusplus/templates/interface.server.hpp.mako
@@ -18,6 +18,9 @@
def setOfPropertyTypes():
return set(p.cppTypeParam(interface.name) for p in
interface.properties);
+
+ def interface_instance():
+ return "_".join(interface.name.split('.') + ['interface'])
%>
namespace sdbusplus::${interface.cppNamespace()}
@@ -46,7 +49,11 @@
* @param[in] bus - Bus to attach to.
* @param[in] path - Path to attach at.
*/
- ${classname}(bus_t& bus, const char* path);
+ ${classname}(bus_t& bus, const char* path) :
+ _${interface_instance()}(
+ bus, path, interface, _vtable, this),
+ _intf(bus.getInterface()) {}
+
% for e in interface.enums:
enum class ${e.name}