bison-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

proposed patches to fix local variable naming glitches, etc.


From: Paul Eggert
Subject: proposed patches to fix local variable naming glitches, etc.
Date: Sat, 1 Feb 2003 23:50:35 -0800 (PST)

> From: Akim Demaille
> Date: Tue, 21 Jan 2003 14:23:43 +0100

> My hope is that no inconsistency was introduced in the variable names,
> and that `s' is *always* the name of a state, not of anything else.

I went through the latest CVS looking for instances of "s" that are
neither states nor state numbers, and similarly for "r" and rules or
rule_numbers, and came up with the following proposed patch.

After looking at the code some more, I think it's OK to have "state
*s" in some functions, and "state_number s" in others.  The two uses
do not collide in practice, and even if they did collide the compiler
would catch misuses of state* values in state_number contexts, or vice
versa.  It's convenient to think of "s" as a state, even though it is
never exactly the C type "state" in practice.

> and it took me months to have some form of homogeneity.  But more
> was needed, and now I'm just depressed thinking about this.

After looking at the code more closely, I see what you mean about the
code being nonhomogeneous.  There are still many instances of "i" and
"j", for example, that are actually state numbers or something like
that.  But I'm not sure that we should insist on extreme homogeneity
here; at some point there are diminishing returns.

By the way, while generating this proposed patch I noticed that
src/gram.h has an unused decl; this patch removes it.

2003-02-01  Paul Eggert  <address@hidden>

        * src/gram.h (start_symbol): Remove unused decl.

        Use more consistent naming conventions for local vars.

        * src/derives.c (derives_compute): Change type of local var from
        int to rule_number.
        * src/gram.c (grammar_rules_partial_print): Likewise.
        * src/print.c (print_core): Likewise.
        * src/reduce.c (reduce_grammar_tables): Likewise.

        * src/gram.c (grammar_dump): Change name of item_number *
        local var from r to rp.
        * src/nullable.c (nullable_compute): Likewise.

        * src/gram.h (ISTOKEN, ISVAR): Use i, not s, for int var.

        * src/gram.h (symbol_number_as_item_number): Use sym, not s,
        for symbol or symbol_number var.
        * src/reader.c (grammar_start_symbol_set): Likewise.
        * src/reader.h (grammar_start_symbol_set, grammar_symbol_append):
        Likewise.
        * src/state.c (transitions_to): Likewise.
        * src/state.h: Likewise.
        * src/tables.c (symbol_number_to_vector_number): Likewise.

        * src/muscle_tab.h (MUSCLE_OBSTACK_SGROW): Use p, not s, for
        char * var.

        * src/parse-gram.y (lloc_default): Use loc, not r, for YYLTYPE
        var.

        * src/scan-gram.l (no_cr_read): Use bytes_read, not s, for size
        var.

        * src/system.h (xstrndup, strchr, strspn, strnlen, memchr, memrchr):
        Use str, not s, for char * var.  Use ch, not c, for character var.
        Use size for size var.

        * src/uniqstr.c (uniqstr_new, uniqstr_assert): Use str, not s, for
        char * var.
        (uniqstr_print, uniqst_print_processor): Use ustr, not s, for
        uniqstr var.
        * src/uniqstr.h: Likewise.

        * src/vcg.c (get_color_str, get_textmode_str, get_shape_str,
        get_layoutalgorithm_str, get_decision_str, get_orientation_str,
        get_node_alignment_str, get_arrow_mode_str, get_crossing_type_str,
        get_view_str, get_linestyle_str, get_arrowstyle_str): Rename
        param to have same name as that of enum, so that we don't use
        "s" to stand for a non-state.

Index: src/derives.c
===================================================================
RCS file: /cvsroot/bison/bison/src/derives.c,v
retrieving revision 1.40
diff -p -u -r1.40 derives.c
--- src/derives.c       13 Dec 2002 08:21:03 -0000      1.40
+++ src/derives.c       2 Feb 2003 07:15:21 -0000
@@ -1,6 +1,6 @@
 /* Match rules with nonterminals for bison,
 
-   Copyright (C) 1984, 1989, 2000, 2001, 2002 Free Software
+   Copyright (C) 1984, 1989, 2000, 2001, 2002, 2003 Free Software
    Foundation, Inc.
 
    This file is part of Bison, the GNU Compiler Compiler.
@@ -65,7 +65,7 @@ void
 derives_compute (void)
 {
   symbol_number i;
-  int r;
+  rule_number r;
   rule **q;
 
   /* DSET[NTERM - NTOKENS] -- A linked list of the numbers of the rules
Index: src/gram.c
===================================================================
RCS file: /cvsroot/bison/bison/src/gram.c,v
retrieving revision 1.50
diff -p -u -r1.50 gram.c
--- src/gram.c  13 Dec 2002 08:22:26 -0000      1.50
+++ src/gram.c  2 Feb 2003 07:15:21 -0000
@@ -1,6 +1,7 @@
 /* Allocate input grammar variables for Bison.
 
-   Copyright (C) 1984, 1986, 1989, 2001, 2002 Free Software Foundation, Inc.
+   Copyright (C) 1984, 1986, 1989, 2001, 2002, 2003 Free Software
+   Foundation, Inc.
 
    This file is part of Bison, the GNU Compiler Compiler.
 
@@ -203,7 +204,7 @@ void
 grammar_rules_partial_print (FILE *out, const char *title,
                             rule_filter filter)
 {
-  int r;
+  rule_number r;
   bool first = true;
   symbol *previous_lhs = NULL;
 
@@ -270,11 +271,11 @@ grammar_dump (FILE *out, const char *tit
     for (i = 0; i < nrules + nuseless_productions; i++)
       {
        rule *rule_i = &rules[i];
-       item_number *r = NULL;
+       item_number *rp = NULL;
        unsigned int rhs_itemno = rule_i->rhs - ritem;
        unsigned int rhs_count = 0;
        /* Find the last RHS index in ritems. */
-       for (r = rule_i->rhs; *r >= 0; ++r)
+       for (rp = rule_i->rhs; *rp >= 0; ++rp)
          ++rhs_count;
        fprintf (out, "%3d (%2d, %2d, %2d, %2u-%2u)   %2d ->",
                 i,
@@ -285,9 +286,9 @@ grammar_dump (FILE *out, const char *tit
                 rhs_itemno + rhs_count - 1,
                 rule_i->lhs->number);
        /* Dumped the RHS. */
-       for (r = rule_i->rhs; *r >= 0; r++)
-         fprintf (out, " %3d", *r);
-       fprintf (out, "  [%d]\n", item_number_as_rule_number (*r));
+       for (rp = rule_i->rhs; *rp >= 0; rp++)
+         fprintf (out, " %3d", *rp);
+       fprintf (out, "  [%d]\n", item_number_as_rule_number (*rp));
       }
   }
   fprintf (out, "\n\n");
Index: src/gram.h
===================================================================
RCS file: /cvsroot/bison/bison/src/gram.h,v
retrieving revision 1.52
diff -p -u -r1.52 gram.h
--- src/gram.h  13 Dec 2002 08:25:31 -0000      1.52
+++ src/gram.h  2 Feb 2003 07:15:21 -0000
@@ -1,6 +1,6 @@
 /* Data definitions for internal representation of Bison's input.
 
-   Copyright (C) 1984, 1986, 1989, 1992, 2001, 2002
+   Copyright (C) 1984, 1986, 1989, 1992, 2001, 2002, 2003
    Free Software Foundation, Inc.
 
    This file is part of Bison, the GNU Compiler Compiler.
@@ -107,8 +107,8 @@
 # include "location.h"
 # include "symtab.h"
 
-# define ISTOKEN(s)    ((s) < ntokens)
-# define ISVAR(s)      ((s) >= ntokens)
+# define ISTOKEN(i)    ((i) < ntokens)
+# define ISVAR(i)      ((i) >= ntokens)
 
 extern int nsyms;
 extern int ntokens;
@@ -127,9 +127,9 @@ extern unsigned int nritems;
    sometimes have to perform the converse transformation.  */
 
 static inline item_number
-symbol_number_as_item_number (symbol_number s)
+symbol_number_as_item_number (symbol_number sym)
 {
-  return s;
+  return sym;
 }
 
 static inline symbol_number
@@ -137,8 +137,6 @@ item_number_as_symbol_number (item_numbe
 {
   return i;
 }
-
-extern symbol_number start_symbol;
 
 /* Rule numbers.  */
 typedef short rule_number;
Index: src/muscle_tab.h
===================================================================
RCS file: /cvsroot/bison/bison/src/muscle_tab.h,v
retrieving revision 1.10
diff -p -u -r1.10 muscle_tab.h
--- src/muscle_tab.h    11 Dec 2002 06:37:17 -0000      1.10
+++ src/muscle_tab.h    2 Feb 2003 07:15:22 -0000
@@ -1,5 +1,5 @@
 /* Muscle table manager for Bison,
-   Copyright (C) 2001, 2002 Free Software Foundation, Inc.
+   Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
 
    This file is part of Bison, the GNU Compiler Compiler.
 
@@ -53,15 +53,15 @@ extern struct obstack muscle_obstack;
 
 #define MUSCLE_OBSTACK_SGROW(Obstack, Value)                   \
 {                                                              \
-  char const *s;                                               \
-  for (s = Value; *s; s++)                                     \
-    switch (*s)                                                        \
+  char const *p;                                               \
+  for (p = Value; *p; p++)                                     \
+    switch (*p)                                                        \
       {                                                                \
       case '$':        obstack_sgrow (Obstack, "$]["); break;          \
       case '@':        obstack_sgrow (Obstack, "@@" ); break;          \
       case '[':        obstack_sgrow (Obstack, "@{" ); break;          \
       case ']':        obstack_sgrow (Obstack, "@}" ); break;          \
-      default: obstack_1grow (Obstack, *s); break;             \
+      default: obstack_1grow (Obstack, *p); break;             \
       }                                                                \
 }
 
Index: src/nullable.c
===================================================================
RCS file: /cvsroot/bison/bison/src/nullable.c,v
retrieving revision 1.39
diff -p -u -r1.39 nullable.c
--- src/nullable.c      13 Dec 2002 08:30:08 -0000      1.39
+++ src/nullable.c      2 Feb 2003 07:15:22 -0000
@@ -1,6 +1,7 @@
 /* Calculate which nonterminals can expand into the null string for Bison.
 
-   Copyright (C) 1984, 1989, 2000, 2001, 2002 Free Software Foundation, Inc.
+   Copyright (C) 1984, 1989, 2000, 2001, 2002, 2003 Free Software
+   Foundation, Inc.
 
    This file is part of Bison, the GNU Compiler Compiler.
 
@@ -81,21 +82,21 @@ nullable_compute (void)
        if (rules_ruleno->rhs[0] >= 0)
          {
            /* This rule has a non empty RHS. */
-           item_number *r = NULL;
+           item_number *rp = NULL;
            int any_tokens = 0;
-           for (r = rules_ruleno->rhs; *r >= 0; ++r)
-             if (ISTOKEN (*r))
+           for (rp = rules_ruleno->rhs; *rp >= 0; ++rp)
+             if (ISTOKEN (*rp))
                any_tokens = 1;
 
            /* This rule has only nonterminals: schedule it for the second
               pass.  */
            if (!any_tokens)
-             for (r = rules_ruleno->rhs; *r >= 0; ++r)
+             for (rp = rules_ruleno->rhs; *rp >= 0; ++rp)
                {
                  rcount[ruleno]++;
-                 p->next = rsets[*r - ntokens];
+                 p->next = rsets[*rp - ntokens];
                  p->value = rules_ruleno;
-                 rsets[*r - ntokens] = p;
+                 rsets[*rp - ntokens] = p;
                  p++;
                }
          }
Index: src/parse-gram.y
===================================================================
RCS file: /cvsroot/bison/bison/src/parse-gram.y,v
retrieving revision 1.38
diff -p -u -r1.38 parse-gram.y
--- src/parse-gram.y    26 Dec 2002 06:51:42 -0000      1.38
+++ src/parse-gram.y    2 Feb 2003 07:15:22 -0000
@@ -1,5 +1,6 @@
 /* Bison Grammar Parser                             -*- C -*-
-   Copyright (C) 2002 Free Software Foundation, Inc.
+
+   Copyright (C) 2002, 2003 Free Software Foundation, Inc.
 
    This file is part of Bison, the GNU Compiler Compiler.
 
@@ -413,8 +414,8 @@ static YYLTYPE
 lloc_default (YYLTYPE const *rhs, int n)
 {
   int i;
-  YYLTYPE r;
-  r.start = r.end = rhs[n].end;
+  YYLTYPE loc;
+  loc.start = loc.end = rhs[n].end;
 
   /* Ignore empty nonterminals the start of the the right-hand side.
      Do not bother to ignore them at the end of the right-hand side,
@@ -422,11 +423,11 @@ lloc_default (YYLTYPE const *rhs, int n)
   for (i = 1; i <= n; i++)
     if (! equal_boundaries (rhs[i].start, rhs[i].end))
       {
-       r.start = rhs[i].start;
+       loc.start = rhs[i].start;
        break;
       }
 
-  return r;
+  return loc;
 }
 
 
Index: src/print.c
===================================================================
RCS file: /cvsroot/bison/bison/src/print.c,v
retrieving revision 1.92
diff -p -u -r1.92 print.c
--- src/print.c 11 Dec 2002 06:42:22 -0000      1.92
+++ src/print.c 2 Feb 2003 07:15:23 -0000
@@ -1,5 +1,6 @@
 /* Print information on generated parser, for bison,
-   Copyright (C) 1984, 1986, 1989, 2000, 2001, 2002
+
+   Copyright (C) 1984, 1986, 1989, 2000, 2001, 2002, 2003
    Free Software Foundation, Inc.
 
    This file is part of Bison, the GNU Compiler Compiler.
@@ -92,7 +93,7 @@ print_core (FILE *out, state *s)
     {
       item_number *sp;
       item_number *sp1;
-      int r;
+      rule_number r;
 
       sp1 = sp = ritem + sitems[i];
 
Index: src/reader.c
===================================================================
RCS file: /cvsroot/bison/bison/src/reader.c,v
retrieving revision 1.230
diff -p -u -r1.230 reader.c
--- src/reader.c        21 Dec 2002 12:56:44 -0000      1.230
+++ src/reader.c        2 Feb 2003 07:15:23 -0000
@@ -1,6 +1,6 @@
 /* Input parser for Bison
 
-   Copyright (C) 1984, 1986, 1989, 1992, 1998, 2000, 2001, 2002
+   Copyright (C) 1984, 1986, 1989, 1992, 1998, 2000, 2001, 2002, 2003
    Free Software Foundation, Inc.
 
    This file is part of Bison, the GNU Compiler Compiler.
@@ -47,14 +47,14 @@ int typed = 0;
 `-----------------------*/
 
 void
