]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
constify switch_core_hash functions and some of their consumers.
authorMichael Jerris <mike@jerris.com>
Fri, 16 Feb 2007 23:36:10 +0000 (23:36 +0000)
committerMichael Jerris <mike@jerris.com>
Fri, 16 Feb 2007 23:36:10 +0000 (23:36 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@4304 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/include/switch_core.h
src/switch_core.c

index 4607dc20e627449e82ff7289f9590eebfcb35e82..876a0667a8bfe81492d177dba04a3223d08dbb4d 100644 (file)
@@ -861,7 +861,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_hash_destroy(switch_hash_t *hash);
   \return SWITCH_STATUS_SUCCESS if the data is added
   \note the string key must be a constant or a dynamic string
 */
-SWITCH_DECLARE(switch_status_t) switch_core_hash_insert(switch_hash_t *hash, char *key, void *data);
+SWITCH_DECLARE(switch_status_t) switch_core_hash_insert(switch_hash_t *hash, const char *key, const void *data);
 
 /*! 
   \brief Insert data into a hash with dynamicly allocated key name
@@ -870,7 +870,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_hash_insert(switch_hash_t *hash, cha
   \param data the data to add
   \return SWITCH_STATUS_SUCCESS if the data is added
 */
-SWITCH_DECLARE(switch_status_t) switch_core_hash_insert_dup(switch_hash_t *hash, char *key, void *data);
+SWITCH_DECLARE(switch_status_t) switch_core_hash_insert_dup(switch_hash_t *hash, const char *key, const void *data);
 
 /*! 
   \brief Delete data from a hash based on desired key
@@ -878,7 +878,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_hash_insert_dup(switch_hash_t *hash,
   \param key the key from which to delete the data
   \return SWITCH_STATUS_SUCCESS if the data is deleted
 */
-SWITCH_DECLARE(switch_status_t) switch_core_hash_delete(switch_hash_t *hash, char *key);
+SWITCH_DECLARE(switch_status_t) switch_core_hash_delete(switch_hash_t *hash, const char *key);
 
 /*! 
   \brief Retrieve data from a given hash
index d250ce18f427709f5eceffc9535f1623ad23d2c0..c0f03511b0f7a9ceece4a7d28ae014a2f9b23588 100644 (file)
@@ -3499,19 +3499,19 @@ SWITCH_DECLARE(switch_status_t) switch_core_hash_destroy(switch_hash_t *hash)
        return SWITCH_STATUS_SUCCESS;
 }
 
-SWITCH_DECLARE(switch_status_t) switch_core_hash_insert_dup(switch_hash_t *hash, char *key, void *data)
+SWITCH_DECLARE(switch_status_t) switch_core_hash_insert_dup(switch_hash_t *hash, const char *key, const void *data)
 {
        apr_hash_set(hash, switch_core_strdup(apr_hash_pool_get(hash), key), APR_HASH_KEY_STRING, data);
        return SWITCH_STATUS_SUCCESS;
 }
 
-SWITCH_DECLARE(switch_status_t) switch_core_hash_insert(switch_hash_t *hash, char *key, void *data)
+SWITCH_DECLARE(switch_status_t) switch_core_hash_insert(switch_hash_t *hash, const char *key, const void *data)
 {
        apr_hash_set(hash, key, APR_HASH_KEY_STRING, data);
        return SWITCH_STATUS_SUCCESS;
 }
 
-SWITCH_DECLARE(switch_status_t) switch_core_hash_delete(switch_hash_t *hash, char *key)
+SWITCH_DECLARE(switch_status_t) switch_core_hash_delete(switch_hash_t *hash, const char *key)
 {
        apr_hash_set(hash, key, APR_HASH_KEY_STRING, NULL);
        return SWITCH_STATUS_SUCCESS;
@@ -4114,8 +4114,8 @@ SWITCH_DECLARE(switch_status_t) switch_core_init(char *console, const char **err
                
                if ((settings = switch_xml_child(cfg, "settings"))) {
                        for (param = switch_xml_child(settings, "param"); param; param = param->next) {
-                               char *var = (char *) switch_xml_attr_soft(param, "name");
-                               char *val = (char *) switch_xml_attr_soft(param, "value");
+                               const char *var = switch_xml_attr_soft(param, "name");
+                               const char *val = switch_xml_attr_soft(param, "value");
                                
                                if (!strcasecmp(var, "max-sessions")) {
                                        runtime.session_limit = atoi(val);
@@ -4125,8 +4125,8 @@ SWITCH_DECLARE(switch_status_t) switch_core_init(char *console, const char **err
 
                if ((settings = switch_xml_child(cfg, "variables"))) {
                        for (param = switch_xml_child(settings, "variable"); param; param = param->next) {
-                               char *var = (char *) switch_xml_attr_soft(param, "name");
-                               char *val = (char *) switch_xml_attr_soft(param, "value");
+                               const char *var = switch_xml_attr_soft(param, "name");
+                               const char *val = switch_xml_attr_soft(param, "value");
                                char *varr = NULL, *vall = NULL;
 
                                varr = switch_core_strdup(runtime.memory_pool, var);