Mercurial > hg
diff mcabber/src/settings.c @ 281:f562b9af2de7
Add "const" specifier in prototypes
It's easier then to know when variables are read-only (and shouldn't
be freed).
author | Mikael Berthe <mikael@lilotux.net> |
---|---|
date | Wed, 06 Jul 2005 22:18:05 +0100 |
parents | 68ce34b4243b |
children | 87d6ac21cd1b |
line wrap: on
line diff
--- a/mcabber/src/settings.c Wed Jul 06 21:28:37 2005 +0100 +++ b/mcabber/src/settings.c Wed Jul 06 22:18:05 2005 +0100 @@ -44,7 +44,7 @@ } // Return a pointer to the node with the requested key, or NULL if none found -GSList *settings_find(GSList *list, gchar *key) +GSList *settings_find(GSList *list, const gchar *key) { GSList *ptr; @@ -69,7 +69,7 @@ // to NULL and return FALSE. // // The called should g_free() *pkey and *pval (if not NULL) after use. -guint parse_assigment(gchar *assignment, gchar **pkey, gchar **pval) +guint parse_assigment(gchar *assignment, const gchar **pkey, const gchar **pval) { char *key, *val, *t; @@ -114,7 +114,7 @@ return TRUE; } -void settings_set(guint type, gchar *key, gchar *value) +void settings_set(guint type, const gchar *key, const gchar *value) { GSList **plist; GSList *sptr; @@ -145,12 +145,12 @@ } } -void settings_del(guint type, gchar *key) +void settings_del(guint type, const gchar *key) { settings_set(type, key, NULL); } -gchar *settings_get(guint type, gchar *key) +const gchar *settings_get(guint type, const gchar *key) { GSList **plist; GSList *sptr; @@ -164,9 +164,9 @@ return setting->value; } -int settings_get_int(guint type, gchar *key) +int settings_get_int(guint type, const gchar *key) { - gchar *setval = settings_get(type, key); + const gchar *setval = settings_get(type, key); if (setval) return atoi(setval); return 0;