summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2009-08-07 18:38:44 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2009-08-07 18:38:44 +0200
commitc210f6793f3f1d62ff241bb31c42938e05e9a783 (patch)
treea4330b922ee1ef549ff60070c34e13ecc9971926
parentc64f91baf599133f88658e7a45a4d7e4a6c43d2b (diff)
downloadabrt-c210f6793f3f1d62ff241bb31c42938e05e9a783.tar.gz
abrt-c210f6793f3f1d62ff241bb31c42938e05e9a783.tar.xz
abrt-c210f6793f3f1d62ff241bb31c42938e05e9a783.zip
replace string memebers of plugin_info_t with const char*
Since they are constant, and we never ever want to change them, there is no benefit in having them as strings. This change removes one global data object's constructor and destructor from every applet .so module. 6k less code. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--lib/MiddleWare/Plugin.h12
-rw-r--r--src/Daemon/ABRTPlugin.cpp50
-rw-r--r--src/Daemon/ABRTPlugin.h78
3 files changed, 72 insertions, 68 deletions
diff --git a/lib/MiddleWare/Plugin.h b/lib/MiddleWare/Plugin.h
index 60ebc595..d615fc8d 100644
--- a/lib/MiddleWare/Plugin.h
+++ b/lib/MiddleWare/Plugin.h
@@ -86,12 +86,12 @@ typedef enum {
typedef struct SPluginInfo
{
const plugin_type_t m_Type; /**< Plugin type.*/
- const std::string m_sName; /**< Plugin name.*/
- const std::string m_sVersion; /**< Plugin version.*/
- const std::string m_sDescription; /**< Plugin description.*/
- const std::string m_sEmail; /**< Plugin author's email.*/
- const std::string m_sWWW; /**< Plugin's home page.*/
- const std::string m_sGTKBuilder; /**< Plugin's gui description.*/
+ const char *const m_sName; /**< Plugin name.*/
+ const char *const m_sVersion; /**< Plugin version.*/
+ const char *const m_sDescription; /**< Plugin description.*/
+ const char *const m_sEmail; /**< Plugin author's email.*/
+ const char *const m_sWWW; /**< Plugin's home page.*/
+ const char *const m_sGTKBuilder; /**< Plugin's gui description.*/
const int m_nMagicNumber; /**< Plugin magical number.*/
} plugin_info_t;
diff --git a/src/Daemon/ABRTPlugin.cpp b/src/Daemon/ABRTPlugin.cpp
index f2afa416..20486a2d 100644
--- a/src/Daemon/ABRTPlugin.cpp
+++ b/src/Daemon/ABRTPlugin.cpp
@@ -27,8 +27,8 @@ CABRTPlugin::CABRTPlugin(const std::string& pLibPath) :
m_pFnPluginNew(NULL)
{
m_pDynamicLibrary = new CDynamicLibrary(pLibPath);
- m_pPluginInfo = reinterpret_cast<p_plugin_info_t>(m_pDynamicLibrary->FindSymbol("plugin_info"));
- m_pFnPluginNew = reinterpret_cast<p_fn_plugin_new_t>(m_pDynamicLibrary->FindSymbol("plugin_new"));
+ m_pPluginInfo = reinterpret_cast<typeof(m_pPluginInfo)>(m_pDynamicLibrary->FindSymbol("plugin_info"));
+ m_pFnPluginNew = reinterpret_cast<typeof(m_pFnPluginNew)>(m_pDynamicLibrary->FindSymbol("plugin_new"));
}
CABRTPlugin::~CABRTPlugin()
@@ -38,49 +38,3 @@ CABRTPlugin::~CABRTPlugin()
delete m_pDynamicLibrary;
}
}
-
-const std::string& CABRTPlugin::GetVersion()
-{
- return m_pPluginInfo->m_sVersion;
-}
-
-const int CABRTPlugin::GetMagicNumber()
-{
- return m_pPluginInfo->m_nMagicNumber;
-}
-
-const std::string& CABRTPlugin::GetName()
-{
- return m_pPluginInfo->m_sName;
-}
-
-const std::string& CABRTPlugin::GetDescription()
-{
- return m_pPluginInfo->m_sDescription;
-}
-
-const std::string& CABRTPlugin::GetEmail()
-{
- return m_pPluginInfo->m_sEmail;
-}
-
-const std::string& CABRTPlugin::GetWWW()
-{
- return m_pPluginInfo->m_sWWW;
-}
-
-const std::string& CABRTPlugin::GetGTKBuilder()
-{
- return m_pPluginInfo->m_sGTKBuilder;
-}
-
-
-const plugin_type_t CABRTPlugin::GetType()
-{
- return m_pPluginInfo->m_Type;
-}
-
-CPlugin* CABRTPlugin::PluginNew()
-{
- return m_pFnPluginNew();
-}
diff --git a/src/Daemon/ABRTPlugin.h b/src/Daemon/ABRTPlugin.h
index cdf72bb3..2f3e83d1 100644
--- a/src/Daemon/ABRTPlugin.h
+++ b/src/Daemon/ABRTPlugin.h
@@ -33,10 +33,6 @@
class CABRTPlugin
{
private:
-
- typedef const plugin_info_t* p_plugin_info_t;
- typedef CPlugin* (*p_fn_plugin_new_t)();
-
/**
* A class containing library which contains plugin functionality.
* @see DynamicLibrary.h
@@ -45,11 +41,11 @@ class CABRTPlugin
/**
* A pointer to struc containing information about plugin.
*/
- p_plugin_info_t m_pPluginInfo;
+ const plugin_info_t* m_pPluginInfo;
/**
* A pointer to function, which creates new instances of plugin.
*/
- p_fn_plugin_new_t m_pFnPluginNew;
+ CPlugin* (*m_pFnPluginNew)();
public:
/**
@@ -66,42 +62,42 @@ class CABRTPlugin
* It is used for getting loaded plugin's version.
* @return plugin version
*/
- const std::string& GetVersion();
+ const char* GetVersion();
/**
* It is used for getting loaded plugin's magic number.
* @return magic number
*/
- const int GetMagicNumber();
+ int GetMagicNumber();
/**
* It is used for getting loaded plugin's name.
* @return magic number
*/
- const std::string& GetName();
+ const char* GetName();
/**
* It is used for getting loaded plugin's description.
* @return magic number
*/
- const std::string& GetDescription();
+ const char* GetDescription();
/**
* It is used for getting an author email of loaded plugin.
* @return description
*/
- const std::string& GetEmail();
+ const char* GetEmail();
/**
* It is used for getting a home page of loaded plugin.
* @return home page
*/
- const std::string& GetWWW();
+ const char* GetWWW();
/**
* It is used for getting a path to gui description.
* @return home page
*/
- const std::string& GetGTKBuilder();
+ const char* GetGTKBuilder();
/**
* It is used for getting loaded plugin's type.
* @return type
*/
- const plugin_type_t GetType();
+ plugin_type_t GetType();
/**
* It is used fot getting of a new instance of loaded plugin
* @return pointer to new allocated instance of plugin. A caller
@@ -110,4 +106,58 @@ class CABRTPlugin
CPlugin* PluginNew();
};
+inline
+const char* CABRTPlugin::GetVersion()
+{
+ return m_pPluginInfo->m_sVersion;
+}
+
+inline
+int CABRTPlugin::GetMagicNumber()
+{
+ return m_pPluginInfo->m_nMagicNumber;
+}
+
+inline
+const char* CABRTPlugin::GetName()
+{
+ return m_pPluginInfo->m_sName;
+}
+
+inline
+const char* CABRTPlugin::GetDescription()
+{
+ return m_pPluginInfo->m_sDescription;
+}
+
+inline
+const char* CABRTPlugin::GetEmail()
+{
+ return m_pPluginInfo->m_sEmail;
+}
+
+inline
+const char* CABRTPlugin::GetWWW()
+{
+ return m_pPluginInfo->m_sWWW;
+}
+
+inline
+const char* CABRTPlugin::GetGTKBuilder()
+{
+ return m_pPluginInfo->m_sGTKBuilder;
+}
+
+inline
+plugin_type_t CABRTPlugin::GetType()
+{
+ return m_pPluginInfo->m_Type;
+}
+
+inline
+CPlugin* CABRTPlugin::PluginNew()
+{
+ return m_pFnPluginNew();
+}
+
#endif /*ABRTPLUGIN_H_*/