]> granicus.if.org Git - flex/commitdiff
Applied 'const' to a few more char*, where appropriate.
authorJohn Millaway <john43@users.sourceforge.net>
Fri, 19 Apr 2002 22:20:24 +0000 (22:20 +0000)
committerJohn Millaway <john43@users.sourceforge.net>
Fri, 19 Apr 2002 22:20:24 +0000 (22:20 +0000)
flexdef.h
misc.c
parse.y
sym.c

index 113523a13f708e3ea0438b07e48db9c6bee9cf65..8b82bb39a1da157b1a8952a3a85a906225344989 100644 (file)
--- a/flexdef.h
+++ b/flexdef.h
@@ -795,7 +795,7 @@ extern void usage PROTO((void));
 /* from file misc.c */
 
 /* Add a #define to the action file. */
-extern void action_define PROTO(( char *defname, int value ));
+extern void action_define PROTO(( const char *defname, int value ));
 
 /* Add the given text to the stored actions. */
 extern void add_action PROTO(( char *new_text ));
diff --git a/misc.c b/misc.c
index 35bca5fb24a19b288cf11cc43c5eca590cdad964..55fd07da72a28e76b99412e2c37ca223c27b8703 100644 (file)
--- a/misc.c
+++ b/misc.c
@@ -36,7 +36,7 @@
 
 /* Append "#define defname value\n" to the running buffer. */
 void action_define( defname, value )
-char *defname;
+const char *defname;
 int value;
        {
        char buf[MAXLINE];
@@ -523,7 +523,7 @@ int value;
 /* myctoi - return the integer represented by a string of digits */
 
 int myctoi( array )
-char *array;
+const char *array;
        {
        int val = 0;
 
diff --git a/parse.y b/parse.y
index 26b646b1ed1d3e28bc06a056f27b3c57482a4101..0645b7a03ccdeec972281b5eca45fd0d9867828f 100644 (file)
--- a/parse.y
+++ b/parse.y
@@ -819,7 +819,7 @@ void build_eof_action()
 /* format_synerr - write out formatted syntax error */
 
 void format_synerr( msg, arg )
-char msg[], arg[];
+const char *msg, arg[];
        {
        char errmsg[MAXLINE];
 
@@ -831,7 +831,7 @@ char msg[], arg[];
 /* synerr - report a syntax error */
 
 void synerr( str )
-char str[];
+const char *str;
        {
        syntaxerror = true;
        pinpoint_message( str );
@@ -841,7 +841,7 @@ char str[];
 /* format_warn - write out formatted warning */
 
 void format_warn( msg, arg )
-char msg[], arg[];
+const char *msg, arg[];
        {
        char warn_msg[MAXLINE];
 
@@ -853,7 +853,7 @@ char msg[], arg[];
 /* warn - report a warning, unless -w was given */
 
 void warn( str )
-char str[];
+const char *str;
        {
        line_warning( str, linenum );
        }
@@ -863,7 +863,7 @@ char str[];
  */
 
 void format_pinpoint_message( msg, arg )
-char msg[], arg[];
+const char *msg, arg[];
        {
        char errmsg[MAXLINE];
 
@@ -875,7 +875,7 @@ char msg[], arg[];
 /* pinpoint_message - write out a message, pinpointing its location */
 
 void pinpoint_message( str )
-char str[];
+const char *str;
        {
        line_pinpoint( str, linenum );
        }
@@ -884,7 +884,7 @@ char str[];
 /* line_warning - report a warning at a given line, unless -w was given */
 
 void line_warning( str, line )
-char str[];
+const char *str;
 int line;
        {
        char warning[MAXLINE];
@@ -900,7 +900,7 @@ int line;
 /* line_pinpoint - write out a message, pinpointing it at the given line */
 
 void line_pinpoint( str, line )
-char str[];
+const char *str;
 int line;
        {
        fprintf( stderr, "%s: %d: %s\n", infilename, line, str );
@@ -912,6 +912,6 @@ int line;
  */
 
 void yyerror( msg )
-char msg[];
+const char *msg;
        {
        }
diff --git a/sym.c b/sym.c
index 29c1b6ddc08c9e5bcc7f7243f35b0bce05df95fe..45322507ad8fde423c4cf17bf65195c8758282bf 100644 (file)
--- a/sym.c
+++ b/sym.c
@@ -62,7 +62,7 @@ static struct hash_entry *ccltab[CCL_HASH_SIZE];
 
 static int addsym PROTO((register char[], char*, int, hash_table, int));
 static struct hash_entry *findsym();
-static int hashfunct PROTO((register char[], int));
+static int hashfunct PROTO((register const char*, int));
 
 
 /* addsym - add symbol and definitions to symbol table
@@ -150,7 +150,7 @@ Char ccltxt[];
 /* findsym - find symbol in symbol table */
 
 static struct hash_entry *findsym( sym, table, table_size )
-register char sym[];
+register const char *sym;
 hash_table table;
 int table_size;
        {
@@ -176,7 +176,7 @@ int table_size;
 /* hashfunct - compute the hash value for "str" and hash size "hash_size" */
 
 static int hashfunct( str, hash_size )
-register char str[];
+register const char *str;
 int hash_size;
        {
        register int hashval;
@@ -198,7 +198,7 @@ int hash_size;
 /* ndinstal - install a name definition */
 
 void ndinstal( name, definition )
-char name[];
+const char *name;
 Char definition[];
        {
        char *copy_string();
@@ -217,7 +217,7 @@ Char definition[];
  */
 
 Char *ndlookup( nd )
-char nd[];
+const char *nd;
        {
        return (Char *) findsym( nd, ndtbl, NAME_TABLE_HASH_SIZE )->str_val;
        }
@@ -246,7 +246,7 @@ void scextend()
  */
 
 void scinstal( str, xcluflg )
-char str[];
+const char *str;
 int xcluflg;
        {
        char *copy_string();
@@ -278,7 +278,7 @@ int xcluflg;
  */
 
 int sclookup( str )
-char str[];
+const char *str;
        {
        return findsym( str, sctbl, START_COND_HASH_SIZE )->int_val;
        }