trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a..@apache.org
Subject [trafficserver] branch master updated: Clean up globalregisterplugin
Date Thu, 30 Mar 2017 20:23:28 GMT
This is an automated email from the ASF dual-hosted git repository.

amc pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git

The following commit(s) were added to refs/heads/master by this push:
       new  b5f3544   Clean up globalregisterplugin
b5f3544 is described below

commit b5f3544634072af6a58a6ed84c214e63972c8ed8
Author: Persia Aziz <persia@yahoo-inc.com>
AuthorDate: Thu Mar 30 10:57:03 2017 -0500

    Clean up globalregisterplugin
---
 lib/cppapi/Plugin.cc                  | 8 ++++----
 lib/cppapi/include/atscppapi/Plugin.h | 8 +++++++-
 2 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/lib/cppapi/Plugin.cc b/lib/cppapi/Plugin.cc
index 1188622..766f9ad 100644
--- a/lib/cppapi/Plugin.cc
+++ b/lib/cppapi/Plugin.cc
@@ -29,12 +29,12 @@ const std::string atscppapi::HOOK_TYPE_STRINGS[] = {
   std::string("HOOK_CACHE_LOOKUP_COMPLETE"),          std::string("HOOK_SELECT_ALT")};
 
 void
-atscppapi::RegisterGlobalPlugin(std::string name, std::string vendor, std::string email)
+atscppapi::RegisterGlobalPlugin(const char *name, const char *vendor, const char *email)
 {
   TSPluginRegistrationInfo info;
-  info.plugin_name   = const_cast<char *>(name.c_str());
-  info.vendor_name   = const_cast<char *>(vendor.c_str());
-  info.support_email = const_cast<char *>(email.c_str());
+  info.plugin_name   = name;
+  info.vendor_name   = vendor;
+  info.support_email = email;
   if (TSPluginRegister(&info) != TS_SUCCESS)
     TSError("[Plugin.cc] Plugin registration failed.");
 }
diff --git a/lib/cppapi/include/atscppapi/Plugin.h b/lib/cppapi/include/atscppapi/Plugin.h
index bf35f7a..22cd377 100644
--- a/lib/cppapi/include/atscppapi/Plugin.h
+++ b/lib/cppapi/include/atscppapi/Plugin.h
@@ -166,7 +166,13 @@ protected:
 
 /**< Human readable strings for each HookType, you can access them as HOOK_TYPE_STRINGS[HOOK_OS_DNS]
for example. */
 extern const std::string HOOK_TYPE_STRINGS[];
-void RegisterGlobalPlugin(std::string name, std::string vendor, std::string email);
+
+void RegisterGlobalPlugin(const char *name, const char *vendor, const char *email);
+inline void
+RegisterGlobalPlugin(std::string const &name, std::string const &vendor, std::string
const &email)
+{
+  RegisterGlobalPlugin(name.c_str(), vendor.c_str(), email.c_str());
+}
 
 } /* atscppapi */
 

-- 
To stop receiving notification emails like this one, please contact
['"commits@trafficserver.apache.org" <commits@trafficserver.apache.org>'].

Mime
View raw message