diff options
author | Martin Pool <mbp@samba.org> | 2002-01-15 01:37:12 +0000 |
---|---|---|
committer | Martin Pool <mbp@samba.org> | 2002-01-15 01:37:12 +0000 |
commit | df3d5b3556146e2d60c1a5656b16236f96832a16 (patch) | |
tree | 4f30c447f9e67a3e8f8eeebda0b20fb3ea335dbb | |
parent | 90558370ab9019c425019083a6dcb129a808a5ed (diff) | |
download | samba-df3d5b3556146e2d60c1a5656b16236f96832a16.tar.gz samba-df3d5b3556146e2d60c1a5656b16236f96832a16.tar.bz2 samba-df3d5b3556146e2d60c1a5656b16236f96832a16.zip |
Add constness to filenames passed to functions.
(This used to be commit 8d106dc1f4a51112516d72ae68747ca6b5b904b7)
-rw-r--r-- | source3/lib/util.c | 4 | ||||
-rw-r--r-- | source3/lib/util_sock.c | 2 | ||||
-rw-r--r-- | source3/lib/util_str.c | 25 |
3 files changed, 28 insertions, 3 deletions
diff --git a/source3/lib/util.c b/source3/lib/util.c index 97d8973873..15bb41eb06 100644 --- a/source3/lib/util.c +++ b/source3/lib/util.c @@ -182,7 +182,7 @@ char *get_numlist(char *p, uint32 **num, int *count) Check if a file exists - call vfs_file_exist for samba files. ********************************************************************/ -BOOL file_exist(char *fname,SMB_STRUCT_STAT *sbuf) +BOOL file_exist(const char *fname,SMB_STRUCT_STAT *sbuf) { SMB_STRUCT_STAT st; if (!sbuf) @@ -198,7 +198,7 @@ BOOL file_exist(char *fname,SMB_STRUCT_STAT *sbuf) Check a files mod time. ********************************************************************/ -time_t file_modtime(char *fname) +time_t file_modtime(const char *fname) { SMB_STRUCT_STAT st; diff --git a/source3/lib/util_sock.c b/source3/lib/util_sock.c index 8e7b69cac8..c6c26155da 100644 --- a/source3/lib/util_sock.c +++ b/source3/lib/util_sock.c @@ -116,7 +116,7 @@ static void print_socket_options(int s) Set user socket options. ****************************************************************************/ -void set_socket_options(int fd, char *options) +void set_socket_options(int fd, const char *options) { fstring tok; diff --git a/source3/lib/util_str.c b/source3/lib/util_str.c index 14d50384c2..b1d50ad911 100644 --- a/source3/lib/util_str.c +++ b/source3/lib/util_str.c @@ -937,3 +937,28 @@ char *binary_string(char *buf, int len) return s; } + +/* Just a typesafety wrapper for snprintf into a pstring */ +int pstr_sprintf(pstring s, const char *fmt, ...) +{ + va_list ap; + int ret; + + va_start(ap, fmt); + ret = vsnprintf(PSTR_MUTABLE(s), PSTRING_LEN, fmt, ap); + va_end(ap); + return ret; +} + + +/* Just a typesafety wrapper for snprintf into a pstring */ +int fstr_sprintf(fstring s, const char *fmt, ...) +{ + va_list ap; + int ret; + + va_start(ap, fmt); + ret = vsnprintf(FSTR_MUTABLE(s), FSTRING_LEN, fmt, ap); + va_end(ap); + return ret; +} |