summaryrefslogtreecommitdiff
path: root/source3/param/params.c
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2003-01-02 09:07:17 +0000
committerAndrew Bartlett <abartlet@samba.org>2003-01-02 09:07:17 +0000
commit6d66fb308ab85bd9691d541764e683e6040cf724 (patch)
tree10b705921665cb7bafdd332ca53b8a943e13f0e5 /source3/param/params.c
parentc105c12d122e599fe57dde8b2b73c52231f0c1d2 (diff)
downloadsamba-6d66fb308ab85bd9691d541764e683e6040cf724.tar.gz
samba-6d66fb308ab85bd9691d541764e683e6040cf724.tar.bz2
samba-6d66fb308ab85bd9691d541764e683e6040cf724.zip
BIG patch...
This patch makes Samba compile cleanly with -Wwrite-strings. - That is, all string literals are marked as 'const'. These strings are always read only, this just marks them as such for passing to other functions. What is most supprising is that I didn't need to change more than a few lines of code (all in 'net', which got a small cleanup of net.h and extern variables). The rest is just adding a lot of 'const'. As far as I can tell, I have not added any new warnings - apart from making all of tdbutil.c's function const (so they warn for adding that const string to struct). Andrew Bartlett (This used to be commit 92a777d0eaa4fb3a1c7835816f93c6bdd456816d)
Diffstat (limited to 'source3/param/params.c')
-rw-r--r--source3/param/params.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/source3/param/params.c b/source3/param/params.c
index bc93a1fedf..892e5476cc 100644
--- a/source3/param/params.c
+++ b/source3/param/params.c
@@ -201,7 +201,7 @@ static int Continuation(char *line, int pos )
}
-static BOOL Section( myFILE *InFile, BOOL (*sfunc)(char *) )
+static BOOL Section( myFILE *InFile, BOOL (*sfunc)(const char *) )
/* ------------------------------------------------------------------------ **
* Scan a section name, and pass the name to function sfunc().
*
@@ -219,7 +219,7 @@ static BOOL Section( myFILE *InFile, BOOL (*sfunc)(char *) )
int c;
int i;
int end;
- char *func = "params.c:Section() -";
+ const char *func = "params.c:Section() -";
i = 0; /* <i> is the offset of the next free byte in bufr[] and */
end = 0; /* <end> is the current "end of string" offset. In most */
@@ -297,7 +297,7 @@ static BOOL Section( myFILE *InFile, BOOL (*sfunc)(char *) )
return( False );
} /* Section */
-static BOOL Parameter( myFILE *InFile, BOOL (*pfunc)(char *, char *), int c )
+static BOOL Parameter( myFILE *InFile, BOOL (*pfunc)(const char *, const char *), int c )
/* ------------------------------------------------------------------------ **
* Scan a parameter name and value, and pass these two fields to pfunc().
*
@@ -325,7 +325,7 @@ static BOOL Parameter( myFILE *InFile, BOOL (*pfunc)(char *, char *), int c )
int i = 0; /* Position within bufr. */
int end = 0; /* bufr[end] is current end-of-string. */
int vstart = 0; /* Starting position of the parameter value. */
- char *func = "params.c:Parameter() -";
+ const char *func = "params.c:Parameter() -";
/* Read the parameter name. */
while( 0 == vstart ) /* Loop until we've found the start of the value. */
@@ -445,8 +445,8 @@ static BOOL Parameter( myFILE *InFile, BOOL (*pfunc)(char *, char *), int c )
} /* Parameter */
static BOOL Parse( myFILE *InFile,
- BOOL (*sfunc)(char *),
- BOOL (*pfunc)(char *, char *) )
+ BOOL (*sfunc)(const char *),
+ BOOL (*pfunc)(const char *, const char *) )
/* ------------------------------------------------------------------------ **
* Scan & parse the input.
*
@@ -505,7 +505,7 @@ static BOOL Parse( myFILE *InFile,
return( True );
} /* Parse */
-static myFILE *OpenConfFile( char *FileName )
+static myFILE *OpenConfFile( const char *FileName )
/* ------------------------------------------------------------------------ **
* Open a configuration file.
*
@@ -516,7 +516,7 @@ static myFILE *OpenConfFile( char *FileName )
* ------------------------------------------------------------------------ **
*/
{
- char *func = "params.c:OpenConfFile() -";
+ const char *func = "params.c:OpenConfFile() -";
extern BOOL in_client;
int lvl = in_client?1:0;
myFILE *ret;
@@ -538,9 +538,9 @@ static myFILE *OpenConfFile( char *FileName )
return( ret );
} /* OpenConfFile */
-BOOL pm_process( char *FileName,
- BOOL (*sfunc)(char *),
- BOOL (*pfunc)(char *, char *) )
+BOOL pm_process( const char *FileName,
+ BOOL (*sfunc)(const char *),
+ BOOL (*pfunc)(const char *, const char *) )
/* ------------------------------------------------------------------------ **
* Process the named parameter file.
*
@@ -557,7 +557,7 @@ BOOL pm_process( char *FileName,
{
int result;
myFILE *InFile;
- char *func = "params.c:pm_process() -";
+ const char *func = "params.c:pm_process() -";
InFile = OpenConfFile( FileName ); /* Open the config file. */
if( NULL == InFile )