celix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [celix] pnoltes commented on a change in pull request #186: Cleanup dm interface
Date Mon, 06 Apr 2020 07:40:54 GMT
pnoltes commented on a change in pull request #186: Cleanup dm interface
URL: https://github.com/apache/celix/pull/186#discussion_r403886608
 
 

 ##########
 File path: libs/framework/include/celix/dm/Component_Impl.h
 ##########
 @@ -39,21 +39,25 @@ Component<T>::~Component() {
 
 template<class T>
 template<class I>
-Component<T>& Component<T>::addInterfaceWithName(const std::string serviceName,
const std::string version, const Properties properties) {
+Component<T>& Component<T>::addInterfaceWithName(const std::string &serviceName,
const std::string &version, const Properties &properties) {
     if (!serviceName.empty()) {
         //setup c properties
         celix_properties_t *cProperties = properties_create();
         properties_set(cProperties, CELIX_FRAMEWORK_SERVICE_LANGUAGE, CELIX_FRAMEWORK_SERVICE_CXX_LANGUAGE);
         for (const auto& pair : properties) {
-            properties_set(cProperties, (char *) pair.first.c_str(), (char *) pair.second.c_str());
+            char *key = nullptr;
+            char *value = nullptr;
+            copyString(pair.first, &key);
+            copyString(pair.second, &value);
+            properties_set(cProperties, key, value);
 
 Review comment:
   note that properties_set does een copy of the provided key/value, so now you have a double
copy

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message