-grammar_start_symbol_set (symbol *s, location loc)
+grammar_start_symbol_set (symbol *sym, location loc)
 {
   if (start_flag)
     complain_at (loc, _("multiple %s declarations"), "%start");
   else
     {
       start_flag = 1;
-      startsymbol = s;
+      startsymbol = sym;
       startsymbol_location = loc;
     }
 }
Index: src/reader.h
===================================================================
RCS file: /cvsroot/bison/bison/src/reader.h,v
retrieving revision 1.37
diff -p -u -r1.37 reader.h
--- src/reader.h        30 Dec 2002 22:35:56 -0000      1.37
+++ src/reader.h        2 Feb 2003 07:15:23 -0000
@@ -1,6 +1,6 @@
 /* Input parser for Bison
 
-   Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc.
+   Copyright (C) 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
 
    This file is part of Bison, the GNU Compiler Compiler.
 
@@ -53,10 +53,10 @@ char const *token_name (int);
 
 
 /* From reader.c. */
-void grammar_start_symbol_set (symbol *s, location loc);
+void grammar_start_symbol_set (symbol *sym, location loc);
 void prologue_augment (const char *prologue, location loc);
 void epilogue_augment (const char *epilogue, location loc);
-void grammar_symbol_append (symbol *s, location loc);
+void grammar_symbol_append (symbol *sym, location loc);
 void grammar_rule_begin (symbol *lhs, location loc);
 void grammar_rule_end (location loc);
 void grammar_midrule_action (void);
