summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2013-01-12 19:28:11 -0800
committerAlan Coopersmith <alan.coopersmith@oracle.com>2013-01-12 19:28:11 -0800
commitb93888eb689485d9899cbf7c224b20d68968e857 (patch)
treed6017af0d65087735a03b4822c859d3a9c6ea438
parent0ba7294e8e5ca61b03ef7c76da7d381e93eaf937 (diff)
Declare utils.c functions as taking const char * arguments
Clears dozens of const string warnings from gcc. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-rw-r--r--utils.c32
-rw-r--r--utils.h36
2 files changed, 34 insertions, 34 deletions
diff --git a/utils.c b/utils.c
index a0def17..d4a78b7 100644
--- a/utils.c
+++ b/utils.c
@@ -95,7 +95,7 @@ static FILE *entryFile = NULL;
int uEntryLevel;
Boolean
-uSetEntryFile(char *name)
+uSetEntryFile(const char *name)
{
if ((entryFile != NULL) && (entryFile != stderr)) {
fprintf(entryFile, "switching to %s\n", name ? name : "stderr");
@@ -113,7 +113,7 @@ uSetEntryFile(char *name)
}
void
-uEntry(int l, char *s, ...)
+uEntry(int l, const char *s, ...)
{
int i;
va_list ap;
@@ -129,7 +129,7 @@ uEntry(int l, char *s, ...)
}
void
-uExit(int l, char *rtVal)
+uExit(int l, const char *rtVal)
{
int i;
@@ -152,7 +152,7 @@ int uDebugIndentLevel = 0;
int uDebugIndentSize = 4;
Boolean
-uSetDebugFile(char *name)
+uSetDebugFile(const char *name)
{
if ((uDebugFile != NULL) && (uDebugFile != stderr)) {
fprintf(uDebugFile, "switching to %s\n", name ? name : "stderr");
@@ -170,7 +170,7 @@ uSetDebugFile(char *name)
}
void
-uDebug(char *s, ...)
+uDebug(const char *s, ...)
{
int i;
va_list ap;
@@ -186,7 +186,7 @@ uDebug(char *s, ...)
}
void
-uDebugNOI(char *s, ...)
+uDebugNOI(const char *s, ...)
{
va_list ap;
@@ -202,7 +202,7 @@ uDebugNOI(char *s, ...)
static FILE *errorFile = NULL;
Boolean
-uSetErrorFile(char *name)
+uSetErrorFile(const char *name)
{
if ((errorFile != NULL) && (errorFile != stderr)) {
fprintf(errorFile, "switching to %s\n", name ? name : "stderr");
@@ -220,7 +220,7 @@ uSetErrorFile(char *name)
}
void
-uInformation(char *s, ...)
+uInformation(const char *s, ...)
{
va_list ap;
@@ -234,7 +234,7 @@ uInformation(char *s, ...)
/***====================================================================***/
void
-uAction(char *s, ...)
+uAction(const char *s, ...)
{
va_list ap;
@@ -249,7 +249,7 @@ uAction(char *s, ...)
/***====================================================================***/
void
-uWarning(char *s, ...)
+uWarning(const char *s, ...)
{
va_list ap;
@@ -264,7 +264,7 @@ uWarning(char *s, ...)
/***====================================================================***/
void
-uError(char *s, ...)
+uError(const char *s, ...)
{
va_list ap;
@@ -279,7 +279,7 @@ uError(char *s, ...)
/***====================================================================***/
void
-uFatalError(char *s, ...)
+uFatalError(const char *s, ...)
{
va_list ap;
@@ -296,7 +296,7 @@ uFatalError(char *s, ...)
/***====================================================================***/
void
-uInternalError(char *s, ...)
+uInternalError(const char *s, ...)
{
va_list ap;
@@ -312,7 +312,7 @@ uInternalError(char *s, ...)
#ifndef HAVE_STRDUP
char *
-uStringDup(char *str)
+uStringDup(const char *str)
{
char *rtrn;
@@ -326,7 +326,7 @@ uStringDup(char *str)
#ifndef HAVE_STRCASECMP
int
-uStrCaseCmp(char *str1, char *str2)
+uStrCaseCmp(const char *str1, const char *str2)
{
char buf1[512], buf2[512];
char c, *s;
@@ -353,7 +353,7 @@ uStrCaseCmp(char *str1, char *str2)
}
int
-uStrCasePrefix(char *prefix, char *str)
+uStrCasePrefix(const char *prefix, const char *str)
{
char c1;
char c2;
diff --git a/utils.h b/utils.h
index 2e84572..3969d9c 100644
--- a/utils.h
+++ b/utils.h
@@ -102,13 +102,13 @@ extern void uFree(Opaque /* ptr */);
/***====================================================================***/
-extern Boolean uSetErrorFile(char *name);
-extern void uInformation(char *s, ...);
-extern void uAction(char *s, ...);
-extern void uWarning(char *s, ...);
-extern void uError(char *s, ...);
-extern void uFatalError(char *s, ...);
-extern void uInternalError(char *s, ...);
+extern Boolean uSetErrorFile(const char *name);
+extern void uInformation(const char *s, ...);
+extern void uAction(const char *s, ...);
+extern void uWarning(const char *s, ...);
+extern void uError(const char *s, ...);
+extern void uFatalError(const char *s, ...);
+extern void uInternalError(const char *s, ...);
/***====================================================================***/
@@ -123,16 +123,16 @@ extern void uInternalError(char *s, ...);
#define uStrCaseCmp(s1,s2) (strcasecmp(s1,s2))
#define uStrCasePrefix(p,s) (strncasecmp(p,s,strlen(p))==0)
#else
-extern int uStrCaseCmp(char * /* s1 */,
- char * /* s2 */);
+extern int uStrCaseCmp(const char * /* s1 */,
+ const char * /* s2 */);
-extern int uStrCasePrefix(char * /* p */,
- char * /* str */);
+extern int uStrCasePrefix(const char * /* p */,
+ const char * /* str */);
#endif
#ifdef HAVE_STRDUP
#define uStringDup(s1) (strdup(s1))
#else
-extern char *uStringDup(char * /* s1 */);
+extern char *uStringDup(const char * /* s1 */);
#endif
/***====================================================================***/
@@ -153,9 +153,9 @@ extern char *uStringDup(char * /* s1 */);
extern
unsigned int DEBUG_VAR;
-extern void uDebug(char *s, ...);
-extern void uDebugNOI(char *s, ...); /* no indent */
-extern Boolean uSetDebugFile(char *name);
+extern void uDebug(const char *s, ...);
+extern void uDebugNOI(const char *s, ...); /* no indent */
+extern Boolean uSetDebugFile(const char *name);
extern FILE *uDebugFile;
extern int uDebugIndentLevel;
@@ -191,10 +191,10 @@ extern int uDebugIndentSize;
#define uDEBUG_NOI5(f,s,a,b,c,d,e)
#endif
-extern Boolean uSetEntryFile(char *name);
+extern Boolean uSetEntryFile(const char *name);
-extern void uEntry(int l, char *s, ...);
-extern void uExit(int l, char *rtVal);
+extern void uEntry(int l, const char *s, ...);
+extern void uExit(int l, const char *rtVal);
extern int uEntryLevel;