Add constness to filenames passed to functions.
authorMartin Pool <mbp@samba.org>
Tue, 15 Jan 2002 01:37:12 +0000 (01:37 +0000)
committerMartin Pool <mbp@samba.org>
Tue, 15 Jan 2002 01:37:12 +0000 (01:37 +0000)
(This used to be commit 8d106dc1f4a51112516d72ae68747ca6b5b904b7)

source3/lib/util.c
source3/lib/util_sock.c
source3/lib/util_str.c

index 97d897387368d8ab3165a827fa9cca373e2b3f09..15bb41eb0690a087fe96d2f3152cd7edf62d81ee 100644 (file)
@@ -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;
   
index 8e7b69cac8860bc7bc5bb95ed061389e7eb0620c..c6c26155da96ff7e45277cac091550b58282fff3 100644 (file)
@@ -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;
 
index 14d50384c28070efda32bee5e4f2b48a4d5a5db5..b1d50ad9112d8f9fe0e899e933a0aab8638d4054 100644 (file)
@@ -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;
+}