Oipo commented on a change in pull request #186: Cleanup dm interface
URL: https://github.com/apache/celix/pull/186#discussion_r403936533
 
 

 ##########
 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:
   Nice find.

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to