return (int) strtol(str, NULL, 10);
}
-double ciniparser_getdouble(dictionary *d, char *key, double notfound)
+double ciniparser_getdouble(dictionary *d, const char *key, double notfound)
{
char *str;
* ini file is given as "section:key". If the key cannot be found,
* the notfound value is returned.
*/
-double ciniparser_getdouble(dictionary *d, char *key, double notfound);
+double ciniparser_getdouble(dictionary *d, const char *key, double notfound);
/**
* @brief Get the string associated to a key, convert to a boolean
/* The remaining exposed functions are documented in dictionary.h */
-unsigned dictionary_hash(char *key)
+unsigned dictionary_hash(const char *key)
{
int len;
unsigned hash;
return;
}
-char *dictionary_get(dictionary *d, char *key, char *def)
+char *dictionary_get(dictionary *d, const char *key, char *def)
{
unsigned hash;
int i;
return def;
}
-int dictionary_set(dictionary *d, char *key, char *val)
+int dictionary_set(dictionary *d, const char *key, char *val)
{
int i;
unsigned hash;
return 0;
}
-void dictionary_unset(dictionary *d, char *key)
+void dictionary_unset(dictionary *d, const char *key)
{
unsigned hash;
int i;
* The key is stored anyway in the struct so that collision can be avoided
* by comparing the key itself in last resort.
*/
-unsigned dictionary_hash(char *key);
+unsigned dictionary_hash(const char *key);
/**
* @brief Create a new dictionary object.
* dictionary. The returned character pointer points to data internal to the
* dictionary object, you should not try to free it or modify it.
*/
-char *dictionary_get(dictionary *d, char *key, char *def);
+char *dictionary_get(dictionary *d, const char *key, char *def);
/**
* @brief Set a value in a dictionary.
*
* This function returns non-zero in case of failure.
*/
-int dictionary_set(dictionary *vd, char *key, char *val);
+int dictionary_set(dictionary *vd, const char *key, char *val);
/**
* @brief Delete a key in a dictionary
* This function deletes a key in a dictionary. Nothing is done if the
* key cannot be found.
*/
-void dictionary_unset(dictionary *d, char *key);
+void dictionary_unset(dictionary *d, const char *key);
/**
* @brief Dump a dictionary to an opened file pointer.