Index: src/reduce.c
===================================================================
RCS file: /cvsroot/bison/bison/src/reduce.c,v
retrieving revision 1.81
diff -p -u -r1.81 reduce.c
--- src/reduce.c        29 Dec 2002 01:23:02 -0000      1.81
+++ src/reduce.c        2 Feb 2003 07:15:23 -0000
@@ -1,6 +1,7 @@
 /* Grammar reduction for Bison.
 
-   Copyright (C) 1988, 1989, 2000, 2001, 2002 Free Software Foundation, Inc.
+   Copyright (C) 1988, 1989, 2000, 2001, 2002, 2003 Free Software
+   Foundation, Inc.
 
    This file is part of Bison, the GNU Compiler Compiler.
 
@@ -267,7 +268,7 @@ reduce_grammar_tables (void)
 
   /* Adjust NRITEMS.  */
   {
-    int r;
+    rule_number r;
     int length;
     for (r = nrules; r < nrules + nuseless_productions; ++r)
       {
Index: src/scan-gram.l
===================================================================
RCS file: /cvsroot/bison/bison/src/scan-gram.l,v
retrieving revision 1.54
diff -p -u -r1.54 scan-gram.l
--- src/scan-gram.l     31 Dec 2002 02:26:51 -0000      1.54
+++ src/scan-gram.l     2 Feb 2003 07:15:23 -0000
@@ -1,6 +1,6 @@
 /* Bison Grammar Scanner                             -*- C -*-
 
-   Copyright (C) 2002 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2003 Free Software Foundation, Inc.
 
    This file is part of Bison, the GNU Compiler Compiler.
 
@@ -682,14 +682,14 @@ adjust_location (location *loc, char con
 static size_t
 no_cr_read (FILE *fp, char *buf, size_t size)
 {
-  size_t s = fread (buf, 1, size, fp);
-  if (s)
+  size_t bytes_read = fread (buf, 1, size, fp);
+  if (bytes_read)
     {
-      char *w = memchr (buf, '\r', s);
+      char *w = memchr (buf, '\r', bytes_read);
       if (w)
        {
          char const *r = ++w;
-         char const *lim = buf + s;
+         char const *lim = buf + bytes_read;
 
          for (;;)
            {
@@ -718,7 +718,7 @@ no_cr_read (FILE *fp, char *buf, size_t 
        }
     }
 
-  return s;
+  return bytes_read;
 }
 
 
Index: src/state.c
===================================================================
RCS file: /cvsroot/bison/bison/src/state.c,v
retrieving revision 1.28
diff -p -u -r1.28 state.c
--- src/state.c 13 Dec 2002 08:37:52 -0000      1.28
+++ src/state.c 2 Feb 2003 07:15:23 -0000
@@ -1,6 +1,6 @@
 /* Type definitions for nondeterministic finite state machine for Bison.
 
-   Copyright (C) 2001, 2002 Free Software Foundation, Inc.
+   Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
 
    This file is part of Bison, the GNU Compiler Compiler.
 
@@ -49,17 +49,17 @@ transitions_new (int num, state **the_st
 }
 
 
-/*-------------------------------------------------------------------.
-| Return the state such these TRANSITIONS contain a shift/goto to it |
-| on S.  Abort if none found.                                        |
-`-------------------------------------------------------------------*/
+/*-------------------------------------------------------.
+| Return the state such that SHIFTS contain a shift/goto |
+| to it on SYM.  Abort if none found.                    |
+`-------------------------------------------------------*/
 
 state *
-transitions_to (transitions *shifts, symbol_number s)
+transitions_to (transitions *shifts, symbol_number sym)
 {
   int j;
   for (j = 0; j < shifts->num; j++)
-    if (TRANSITION_SYMBOL (shifts, j) == s)
+    if (TRANSITION_SYMBOL (shifts, j) == sym)
       return shifts->states[j];
   abort ();
 }
Index: src/state.h
===================================================================
RCS file: /cvsroot/bison/bison/src/state.h,v
retrieving revision 1.44
diff -p -u -r1.44 state.h
--- src/state.h 13 Dec 2002 08:39:01 -0000      1.44
+++ src/state.h 2 Feb 2003 07:15:23 -0000
@@ -1,6 +1,6 @@
 /* Type definitions for nondeterministic finite state machine for Bison.
 
-   Copyright (C) 1984, 1989, 2000, 2001, 2002 Free Software
+   Copyright (C) 1984, 1989, 2000, 2001, 2002, 2003 Free Software
    Foundation, Inc.
 
    This file is part of Bison, the GNU Compiler Compiler.
@@ -160,9 +160,9 @@ typedef struct
     if (!TRANSITION_IS_DISABLED (Transitions, Iter))
 
 
-/* Return the state such SHIFTS contain a shift/goto to it on S.
+/* Return the state such SHIFTS contain a shift/goto to it on SYM.
    Abort if none found.  */
-struct state *transitions_to (transitions *shifts, symbol_number s);
+struct state *transitions_to (transitions *shifts, symbol_number sym);
 
 
 /*-------.
Index: src/system.h
===================================================================
RCS file: /cvsroot/bison/bison/src/system.h,v
retrieving revision 1.59
diff -p -u -r1.59 system.h
--- src/system.h        3 Jan 2003 14:15:16 -0000       1.59
+++ src/system.h        2 Feb 2003 07:15:23 -0000
@@ -86,7 +86,7 @@ typedef size_t uintptr_t;
 #define REALLOC(P, N) ((P) = xrealloc (P, (N) * sizeof *(P)))
 
 /* From xstrndup.c.  */
-char *xstrndup (const char *s, size_t n);
+char *xstrndup (const char *str, size_t size);
 
 
 /*---------------------.
@@ -98,23 +98,23 @@ char *stpcpy (char *dest, const char *sr
 #endif
 
 #if defined HAVE_DECL_STRCHR && !HAVE_DECL_STRCHR
-char *strchr (const char *s, int c);
+char *strchr (const char *str, int ch);
 #endif
 
 #if defined HAVE_DECL_STRSPN && !HAVE_DECL_STRSPN
-size_t strspn (const char *s, const char *accept);
+size_t strspn (const char *str, const char *accept);
 #endif
 
 #if defined HAVE_DECL_STRNLEN && !HAVE_DECL_STRNLEN
-size_t strnlen (const char *s, size_t maxlen);
+size_t strnlen (const char *str, size_t maxlen);
 #endif
 
 #if defined HAVE_DECL_MEMCHR && !HAVE_DECL_MEMCHR
-void *memchr (const void *s, int c, size_t n);
+void *memchr (const void *str, int ch, size_t size);
 #endif
 
 #if defined HAVE_DECL_MEMRCHR && !HAVE_DECL_MEMRCHR
-void *memrchr (const void *s, int c, size_t n);
+void *memrchr (const void *str, int ch, size_t size);
 #endif
 
 
Index: src/tables.c
===================================================================
RCS file: /cvsroot/bison/bison/src/tables.c,v
retrieving revision 1.16
diff -p -u -r1.16 tables.c
--- src/tables.c        13 Dec 2002 08:45:38 -0000      1.16
+++ src/tables.c        2 Feb 2003 07:15:24 -0000
@@ -1,6 +1,6 @@
 /* Output the generated parsing program for Bison.
 
-   Copyright (C) 1984, 1986, 1989, 1992, 2000, 2001, 2002
+   Copyright (C) 1984, 1986, 1989, 1992, 2000, 2001, 2002, 2003
    Free Software Foundation, Inc.
 
    This file is part of Bison, the GNU Compiler Compiler.
@@ -51,9 +51,9 @@ state_number_to_vector_number (state_num
 }
 
 static inline vector_number
-symbol_number_to_vector_number (symbol_number s)
+symbol_number_to_vector_number (symbol_number sym)
 {
-  return state_number_as_int (nstates) + s - ntokens;
+  return state_number_as_int (nstates) + sym - ntokens;
 }
 
 int nvectors;
Index: src/uniqstr.c
===================================================================
RCS file: /cvsroot/bison/bison/src/uniqstr.c,v
retrieving revision 1.2
diff -p -u -r1.2 uniqstr.c
--- src/uniqstr.c       13 Dec 2002 08:47:15 -0000      1.2
+++ src/uniqstr.c       2 Feb 2003 07:15:24 -0000
@@ -1,6 +1,6 @@
 /* Keep a unique copy of strings.
 
-   Copyright (C) 2002 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2003 Free Software Foundation, Inc.
 
    This file is part of Bison, the GNU Compiler Compiler.
 
@@ -41,13 +41,13 @@ static struct hash_table *uniqstrs_table
 `-------------------------------------*/
 
 uniqstr
-uniqstr_new (char const *s)
+uniqstr_new (char const *str)
 {
-  uniqstr res = hash_lookup (uniqstrs_table, s);
+  uniqstr res = hash_lookup (uniqstrs_table, str);
   if (!res)
     {
       /* First insertion in the hash. */
-      res = xstrdup (s);
+      res = xstrdup (str);
       hash_insert (uniqstrs_table, res);
     }
   return res;
@@ -59,11 +59,11 @@ uniqstr_new (char const *s)
 `------------------------------*/
 
 void
-uniqstr_assert (char const *s)
+uniqstr_assert (char const *str)
 {
-  if (!hash_lookup (uniqstrs_table, s))
+  if (!hash_lookup (uniqstrs_table, str))
     {
-      error (0, 0, "not a uniqstr: %s", quotearg (s));
+      error (0, 0, "not a uniqstr: %s", quotearg (str));
       abort ();
     }
 }
@@ -74,16 +74,16 @@ uniqstr_assert (char const *s)
 `--------------------*/
 
 static inline bool
-uniqstr_print (uniqstr s)
+uniqstr_print (uniqstr ustr)
 {
-  fprintf (stderr, "%s\n", s);
+  fprintf (stderr, "%s\n", ustr);
   return true;
 }
 
 static bool
-uniqstr_print_processor (void *s, void *null ATTRIBUTE_UNUSED)
+uniqstr_print_processor (void *ustr, void *null ATTRIBUTE_UNUSED)
 {
-  return uniqstr_print (s);
+  return uniqstr_print (ustr);
 }
 
 
Index: src/uniqstr.h
===================================================================
RCS file: /cvsroot/bison/bison/src/uniqstr.h,v
retrieving revision 1.2
diff -p -u -r1.2 uniqstr.h
--- src/uniqstr.h       13 Dec 2002 08:48:03 -0000      1.2
+++ src/uniqstr.h       2 Feb 2003 07:15:24 -0000
@@ -1,5 +1,6 @@
 /* Keeping a unique copy of strings.
-   Copyright (C) 2002 Free Software Foundation, Inc.
+
+   Copyright (C) 2002, 2003 Free Software Foundation, Inc.
 
    This file is part of Bison, the GNU Compiler Compiler.
 
@@ -27,11 +28,11 @@
 
 typedef char const *uniqstr;
 
-/* Return the uniqstr for S.  */
-uniqstr uniqstr_new (char const *s);
+/* Return the uniqstr for STR.  */
+uniqstr uniqstr_new (char const *str);
 
-/* Two uniqstr have the same value iff they are the same.  */
-#define UNIQSTR_EQ(S1, S2) ((S1) == (S2))
+/* Two uniqstr values have the same value iff they are the same.  */
+#define UNIQSTR_EQ(USTR1, USTR2) ((USTR1) == (USTR2))
 
 /*--------------------------------------.
 | Initializing, destroying, debugging.  |
@@ -40,8 +41,8 @@ uniqstr uniqstr_new (char const *s);
 /* Create the string table.  */
 void uniqstrs_new (void);
 
-/* Die if S is not a uniqstr.  */
-void uniqstr_assert (char const *s);
+/* Die if STR is not a uniqstr.  */
+void uniqstr_assert (char const *str);
 
 /* Free all the memory allocated for symbols.  */
 void uniqstrs_free (void);
Index: src/vcg.c
===================================================================
RCS file: /cvsroot/bison/bison/src/vcg.c,v
retrieving revision 1.12
diff -p -u -r1.12 vcg.c
--- src/vcg.c   13 Dec 2002 08:49:08 -0000      1.12
+++ src/vcg.c   2 Feb 2003 07:15:24 -0000
@@ -1,6 +1,6 @@
 /* VCG description handler for Bison.
 
-   Copyright (C) 2001, 2002 Free Software Foundation, Inc.
+   Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
 
    This file is part of Bison, the GNU Compiler Compiler.
 
@@ -210,9 +210,9 @@ new_edge (edge *e)
 `----------------------------------------------*/
 
 static const char *
-get_color_str (enum color c)
+get_color_str (enum color color)
 {
-  switch (c)
+  switch (color)
     {
     case white:                return "white";
     case blue:         return "blue";
@@ -251,9 +251,9 @@ get_color_str (enum color c)
 }
 
 static const char *
-get_textmode_str (enum textmode t)
+get_textmode_str (enum textmode textmode)
 {
-  switch (t)
+  switch (textmode)
     {
     case centered:     return "center";
     case left_justify: return "left_justify";
@@ -263,9 +263,9 @@ get_textmode_str (enum textmode t)
 }
 
 static const char *
-get_shape_str (enum shape s)
+get_shape_str (enum shape shape)
 {
-  switch (s)
+  switch (shape)
     {
     case box:          return "box";
     case rhomb:                return "rhomb";
@@ -276,9 +276,9 @@ get_shape_str (enum shape s)
 }
 
 static const char *
-get_layoutalgorithm_str (enum layoutalgorithm l)
+get_layoutalgorithm_str (enum layoutalgorithm layoutalgorithm)
 {
-  switch (l)
+  switch (layoutalgorithm)
     {
     case normal:               return "normal";
     case maxdepth:     return "maxdepth";
@@ -299,9 +299,9 @@ get_layoutalgorithm_str (enum layoutalgo
 }
 
 static const char *
-get_decision_str (enum decision d)
+get_decision_str (enum decision decision)
 {
-  switch (d)
+  switch (decision)
     {
     case no:   return "no";
     case yes:  return "yes";
@@ -310,9 +310,9 @@ get_decision_str (enum decision d)
 }
 
 static const char *
-get_orientation_str (enum orientation o)
+get_orientation_str (enum orientation orientation)
 {
-  switch (o)
+  switch (orientation)
     {
     case top_to_bottom:        return "top_to_bottom";
     case bottom_to_top: return "bottom_to_top";
@@ -323,9 +323,9 @@ get_orientation_str (enum orientation o)
 }
 
 static const char *
-get_node_alignment_str (enum alignment a)
+get_node_alignment_str (enum alignment alignment)
 {
-  switch (a)
+  switch (alignment)
     {
     case center:       return "center";
     case top:          return "top";
@@ -335,9 +335,9 @@ get_node_alignment_str (enum alignment a
 }
 
 static const char *
-get_arrow_mode_str (enum arrow_mode a)
+get_arrow_mode_str (enum arrow_mode arrow_mode)
 {
-  switch (a)
+  switch (arrow_mode)
     {
     case fixed:                return "fixed";
     case free_a:       return "free";
@@ -346,9 +346,9 @@ get_arrow_mode_str (enum arrow_mode a)
 }
 
 static const char *
-get_crossing_type_str (enum crossing_type c)
+get_crossing_type_str (enum crossing_type crossing_type)
 {
-  switch (c)
+  switch (crossing_type)
     {
     case bary:         return "bary";
     case median:       return "median";
@@ -359,9 +359,9 @@ get_crossing_type_str (enum crossing_typ
 }
 
 static const char *
-get_view_str (enum view v)
+get_view_str (enum view view)
 {
-  switch (v)
+  switch (view)
     {
     case normal_view:  return "normal_view";
     case cfish:                return "cfish";
@@ -373,9 +373,9 @@ get_view_str (enum view v)
 }
 
 static const char *
-get_linestyle_str (enum linestyle l)
+get_linestyle_str (enum linestyle linestyle)
 {
-  switch (l)
+  switch (linestyle)
     {
     case continuous:   return "continuous";
     case dashed:       return "dashed";
@@ -386,9 +386,9 @@ get_linestyle_str (enum linestyle l)
 }
 
 static const char *
-get_arrowstyle_str (enum arrowstyle a)
+get_arrowstyle_str (enum arrowstyle arrowstyle)
 {
-  switch (a)
+  switch (arrowstyle)
     {
     case solid:        return "solid";
     case line: return "line";




reply via email to

[Prev in Thread] Current Thread [Next in Thread]