From c1fae9714964e5f68419d9c83762f6310d4da5aa Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rafa=C3=ABl=20Carr=C3=A9?=
 <rafael.carre@savoirfairelinux.com>
Date: Thu, 28 Jul 2011 17:25:32 -0400
Subject: [PATCH] yamlnode: use const references when possible (still some left
 to do)

---
 sflphone-common/src/config/yamlnode.cpp | 12 ++++++------
 sflphone-common/src/config/yamlnode.h   | 12 ++++++------
 2 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/sflphone-common/src/config/yamlnode.cpp b/sflphone-common/src/config/yamlnode.cpp
index 508adfce63..08de28df99 100644
--- a/sflphone-common/src/config/yamlnode.cpp
+++ b/sflphone-common/src/config/yamlnode.cpp
@@ -95,13 +95,13 @@ void MappingNode::addNode (YamlNode *node)
     map.insert (it, std::pair<std::string, YamlNode *> (tmpKey, node));
 }
 
-void MappingNode::setKeyValue (std::string key, YamlNode *value)
+void MappingNode::setKeyValue (const std::string &key, YamlNode *value)
 {
     Mapping::iterator it = map.end();
     map.insert (it, std::pair<std::string, YamlNode *> (key, value));
 }
 
-void MappingNode::removeKeyValue (std::string key)
+void MappingNode::removeKeyValue (const std::string &key)
 {
 
     Mapping::iterator it = map.find (key);
@@ -109,7 +109,7 @@ void MappingNode::removeKeyValue (std::string key)
 }
 
 
-YamlNode *MappingNode::getValue (std::string key)
+YamlNode *MappingNode::getValue (const std::string &key)
 {
 
     Mapping::iterator it = map.find (key);
@@ -122,7 +122,7 @@ YamlNode *MappingNode::getValue (std::string key)
     }
 }
 
-void MappingNode::getValue (std::string key, bool *b)
+void MappingNode::getValue (const std::string &key, bool *b)
 {
 	ScalarNode *node = (ScalarNode*)getValue(key);
 	if (!node)
@@ -132,7 +132,7 @@ void MappingNode::getValue (std::string key, bool *b)
 	*b = v == "true";
 }
 
-void MappingNode::getValue (std::string key, int *i)
+void MappingNode::getValue (const std::string &key, int *i)
 {
 	ScalarNode *node = (ScalarNode*)getValue(key);
 	if (!node)
@@ -142,7 +142,7 @@ void MappingNode::getValue (std::string key, int *i)
 	*i = atoi(v.c_str());
 }
 
-void MappingNode::getValue (std::string key, std::string *v)
+void MappingNode::getValue (const std::string &key, std::string *v)
 {
 	ScalarNode *node = (ScalarNode*)getValue(key);
 	if (!node)
diff --git a/sflphone-common/src/config/yamlnode.h b/sflphone-common/src/config/yamlnode.h
index ebfab90f77..393f4e2cdd 100644
--- a/sflphone-common/src/config/yamlnode.h
+++ b/sflphone-common/src/config/yamlnode.h
@@ -143,14 +143,14 @@ class MappingNode : public YamlNode
             tmpKey = key;
         }
 
-        void  setKeyValue (std::string key, YamlNode *value);
+        void  setKeyValue (const std::string &key, YamlNode *value);
 
-        void removeKeyValue (std::string key);
+        void removeKeyValue (const std::string &key);
 
-        YamlNode *getValue (std::string key);
-        void getValue (std::string key, bool *b);
-        void getValue (std::string key, int *i);
-        void getValue (std::string key, std::string *s);
+        YamlNode *getValue (const std::string &key);
+        void getValue (const std::string &key, bool *b);
+        void getValue (const std::string &key, int *i);
+        void getValue (const std::string &key, std::string *s);
 
         virtual void deleteChildNodes (void);
 
-- 
GitLab