From 2fa395ac7d4bd9d0108194c375bf69839f4d62ec Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Sat, 11 Feb 2006 12:12:27 +0000 Subject: Use const qualifier for textfile library --- common/textfile.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'common/textfile.c') diff --git a/common/textfile.c b/common/textfile.c index 2ed929a3..bb55109c 100644 --- a/common/textfile.c +++ b/common/textfile.c @@ -36,7 +36,7 @@ #include #include -int create_dirs(char *filename, mode_t mode) +int create_dirs(const char *filename, const mode_t mode) { struct stat st; char dir[PATH_MAX + 1], *prev, *next; @@ -70,7 +70,7 @@ int create_dirs(char *filename, mode_t mode) return 0; } -int create_file(char *filename, mode_t mode) +int create_file(const char *filename, const mode_t mode) { int fd; @@ -86,7 +86,7 @@ int create_file(char *filename, mode_t mode) return 0; } -static inline char *find_key(char *map, char *key, size_t len) +static inline char *find_key(char *map, const char *key, size_t len) { char *off = strstr(map, key); @@ -97,7 +97,7 @@ static inline char *find_key(char *map, char *key, size_t len) return off; } -static inline int write_key_value(int fd, char *key, char *value) +static inline int write_key_value(int fd, const char *key, const char *value) { char *str; size_t size; @@ -119,7 +119,7 @@ static inline int write_key_value(int fd, char *key, char *value) return err; } -static int write_key(char *pathname, char *key, char *value) +static int write_key(const char *pathname, const char *key, const char *value) { struct stat st; char *map, *off, *end, *str; @@ -223,17 +223,17 @@ close: return -err; } -int textfile_put(char *pathname, char *key, char *value) +int textfile_put(const char *pathname, const char *key, const char *value) { return write_key(pathname, key, value); } -int textfile_del(char *pathname, char *key) +int textfile_del(const char *pathname, const char *key) { return write_key(pathname, key, NULL); } -char *textfile_get(char *pathname, char *key) +char *textfile_get(const char *pathname, const char *key) { struct stat st; char *map, *off, *end, *str = NULL; @@ -297,7 +297,7 @@ close: return str; } -int textfile_foreach(char *pathname, +int textfile_foreach(const char *pathname, void (*func)(char *key, char *value, void *data), void *data) { struct stat st; -- cgit