bison-patches
[Top][All Lists]
Advanced

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

remove unportable casts and storage allocation tricks from Bison


From: Paul Eggert
Subject: remove unportable casts and storage allocation tricks from Bison
Date: Fri, 13 Dec 2002 00:53:59 -0800 (PST)

I found some unportable casts, and some unportable storage allocation
tricks, and removed them by installing the following patch.

2002-12-12  Paul Eggert  <address@hidden>

        Remove unportable casts and storage allocation tricks.
        While we're at it, remove almost all casts, since they
        usually aren't needed and are a sign of trouble.
        
        * configure.ac (AC_CHECK_TYPES): Check for uintptr_t.

        * src/derives.c (derives_compute): Do not subtract NTOKENS from
        the pointer DSET returned by malloc; this isn't portable.
        Instead, always use DSET[i - NTOKENS] rather than DSET[i].
        Similarly for DERIVES.
        * src/lalr.c (set_goto_map): Likewise, for GOTO_MAP and TEMP_MAP.
        * src/nullable.c (nullable_compute): Likewise, for RSETS and NULLABLE.
        * src/reduce.c (reduce_grammar_tables): Likewise, for nontermmap
        
        * src/derives.c (derives_compute): Do not bother invoking
        int_of_rule_number, since rule numbers are integers.

        * src/files.c (concat2, tr, compute_base_name): Use xmalloc (N)
        rather than XMALLOC (char, N).

        * src/files.c (filename_split): Rewrite to avoid cast.

        * src/gram.h (symbol_number_as_item_number,
        item_number_as_symbol_number, rule_number_as_item_number,
        item_number_as_rule_number):
        Now inline functions rather than macros, to avoid casts.
        * src/state.h (state_number_as_int): Likewise.
        * src/tables.c (state_number_to_vector_number,
        symbol_number_to_vector_number): Likewise.

        * src/gram.h (int_of_rule_number): Remove; no longer used.

        * src/lalr.c (add_lookback_edge): Use malloc rather than calloc,
        since the resulting storage is always stored into.

        * src/main.c (alloca) [C_ALLOCA]: Add decl here, the only place
        where it's needed.

        * src/muscle_tab.c (muscle_m4_output):
        Now inline.  Return bool, not int.
        * src/state.c (state_compare): Likewise.
        * src/symtab.c (symbol_check_defined,
        symbol_check_alias_consistency, symbol_pack, symbol_translation,
        hash_compare_symbol, hash_symbol):
        Likewise.
        * src/uniqstr.c (uniqstr_print): Likewise.
        * src/muscle_tab.c (muscle_m4_output_processor):
        New function, to avoid casts.
        * src/state.c (state_comparator, stage_hasher): Likewise.
        * src/symtab.c (symbol_check_defined_processor,
        symbol_check_alias_consistency_processor, symbol_pack_processor,
        symbol_translation_processor, hash_symbol_comparator,
        hash_symbol_hasher): Likewise.
        * src/uniqstr.c (uniqstr_print_processor): Likewise.
        * src/muscle_tab.c (muscles_m4_output):
        Use new functions instead of casting old functions unportably.
        * src/state.c (state_hash_new): Likewise.
        * src/symtab.c (symbols_new, symbols_do, symbols_check_defined,
        symbols_token_translations_init):
        Likewise.
        * src/uniqstr.c (uniqstrs_new, hash_initialize, uniqstrs_do): Likewise.

        * src/output.c (GENERATE_MUSCLE_INSERT_TABLE): Use long local
        var instead of casting to long, to avoid casts.
        (prepare_states): Use MALLOC rather than alloca, so that we don't
        have to worry about alloca.
        * src/state.c (state_hash_lookup): Likewise.

        * src/scan-gram.l (<SC_ESCAPED_CHARACTER>"'"): Use unsigned char
        local var instead of casting to unsigned char, to avoid casts.

        * src/state.c (TRANSITIONS_ALLOC, ERRS_ALLOC, REDUCTIONS_ALLOC,
        STATE_ALLOC): Remove.
        (transitions_new, errs_new, reductions_new, state_new): Use malloc
        rather than calloc, and use offsetof to avoid allocating slightly
        too much storage.
        (state_new): Initialize all members.

        * src/state.c (state_hash): Use unsigned accumulator, not signed.

        * src/symtab.c (symbol_free): Remove; unused.
        (symbol_get): Remove cast in lhs of assignment.
        (symbols_do): Now static.  Accept generic arguments, not
        hashing-related ones.

        * src/symtab.h: (NUMBER_UNDEFINED): Remove unnecessary cast.
        (symbol_processor): Remove.
        (symbols_do): Remove decl; now static.

        * src/system.h (alloca): Remove; decl no longer needed.
        (<stddef.h>): Include, for offsetof.
        (<inttypes.>, <stdint.h>): Include if available.
        (uintptr_t): New type, if system lacks it.
        (CALLOC, MALLOC, REALLOC): New macros.
        All uses of XCALLOC, XMALLOC, and XREALLOC changed to use these
        new macros.

        * src/tables.c (table_size): Now int, to pacify GCC.
        (table_grow, table_ninf_remap): Use signed table size.
        (save_row): Don't bother initializing locals when not needed.
        (default_goto, goto_actions, pack_vector): Remove unnecessary casts.
        * src/uniqstr.c (hash_compare_uniqstr):  Likewise.

        * src/vcg.h: Correct misspellings.

        * src/vcg_defaults.h (G_CMAX): Now INT_MAX.

Index: configure.ac
===================================================================
RCS file: /cvsroot/bison/bison/configure.ac,v
retrieving revision 1.24
retrieving revision 1.25
diff -p -u -r1.24 -r1.25
--- configure.ac        2 Dec 2002 18:19:51 -0000       1.24
+++ configure.ac        13 Dec 2002 04:40:56 -0000      1.25
@@ -77,6 +77,9 @@ AC_HEADER_STDBOOL
 # Checks for compiler characteristics.
 AC_C_INLINE
 
+# Checks for types.
+AC_CHECK_TYPES([uintptr_t])
+
 # Checks for library functions.
 AC_FUNC_ALLOCA
 AC_FUNC_OBSTACK
Index: src/LR0.c
===================================================================
RCS file: /cvsroot/bison/bison/src/LR0.c,v
retrieving revision 1.85
diff -p -u -r1.85 LR0.c
--- src/LR0.c   11 Dec 2002 05:29:17 -0000      1.85
+++ src/LR0.c   13 Dec 2002 08:16:55 -0000
@@ -1,4 +1,4 @@
-/* Generate the nondeterministic finite state machine for bison,
+/* Generate the nondeterministic finite state machine for Bison.
 
    Copyright (C) 1984, 1986, 1989, 2000, 2001, 2002 Free Software
    Foundation, Inc.
@@ -59,7 +59,7 @@ static state_list *last_state = NULL;
 static state *
 state_list_append (symbol_number sym, size_t core_size, item_number *core)
 {
-  state_list *node = XMALLOC (state_list, 1);
+  state_list *node = MALLOC (node, 1);
   state *s = state_new (sym, core_size, core);
 
   if (trace_flag & trace_automaton)
@@ -106,7 +106,7 @@ allocate_itemsets (void)
      browsed too, hence we need to allocate room for _all_ the
      symbols.  */
   int count = 0;
-  short *symbol_count = XCALLOC (short, nsyms + nuseless_nonterminals);
+  short *symbol_count = CALLOC (symbol_count, nsyms + nuseless_nonterminals);
 
   for (r = 0; r < nrules; ++r)
     for (rhsp = rules[r].rhs; *rhsp >= 0; ++rhsp)
@@ -121,9 +121,9 @@ allocate_itemsets (void)
      appears as an item, which is SYMBOL_COUNT[S].
      We allocate that much space for each symbol.  */
 
-  kernel_base = XCALLOC (item_number *, nsyms);
+  CALLOC (kernel_base, nsyms);
   if (count)
-    kernel_items = XCALLOC (item_number, count);
+    CALLOC (kernel_items, count);
 
   count = 0;
   for (i = 0; i < nsyms; i++)
@@ -133,7 +133,7 @@ allocate_itemsets (void)
     }
 
   free (symbol_count);
-  kernel_size = XCALLOC (int, nsyms);
+  CALLOC (kernel_size, nsyms);
 }
 
 
@@ -142,10 +142,10 @@ allocate_storage (void)
 {
   allocate_itemsets ();
 
-  shiftset = XCALLOC (state *, nsyms);
-  redset = XCALLOC (rule *, nrules);
+  CALLOC (shiftset, nsyms);
+  CALLOC (redset, nrules);
   state_hash_new ();
-  shift_symbol = XCALLOC (symbol_number, nsyms);
+  CALLOC (shift_symbol, nsyms);
 }
 
 
@@ -296,7 +296,7 @@ save_reductions (state *s)
 static void
 set_states (void)
 {
-  states = XCALLOC (state *, nstates);
+  CALLOC (states, nstates);
 
   while (first_state)
     {
Index: src/closure.c
===================================================================
RCS file: /cvsroot/bison/bison/src/closure.c,v
retrieving revision 1.65
diff -p -u -r1.65 closure.c
--- src/closure.c       11 Dec 2002 05:32:51 -0000      1.65
+++ src/closure.c       13 Dec 2002 08:16:55 -0000
@@ -128,9 +128,9 @@ set_firsts (void)
   firsts = bitsetv_create (nvars, nvars, BITSET_FIXED);
 
   for (i = ntokens; i < nsyms; i++)
-    for (j = 0; derives[i][j]; ++j)
+    for (j = 0; derives[i - ntokens][j]; ++j)
       {
-       item_number sym = derives[i][j]->rhs[0];
+       item_number sym = derives[i - ntokens][j]->rhs[0];
        if (ISVAR (sym))
          bitset_set (FIRSTS (i), sym - ntokens);
       }
@@ -168,8 +168,8 @@ set_fderives (void)
   for (i = ntokens; i < nsyms; ++i)
     for (j = ntokens; j < nsyms; ++j)
       if (bitset_test (FIRSTS (i), j - ntokens))
-       for (k = 0; derives[j][k]; ++k)
-         bitset_set (FDERIVES (i), derives[j][k]->number);
+       for (k = 0; derives[j - ntokens][k]; ++k)
+         bitset_set (FDERIVES (i), derives[j - ntokens][k]->number);
 
   if (trace_flag & trace_sets)
     print_fderives ();
@@ -182,7 +182,7 @@ set_fderives (void)
 void
 new_closure (int n)
 {
-  itemset = XCALLOC (item_number, n);
+  CALLOC (itemset, n);
 
   ruleset = bitset_create (nrules, BITSET_FIXED);
 
Index: src/conflicts.c
===================================================================
RCS file: /cvsroot/bison/bison/src/conflicts.c,v
retrieving revision 1.98
diff -p -u -r1.98 conflicts.c
--- src/conflicts.c     11 Dec 2002 06:25:26 -0000      1.98
+++ src/conflicts.c     13 Dec 2002 08:16:55 -0000
@@ -304,9 +304,9 @@ conflicts_solve (void)
 {
   state_number i;
   /* List of lookaheads on which we explicitly raise a syntax error.  */
-  symbol **errors = XMALLOC (symbol *, ntokens + 1);
+  symbol **errors = MALLOC (errors, ntokens + 1);
 
-  conflicts = XCALLOC (char, nstates);
+  CALLOC (conflicts, nstates);
   shiftset = bitset_create (ntokens, BITSET_FIXED);
   lookaheadset = bitset_create (ntokens, BITSET_FIXED);
   obstack_init (&solved_conflicts_obstack);
Index: src/derives.c
===================================================================
RCS file: /cvsroot/bison/bison/src/derives.c,v
retrieving revision 1.38
diff -p -u -r1.38 derives.c
--- src/derives.c       11 Dec 2002 06:26:06 -0000      1.38
+++ src/derives.c       13 Dec 2002 08:16:55 -0000
@@ -50,7 +50,7 @@ print_derives (void)
     {
       rule **rp;
       fprintf (stderr, "\t%s derives\n", symbols[i]->tag);
-      for (rp = derives[i]; *rp; ++rp)
+      for (rp = derives[i - ntokens]; *rp; ++rp)
        {
          fprintf (stderr, "\t\t%3d ", (*rp)->user_number);
          rule_rhs_print (*rp, stderr);
@@ -68,35 +68,35 @@ derives_compute (void)
   int r;
   rule **q;
 
-  /* DSET[NTERM] -- A linked list of the numbers of the rules whose
-     LHS is NTERM.  */
-  rule_list **dset = XCALLOC (rule_list *, nvars) - ntokens;
+  /* DSET[NTERM - NTOKENS] -- A linked list of the numbers of the rules
+     whose LHS is NTERM.  */
+  rule_list **dset = CALLOC (dset, nvars);
 
   /* DELTS[RULE] -- There are NRULES rule number to attach to nterms.
      Instead of performing NRULES allocations for each, have an array
      indexed by rule numbers.  */
-  rule_list *delts = XCALLOC (rule_list, nrules);
+  rule_list *delts = CALLOC (delts, nrules);
 
   for (r = nrules - 1; r >= 0; --r)
     {
       symbol_number lhs = rules[r].lhs->number;
       rule_list *p = &delts[r];
       /* A new LHS is found.  */
-      p->next = dset[lhs];
+      p->next = dset[lhs - ntokens];
       p->value = &rules[r];
-      dset[lhs] = p;
+      dset[lhs - ntokens] = p;
     }
 
   /* DSET contains what we need under the form of a linked list.  Make
      it a single array.  */
 
-  derives = XCALLOC (rule **, nvars) - ntokens;
-  q = XCALLOC (rule *, nvars + int_of_rule_number (nrules));
+  CALLOC (derives, nvars);
+  CALLOC (q, nvars + nrules);
 
   for (i = ntokens; i < nsyms; i++)
     {
-      rule_list *p = dset[i];
-      derives[i] = q;
+      rule_list *p = dset[i - ntokens];
+      derives[i - ntokens] = q;
       while (p)
        {
          *q++ = p->value;
@@ -108,7 +108,7 @@ derives_compute (void)
   if (trace_flag & trace_sets)
     print_derives ();
 
-  free (dset + ntokens);
+  free (dset);
   free (delts);
 }
 
@@ -116,6 +116,6 @@ derives_compute (void)
 void
 derives_free (void)
 {
-  XFREE (derives[ntokens]);
-  XFREE (derives + ntokens);
+  XFREE (derives[0]);
+  XFREE (derives);
 }
Index: src/files.c
===================================================================
RCS file: /cvsroot/bison/bison/src/files.c,v
retrieving revision 1.82
retrieving revision 1.83
diff -p -u -r1.82 -r1.83
--- src/files.c 11 Dec 2002 06:28:25 -0000      1.82
+++ src/files.c 13 Dec 2002 07:52:29 -0000      1.83
@@ -1,4 +1,5 @@
-/* Open and close files for bison,
+/* Open and close files for Bison.
+
    Copyright (C) 1984, 1986, 1989, 1992, 2000, 2001, 2002
    Free Software Foundation, Inc.
 
@@ -75,7 +76,7 @@ static char *
 concat2 (char const *str1, char const *str2)
 {
   size_t len = strlen (str1) + strlen (str2);
-  char *res = XMALLOC (char, len + 1);
+  char *res = xmalloc (len + 1);
   char *cp;
   cp = stpcpy (res, str1);
   cp = stpcpy (cp, str2);
@@ -127,9 +128,7 @@ static char *
 tr (const char *in, char from, char to)
 {
   char *temp;
-  char *out;
-
-  out = XMALLOC (char, strlen (in) + 1);
+  char *out = xmalloc (strlen (in) + 1);
 
   for (temp = out; *in; in++, out++)
     if (*in == from)
@@ -201,13 +200,17 @@ filename_split (const char *filename,
   *ext = strrchr (*base, '.');
   *tab = NULL;
 
-  /* If there is an exentension, check if there is a `.tab' part right
+  /* If there is an extension, check if there is a `.tab' part right
      before.  */
-  if (*ext
-      && (*ext - *base) > (int) strlen (".tab")
-      && (!strncmp (*ext - strlen (".tab"), ".tab", strlen (".tab"))
-         || !strncmp (*ext - strlen ("_tab"), "_tab", strlen ("_tab"))))
-    *tab = *ext - strlen (".tab");
+  if (*ext)
+    {
+      size_t baselen = *ext - *base;
+      size_t dottablen = 4;
+      if (dottablen < baselen
+         && (strncmp (*ext - dottablen, ".tab", dottablen) == 0
+             || strncmp (*ext - dottablen, "_tab", dottablen) == 0))
+       *tab = *ext - dottablen;
+    }
 }
 
 
@@ -272,8 +275,7 @@ compute_base_names (void)
                      (strlen (base) - (ext ? strlen (ext) : 0)));
        }
 
-      full_base_name = XMALLOC (char,
-                               strlen (short_base_name)
+      full_base_name = xmalloc (strlen (short_base_name)
                                + strlen (TAB_EXT) + 1);
       stpcpy (stpcpy (full_base_name, short_base_name), TAB_EXT);
 
Index: src/gram.h
===================================================================
RCS file: /cvsroot/bison/bison/src/gram.h,v
retrieving revision 1.51
diff -p -u -r1.51 gram.h
--- src/gram.h  11 Dec 2002 06:33:22 -0000      1.51
+++ src/gram.h  13 Dec 2002 08:16:55 -0000
@@ -124,17 +124,36 @@ extern unsigned int nritems;
 
    Therefore, a symbol_number must be a valid item_number, and we
    sometimes have to perform the converse transformation.  */
-# define symbol_number_as_item_number(Tok) ((item_number) (Tok))
-# define item_number_as_symbol_number(Ite) ((symbol_number) (Ite))
+
+static inline item_number
+symbol_number_as_item_number (symbol_number s)
+{
+  return s;
+}
+
+static inline symbol_number
+item_number_as_symbol_number (item_number i)
+{
+  return i;
+}
 
 extern symbol_number start_symbol;
 
 /* Rule numbers.  */
 typedef short rule_number;
 extern rule_number nrules;
-# define int_of_rule_number(RNum) ((int) (RNum))
-# define rule_number_as_item_number(RNum) ((item_number) (- RNum - 1))
-# define item_number_as_rule_number(INum) ((rule_number) (- INum - 1))
+
+static inline item_number
+rule_number_as_item_number (rule_number r)
+{
+  return -1 - r;
+}
+
+static inline rule_number
+item_number_as_rule_number (item_number i)
+{
+  return -1 - i;
+}
 
 
 /*--------.
Index: src/lalr.c
===================================================================
RCS file: /cvsroot/bison/bison/src/lalr.c,v
retrieving revision 1.95
diff -p -u -r1.95 lalr.c
--- src/lalr.c  11 Dec 2002 06:33:59 -0000      1.95
+++ src/lalr.c  13 Dec 2002 08:16:55 -0000
@@ -1,4 +1,5 @@
-/* Compute look-ahead criteria for bison,
+/* Compute look-ahead criteria for Bison.
+
    Copyright (C) 1984, 1986, 1989, 2000, 2001, 2002
    Free Software Foundation, Inc.
 
@@ -79,8 +80,8 @@ set_goto_map (void)
   state_number s;
   goto_number *temp_map;
 
-  goto_map = XCALLOC (goto_number, nvars + 1) - ntokens;
-  temp_map = XCALLOC (goto_number, nvars + 1) - ntokens;
+  CALLOC (goto_map, nvars + 1);
+  CALLOC (temp_map, nvars + 1);
 
   ngotos = 0;
   for (s = 0; s < nstates; ++s)
@@ -92,7 +93,7 @@ set_goto_map (void)
          if (ngotos >= GOTO_NUMBER_MAXIMUM)
            abort ();
          ngotos++;
-         goto_map[TRANSITION_SYMBOL (sp, i)]++;
+         goto_map[TRANSITION_SYMBOL (sp, i) - ntokens]++;
        }
     }
 
@@ -101,19 +102,19 @@ set_goto_map (void)
     int i;
     for (i = ntokens; i < nsyms; i++)
       {
-       temp_map[i] = k;
-       k += goto_map[i];
+       temp_map[i - ntokens] = k;
+       k += goto_map[i - ntokens];
       }
 
     for (i = ntokens; i < nsyms; i++)
-      goto_map[i] = temp_map[i];
+      goto_map[i - ntokens] = temp_map[i - ntokens];
 
-    goto_map[nsyms] = ngotos;
-    temp_map[nsyms] = ngotos;
+    goto_map[nsyms - ntokens] = ngotos;
+    temp_map[nsyms - ntokens] = ngotos;
   }
 
-  from_state = XCALLOC (state_number, ngotos);
-  to_state = XCALLOC (state_number, ngotos);
+  CALLOC (from_state, ngotos);
+  CALLOC (to_state, ngotos);
 
   for (s = 0; s < nstates; ++s)
     {
@@ -121,13 +122,13 @@ set_goto_map (void)
       int i;
       for (i = sp->num - 1; i >= 0 && TRANSITION_IS_GOTO (sp, i); --i)
        {
-         int k = temp_map[TRANSITION_SYMBOL (sp, i)]++;
+         int k = temp_map[TRANSITION_SYMBOL (sp, i) - ntokens]++;
          from_state[k] = s;
          to_state[k] = sp->states[i]->number;
        }
     }
 
-  XFREE (temp_map + ntokens);
+  XFREE (temp_map);
 }
 
 
@@ -144,8 +145,8 @@ map_goto (state_number s0, symbol_number
   int middle;
   state_number s;
 
-  low = goto_map[sym];
-  high = goto_map[sym + 1] - 1;
+  low = goto_map[sym - ntokens];
+  high = goto_map[sym - ntokens + 1] - 1;
 
   for (;;)
     {
@@ -166,8 +167,8 @@ map_goto (state_number s0, symbol_number
 static void
 initialize_F (void)
 {
-  goto_number **reads = XCALLOC (goto_number *, ngotos);
-  goto_number *edge = XCALLOC (goto_number, ngotos + 1);
+  goto_number **reads = CALLOC (reads, ngotos);
+  goto_number *edge = CALLOC (edge, ngotos + 1);
   int nedges = 0;
 
   int i;
@@ -186,13 +187,13 @@ initialize_F (void)
       for (; j < sp->num; j++)
        {
          symbol_number sym = TRANSITION_SYMBOL (sp, j);
-         if (nullable[sym])
+         if (nullable[sym - ntokens])
            edge[nedges++] = map_goto (stateno, sym);
        }
 
       if (nedges)
        {
-         reads[i] = XCALLOC (goto_number, nedges + 1);
+         CALLOC (reads[i], nedges + 1);
          memcpy (reads[i], edge, nedges * sizeof (edge[0]));
          reads[i][nedges] = -1;
          nedges = 0;
@@ -213,7 +214,7 @@ static void
 add_lookback_edge (state *s, rule *r, int gotono)
 {
   int ri = state_reduction_find (s, r);
-  goto_list *sp = XCALLOC (goto_list, 1);
+  goto_list *sp = MALLOC (sp, 1);
   sp->next = lookback[(s->reductions->lookaheads - LA) + ri];
   sp->value = gotono;
   lookback[(s->reductions->lookaheads - LA) + ri] = sp;
@@ -224,11 +225,11 @@ add_lookback_edge (state *s, rule *r, in
 static void
 build_relations (void)
 {
-  goto_number *edge = XCALLOC (goto_number, ngotos + 1);
-  state_number *states1 = XCALLOC (state_number, ritem_longest_rhs () + 1);
+  goto_number *edge = CALLOC (edge, ngotos + 1);
+  state_number *states1 = CALLOC (states1, ritem_longest_rhs () + 1);
   int i;
 
-  includes = XCALLOC (goto_number *, ngotos);
+  CALLOC (includes, ngotos);
 
   for (i = 0; i < ngotos; i++)
     {
@@ -236,7 +237,7 @@ build_relations (void)
       symbol_number symbol1 = states[to_state[i]]->accessing_symbol;
       rule **rulep;
 
-      for (rulep = derives[symbol1]; *rulep; rulep++)
+      for (rulep = derives[symbol1 - ntokens]; *rulep; rulep++)
        {
          int done;
          int length = 1;
@@ -266,7 +267,7 @@ build_relations (void)
                  /* Downcasting from item_number to symbol_number.  */
                  edge[nedges++] = map_goto (states1[--length],
                                             item_number_as_symbol_number 
(*rp));
-                 if (nullable[*rp])
+                 if (nullable[*rp - ntokens])
                    done = 0;
                }
            }
@@ -275,7 +276,7 @@ build_relations (void)
       if (nedges)
        {
          int j;
-         includes[i] = XCALLOC (goto_number, nedges + 1);
+         CALLOC (includes[i], nedges + 1);
          for (j = 0; j < nedges; j++)
            includes[i][j] = edge[j];
          includes[i][nedges] = -1;
@@ -377,7 +378,7 @@ initialize_LA (void)
     nLA = 1;
 
   pLA = LA = bitsetv_create (nLA, ntokens, BITSET_FIXED);
-  lookback = XCALLOC (goto_list *, nLA);
+  CALLOC (lookback, nLA);
 
   /* Initialize the members LOOKAHEADS for each state which reductions
      require lookaheads.  */
Index: src/main.c
===================================================================
RCS file: /cvsroot/bison/bison/src/main.c,v
retrieving revision 1.77
diff -p -u -r1.77 main.c
--- src/main.c  11 Dec 2002 06:36:08 -0000      1.77
+++ src/main.c  13 Dec 2002 08:16:55 -0000
@@ -173,7 +173,10 @@ main (int argc, char *argv[])
   /* If using alloca.c, flush the alloca'ed memory for the benefit of
      people running Bison as a library in IDEs.  */
 #if C_ALLOCA
-  alloca (0);
+  {
+    extern void *alloca (size_t);
+    alloca (0);
+  }
 #endif
   timevar_pop (TV_FREE);
 
Index: src/muscle_tab.c
===================================================================
RCS file: /cvsroot/bison/bison/src/muscle_tab.c,v
retrieving revision 1.29
diff -p -u -r1.29 muscle_tab.c
--- src/muscle_tab.c    11 Dec 2002 06:36:41 -0000      1.29
+++ src/muscle_tab.c    13 Dec 2002 08:16:55 -0000
@@ -106,7 +106,7 @@ muscle_insert (const char *key, char *va
   if (!entry)
     {
       /* First insertion in the hash. */
-      entry = XMALLOC (muscle_entry, 1);
+      MALLOC (entry, 1);
       entry->key = key;
       hash_insert (muscle_table, entry);
     }
@@ -132,7 +132,7 @@ muscle_grow (const char *key, const char
   if (!entry)
     {
       /* First insertion in the hash. */
-      entry = XMALLOC (muscle_entry, 1);
+      MALLOC (entry, 1);
       entry->key = key;
       hash_insert (muscle_table, entry);
       entry->value = xstrdup (val);
@@ -191,12 +191,18 @@ muscle_find (const char *key)
 | Output the definition of ENTRY as a m4_define.  |
 `------------------------------------------------*/
 
-static int
+static inline bool
 muscle_m4_output (muscle_entry *entry, FILE *out)
 {
   fprintf (out, "m4_define([b4_%s],\n", entry->key);
   fprintf (out, "[[%s]])\n\n\n", entry->value);
-  return 1;
+  return true;
+}
+
+static bool
+muscle_m4_output_processor (void *entry, void *out)
+{
+  return muscle_m4_output (entry, out);
 }
 
 
@@ -208,7 +214,5 @@ muscle_m4_output (muscle_entry *entry, F
 void
 muscles_m4_output (FILE *out)
 {
-  hash_do_for_each (muscle_table,
-                   (Hash_processor) muscle_m4_output,
-                   out);
+  hash_do_for_each (muscle_table, muscle_m4_output_processor, out);
 }
Index: src/nullable.c
===================================================================
RCS file: /cvsroot/bison/bison/src/nullable.c,v
retrieving revision 1.38
diff -p -u -r1.38 nullable.c
--- src/nullable.c      11 Dec 2002 06:38:17 -0000      1.38
+++ src/nullable.c      13 Dec 2002 08:16:55 -0000
@@ -1,4 +1,5 @@
-/* Part of the bison parser generator,
+/* Calculate which nonterminals can expand into the null string for Bison.
+
    Copyright (C) 1984, 1989, 2000, 2001, 2002 Free Software Foundation, Inc.
 
    This file is part of Bison, the GNU Compiler Compiler.
@@ -46,7 +47,8 @@ nullable_print (FILE *out)
   int i;
   fputs ("NULLABLE\n", out);
   for (i = ntokens; i < nsyms; i++)
-    fprintf (out, "\t%s: %s\n", symbols[i]->tag, nullable[i] ? "yes" : "no");
+    fprintf (out, "\t%s: %s\n", symbols[i]->tag,
+            nullable[i - ntokens] ? "yes" : "no");
   fputs ("\n\n", out);
 }
 
@@ -58,16 +60,16 @@ nullable_compute (void)
   symbol_number *s2;
   rule_list *p;
 
-  symbol_number *squeue = XCALLOC (symbol_number, nvars);
-  short *rcount = XCALLOC (short, nrules);
+  symbol_number *squeue = CALLOC (squeue, nvars);
+  short *rcount = CALLOC (rcount, nrules);
   /* RITEM contains all the rules, including useless productions.
      Hence we must allocate room for useless nonterminals too.  */
-  rule_list **rsets = XCALLOC (rule_list *, nvars) - ntokens;
+  rule_list **rsets = CALLOC (rsets, nvars);
   /* This is said to be more elements than we actually use.
      Supposedly NRITEMS - NRULES is enough.  But why take the risk?  */
-  rule_list *relts = XCALLOC (rule_list, nritems + nvars + 1);
+  rule_list *relts = CALLOC (relts, nritems + nvars + 1);
 
-  nullable = XCALLOC (bool, nvars) - ntokens;
+  CALLOC (nullable, nvars);
 
   s1 = s2 = squeue;
   p = relts;
@@ -91,9 +93,9 @@ nullable_compute (void)
              for (r = rules_ruleno->rhs; *r >= 0; ++r)
                {
                  rcount[ruleno]++;
-                 p->next = rsets[*r];
+                 p->next = rsets[*r - ntokens];
                  p->value = rules_ruleno;
-                 rsets[*r] = p;
+                 rsets[*r - ntokens] = p;
                  p++;
                }
          }
@@ -102,29 +104,30 @@ nullable_compute (void)
            /* This rule has an empty RHS. */
            if (item_number_as_rule_number (rules_ruleno->rhs[0]) != ruleno)
              abort ();
-           if (rules_ruleno->useful && !nullable[rules_ruleno->lhs->number])
+           if (rules_ruleno->useful
+               && ! nullable[rules_ruleno->lhs->number - ntokens])
              {
-               nullable[rules_ruleno->lhs->number] = 1;
+               nullable[rules_ruleno->lhs->number - ntokens] = 1;
                *s2++ = rules_ruleno->lhs->number;
              }
          }
       }
 
   while (s1 < s2)
-    for (p = rsets[*s1++]; p; p = p->next)
+    for (p = rsets[*s1++ - ntokens]; p; p = p->next)
       {
        rule *r = p->value;
        if (--rcount[r->number] == 0)
-         if (r->useful && !nullable[r->lhs->number])
+         if (r->useful && ! nullable[r->lhs->number - ntokens])
            {
-             nullable[r->lhs->number] = 1;
+             nullable[r->lhs->number - ntokens] = 1;
              *s2++ = r->lhs->number;
            }
       }
 
   XFREE (squeue);
   XFREE (rcount);
-  XFREE (rsets + ntokens);
+  XFREE (rsets);
   XFREE (relts);
 
   if (trace_flag & trace_sets)
@@ -135,5 +138,5 @@ nullable_compute (void)
 void
 nullable_free (void)
 {
-  XFREE (nullable + ntokens);
+  XFREE (nullable);
 }
Index: src/output.c
===================================================================
RCS file: /cvsroot/bison/bison/src/output.c,v
retrieving revision 1.214
diff -p -u -r1.214 output.c
--- src/output.c        11 Dec 2002 06:39:20 -0000      1.214
+++ src/output.c        13 Dec 2002 08:16:55 -0000
@@ -67,6 +67,8 @@ Name (const char *name,                                       
                \
 {                                                                      \
   Type min = first;                                                    \
   Type max = first;                                                    \
+  long int lmin;                                                       \
+  long int lmax;                                                       \
   int i;                                                               \
   int j = 1;                                                           \
                                                                        \
@@ -90,15 +92,15 @@ Name (const char *name,                                     
                \
   obstack_1grow (&format_obstack, 0);                                  \
   muscle_insert (name, obstack_finish (&format_obstack));              \
                                                                        \
+  lmin = min;                                                          \
+  lmax = max;                                                          \
   /* Build `NAME_min' and `NAME_max' in the obstack. */                        
\
   obstack_fgrow1 (&format_obstack, "%s_min", name);                    \
   obstack_1grow (&format_obstack, 0);                                  \
-  MUSCLE_INSERT_LONG_INT (obstack_finish (&format_obstack),            \
-                         (long int) min);                              \
+  MUSCLE_INSERT_LONG_INT (obstack_finish (&format_obstack), lmin);     \
   obstack_fgrow1 (&format_obstack, "%s_max", name);                    \
   obstack_1grow (&format_obstack, 0);                                  \
-  MUSCLE_INSERT_LONG_INT (obstack_finish (&format_obstack),            \
-                         (long int) max);                              \
+  MUSCLE_INSERT_LONG_INT (obstack_finish (&format_obstack), lmax);     \
 }
 
 GENERATE_MUSCLE_INSERT_TABLE(muscle_insert_unsigned_int_table, unsigned int)
@@ -190,7 +192,7 @@ prepare_symbols (void)
   /* Output YYTOKNUM. */
   {
     int i;
-    int *values = XCALLOC (int, ntokens);
+    int *values = MALLOC (values, ntokens);
     for (i = 0; i < ntokens; ++i)
       values[i] = symbols[i]->user_token_number;
     muscle_insert_int_table ("toknum", values,
@@ -210,13 +212,13 @@ prepare_rules (void)
 {
   rule_number r;
   unsigned int i = 0;
-  item_number *rhs = XMALLOC (item_number, nritems);
-  unsigned int *prhs = XMALLOC (unsigned int, nrules);
-  unsigned int *rline = XMALLOC (unsigned int, nrules);
-  symbol_number *r1 = XMALLOC (symbol_number, nrules);
-  unsigned int *r2 = XMALLOC (unsigned int, nrules);
-  short *dprec = XMALLOC (short, nrules);
-  short *merger = XMALLOC (short, nrules);
+  item_number *rhs = MALLOC (rhs, nritems);
+  unsigned int *prhs = MALLOC (prhs, nrules);
+  unsigned int *rline = MALLOC (rline, nrules);
+  symbol_number *r1 = MALLOC (r1, nrules);
+  unsigned int *r2 = MALLOC (r2, nrules);
+  short *dprec = MALLOC (dprec, nrules);
+  short *merger = MALLOC (merger, nrules);
 
   for (r = 0; r < nrules; ++r)
     {
@@ -269,12 +271,12 @@ static void
 prepare_states (void)
 {
   state_number i;
-  symbol_number *values =
-    (symbol_number *) alloca (sizeof (symbol_number) * nstates);
+  symbol_number *values = MALLOC (values, nstates);
   for (i = 0; i < nstates; ++i)
     values[i] = states[i]->accessing_symbol;
   muscle_insert_symbol_number_table ("stos", values,
                                     0, 1, nstates);
+  free (values);
 
   MUSCLE_INSERT_INT ("last", high);
   MUSCLE_INSERT_INT ("final_state_number", final_state->number);
Index: src/reader.c
===================================================================
RCS file: /cvsroot/bison/bison/src/reader.c,v
retrieving revision 1.228
diff -p -u -r1.228 reader.c
--- src/reader.c        11 Dec 2002 06:43:45 -0000      1.228
+++ src/reader.c        13 Dec 2002 08:16:56 -0000
@@ -127,7 +127,7 @@ get_merge_function (uniqstr name, uniqst
       break;
   if (syms->next == NULL)
     {
-      syms->next = XMALLOC (merger_list, 1);
+      MALLOC (syms->next, 1);
       syms->next->name = uniqstr_new (name);
       syms->next->type = uniqstr_new (type);
       syms->next->next = NULL;
@@ -406,8 +406,8 @@ packgram (void)
   rule_number ruleno = 0;
   symbol_list *p = grammar;
 
-  ritem = XCALLOC (item_number, nritems);
-  rules = XCALLOC (rule, nrules);
+  CALLOC (ritem, nritems);
+  CALLOC (rules, nrules);
 
   while (p)
     {
Index: src/reduce.c
===================================================================
RCS file: /cvsroot/bison/bison/src/reduce.c,v
retrieving revision 1.79
diff -p -u -r1.79 reduce.c
--- src/reduce.c        11 Dec 2002 06:45:06 -0000      1.79
+++ src/reduce.c        13 Dec 2002 08:16:56 -0000
@@ -245,7 +245,7 @@ reduce_grammar_tables (void)
   {
     int useful = 0;
     int useless = nrules - nuseless_productions;
-    rule *rules_sorted = XMALLOC (rule, nrules);
+    rule *rules_sorted = MALLOC (rules_sorted, nrules);
     rule_number r;
     for (r = 0; r < nrules; ++r)
       rules_sorted[rules[r].useful ? useful++ : useless++] = rules[r];
@@ -289,15 +289,15 @@ nonterminals_reduce (void)
   /* Map the nonterminals to their new index: useful first, useless
      afterwards.  Kept for later report.  */
 
-  symbol_number *nontermmap = XCALLOC (symbol_number, nvars) - ntokens;
+  symbol_number *nontermmap = CALLOC (nontermmap, nvars);
   n = ntokens;
   for (i = ntokens; i < nsyms; i++)
     if (bitset_test (V, i))
-      nontermmap[i] = n++;
+      nontermmap[i - ntokens] = n++;
   for (i = ntokens; i < nsyms; i++)
     if (!bitset_test (V, i))
       {
-       nontermmap[i] = n++;
+       nontermmap[i - ntokens] = n++;
        warn_at (symbols[i]->location, _("useless nonterminal: %s"),
                 symbols[i]->tag);
       }
@@ -305,15 +305,15 @@ nonterminals_reduce (void)
 
   /* Shuffle elements of tables indexed by symbol number.  */
   {
-    symbol **symbols_sorted = XMALLOC (symbol *, nvars) - ntokens;
+    symbol **symbols_sorted = MALLOC (symbols_sorted, nvars);
 
     for (i = ntokens; i < nsyms; i++)
-      symbols[i]->number = nontermmap[i];
+      symbols[i]->number = nontermmap[i - ntokens];
     for (i = ntokens; i < nsyms; i++)
-      symbols_sorted[nontermmap[i]] = symbols[i];
+      symbols_sorted[nontermmap[i - ntokens] - ntokens] = symbols[i];
     for (i = ntokens; i < nsyms; i++)
-      symbols[i] = symbols_sorted[i];
-    free (symbols_sorted + ntokens);
+      symbols[i] = symbols_sorted[i - ntokens];
+    free (symbols_sorted);
   }
 
   {
@@ -323,15 +323,16 @@ nonterminals_reduce (void)
        item_number *rhsp;
        for (rhsp = rules[r].rhs; *rhsp >= 0; ++rhsp)
          if (ISVAR (*rhsp))
-           *rhsp =  symbol_number_as_item_number (nontermmap[*rhsp]);
+           *rhsp =  symbol_number_as_item_number (nontermmap[*rhsp
+                                                             - ntokens]);
       }
-    accept->number = nontermmap[accept->number];
+    accept->number = nontermmap[accept->number - ntokens];
   }
 
   nsyms -= nuseless_nonterminals;
   nvars -= nuseless_nonterminals;
 
-  free (nontermmap + ntokens);
+  free (nontermmap);
 }
 
 
Index: src/relation.c
===================================================================
RCS file: /cvsroot/bison/bison/src/relation.c,v
retrieving revision 1.5
diff -p -u -r1.5 relation.c
--- src/relation.c      11 Dec 2002 06:46:25 -0000      1.5
+++ src/relation.c      13 Dec 2002 08:16:56 -0000
@@ -97,8 +97,8 @@ relation_digraph (relation r, size_t siz
   unsigned i;
 
   infinity = size + 2;
-  INDEX = XCALLOC (relation_node, size + 1);
-  VERTICES = XCALLOC (relation_node, size + 1);
+  CALLOC (INDEX, size + 1);
+  CALLOC (VERTICES, size + 1);
   top = 0;
 
   R = r;
@@ -126,11 +126,11 @@ void
 relation_transpose (relation *R_arg, int n)
 {
   /* The result. */
-  relation new_R = XCALLOC (relation_nodes, n);
+  relation new_R = CALLOC (new_R, n);
   /* END_R[I] -- next entry of NEW_R[I]. */
-  relation end_R = XCALLOC (relation_nodes, n);
+  relation end_R = CALLOC (end_R, n);
   /* NEDGES[I] -- total size of NEW_R[I]. */
-  int *nedges = XCALLOC (int, n);
+  int *nedges = CALLOC (nedges, n);
   int i, j;
 
   if (trace_flag & trace_sets)
@@ -149,7 +149,7 @@ relation_transpose (relation *R_arg, int
   for (i = 0; i < n; i++)
     if (nedges[i] > 0)
       {
-       relation_node *sp = XCALLOC (relation_node, nedges[i] + 1);
+       relation_node *sp = CALLOC (sp, nedges[i] + 1);
        sp[nedges[i]] = -1;
        new_R[i] = sp;
        end_R[i] = sp;
Index: src/scan-gram.l
===================================================================
RCS file: /cvsroot/bison/bison/src/scan-gram.l,v
retrieving revision 1.49
diff -p -u -r1.49 scan-gram.l
--- src/scan-gram.l     11 Dec 2002 06:48:18 -0000      1.49
+++ src/scan-gram.l     13 Dec 2002 08:16:57 -0000
@@ -368,13 +368,14 @@ splice     (\\[ \f\t\v]*\n)*
 <SC_ESCAPED_CHARACTER>
 {
   "'" {
+    unsigned char last_string_1;
     STRING_GROW;
     STRING_FINISH;
     loc->start = token_start;
     val->symbol = symbol_get (last_string, *loc);
     symbol_class_set (val->symbol, token_sym, *loc);
-    symbol_user_token_number_set (val->symbol,
-                                 (unsigned char) last_string[1], *loc);
+    last_string_1 = last_string[1];
+    symbol_user_token_number_set (val->symbol, last_string_1, *loc);
     STRING_FREE;
     rule_length++;
     BEGIN INITIAL;
Index: src/state.c
===================================================================
RCS file: /cvsroot/bison/bison/src/state.c,v
retrieving revision 1.27
diff -p -u -r1.27 state.c
--- src/state.c 11 Dec 2002 06:49:38 -0000      1.27
+++ src/state.c 13 Dec 2002 08:16:57 -0000
@@ -33,21 +33,17 @@
                        `-------------------*/
 
 
-/*---------------------------------------.
-| Create a new array of N shifts/gotos.  |
-`---------------------------------------*/
-
-#define TRANSITIONS_ALLOC(Num)                                         \
-  (transitions *) xcalloc ((sizeof (transitions)                       \
-                            + (Num - 1) * sizeof (state *)),           \
-                          1)
+/*-----------------------------------------.
+| Create a new array of NUM shifts/gotos.  |
+`-----------------------------------------*/
 
 static transitions *
 transitions_new (int num, state **the_states)
 {
-  transitions *res = TRANSITIONS_ALLOC (num);
+  size_t states_size = num * sizeof *the_states;
+  transitions *res = xmalloc (offsetof (transitions, states) + states_size);
   res->num = num;
-  memcpy (res->states, the_states, num * sizeof (the_states[0]));
+  memcpy (res->states, the_states, states_size);
   return res;
 }
 
@@ -73,20 +69,17 @@ transitions_to (transitions *shifts, sym
                        `--------------------*/
 
 
-/*-------------------------------.
-| Create a new array of N errs.  |
-`-------------------------------*/
-
-#define ERRS_ALLOC(Nerrs) \
-  ((errs *) xcalloc ((sizeof (errs) + (Nerrs - 1) * sizeof (symbol *)), 1))
-
+/*---------------------------------.
+| Create a new array of NUM errs.  |
+`---------------------------------*/
 
 errs *
 errs_new (int num, symbol **tokens)
 {
-  errs *res = ERRS_ALLOC (num);
+  size_t symbols_size = num * sizeof *tokens;
+  errs *res = xmalloc (offsetof (errs, symbols) + symbols_size);
   res->num = num;
-  memcpy (res->symbols, tokens, num * sizeof (tokens[0]));
+  memcpy (res->symbols, tokens, symbols_size);
   return res;
 }
 
@@ -98,21 +91,18 @@ errs_new (int num, symbol **tokens)
                        `-------------*/
 
 
-/*-------------------------------------.
-| Create a new array of N reductions.  |
-`-------------------------------------*/
-
-#define REDUCTIONS_ALLOC(Nreductions)                          \
-  (reductions *) xcalloc ((sizeof (reductions)                \
-                          + (Nreductions - 1) * sizeof (rule *)), 1)
+/*---------------------------------------.
+| Create a new array of NUM reductions.  |
+`---------------------------------------*/
 
 static reductions *
 reductions_new (int num, rule **reds)
 {
-  reductions *res = REDUCTIONS_ALLOC (num);
+  size_t rules_size = num * sizeof *reds;
+  reductions *res = xmalloc (offsetof (reductions, rules) + rules_size);
   res->num = num;
-  memcpy (res->rules, reds, num * sizeof (reds[0]));
   res->lookaheads = NULL;
+  memcpy (res->rules, reds, rules_size);
   return res;
 }
 
@@ -128,10 +118,6 @@ state_number nstates = 0;
    accessing symbol: $end.  */
 state *final_state = NULL;
 
-#define STATE_ALLOC(Nitems)                                            \
-  (state *) xcalloc ((sizeof (state)                                   \
-                     + (Nitems - 1) * sizeof (item_number)),           \
-                    1)
 
 /*------------------------------------------------------------------.
 | Create a new state with ACCESSING_SYMBOL, for those items.  Store |
@@ -140,21 +126,25 @@ state *final_state = NULL;
 
 state *
 state_new (symbol_number accessing_symbol,
-          size_t core_size, item_number *core)
+          size_t nitems, item_number *core)
 {
   state *res;
+  size_t items_size = nitems * sizeof *core;
 
   if (STATE_NUMBER_MAXIMUM <= nstates)
     abort ();
 
-  res = STATE_ALLOC (core_size);
+  res = xmalloc (offsetof (state, items) + items_size);
+  res->number = nstates++;
   res->accessing_symbol = accessing_symbol;
-  res->number = nstates;
-  ++nstates;
+  res->transitions = NULL;
+  res->reductions = NULL;
+  res->errs = NULL;
+  res->consistent = 0;
   res->solved_conflicts = NULL;
 
-  res->nitems = core_size;
-  memcpy (res->items, core, core_size * sizeof (core[0]));
+  res->nitems = nitems;
+  memcpy (res->items, core, items_size);
 
   state_hash_insert (res);
 
@@ -266,7 +256,7 @@ state_rule_lookaheads_print (state *s, r
 static struct hash_table *state_table = NULL;
 
 /* Two states are equal if they have the same core items.  */
-static bool
+static inline bool
 state_compare (state const *s1, state const *s2)
 {
   int i;
@@ -281,17 +271,29 @@ state_compare (state const *s1, state co
   return true;
 }
 
-static unsigned int
+static bool
+state_comparator (void const *s1, void const *s2)
+{
+  return state_compare (s1, s2);
+}
+
+static inline unsigned int
 state_hash (state const *s, unsigned int tablesize)
 {
   /* Add up the state's item numbers to get a hash key.  */
-  int key = 0;
+  unsigned int key = 0;
   int i;
   for (i = 0; i < s->nitems; ++i)
     key += s->items[i];
   return key % tablesize;
 }
 
+static unsigned int
+state_hasher (void const *s, unsigned int tablesize)
+{
+  return state_hash (s, tablesize);
+}
+
 
 /*-------------------------------.
 | Create the states hash table.  |
@@ -302,9 +304,9 @@ state_hash_new (void)
 {
   state_table = hash_initialize (HT_INITIAL_CAPACITY,
                                 NULL,
-                                (Hash_hasher) state_hash,
-                                (Hash_comparator) state_compare,
-                                (Hash_data_freer) NULL);
+                                state_hasher,
+                                state_comparator,
+                                NULL);
 }
 
 
@@ -336,13 +338,14 @@ state_hash_insert (state *s)
 `------------------------------------------------------------------*/
 
 state *
-state_hash_lookup (size_t core_size, item_number *core)
+state_hash_lookup (size_t nitems, item_number *core)
 {
-  state *probe = STATE_ALLOC (core_size);
+  size_t items_size = nitems * sizeof *core;
+  state *probe = xmalloc (offsetof (state, items) + items_size);
   state *entry;
 
-  probe->nitems = core_size;
-  memcpy (probe->items, core, core_size * sizeof (core[0]));
+  probe->nitems = nitems;
+  memcpy (probe->items, core, items_size);
   entry = hash_lookup (state_table, probe);
   free (probe);
   return entry;
Index: src/state.h
===================================================================
RCS file: /cvsroot/bison/bison/src/state.h,v
retrieving revision 1.43
diff -p -u -r1.43 state.h
--- src/state.h 11 Dec 2002 06:50:40 -0000      1.43
+++ src/state.h 13 Dec 2002 08:16:57 -0000
@@ -98,7 +98,11 @@ typedef short state_number;
 # define STATE_NUMBER_MAXIMUM SHRT_MAX
 
 /* Be ready to map a state_number to an int.  */
-# define state_number_as_int(Tok) ((int) (Tok))
+static inline int
+state_number_as_int (state_number s)
+{
+  return s;
+}
 
 
 typedef struct state state;
Index: src/symlist.c
===================================================================
RCS file: /cvsroot/bison/bison/src/symlist.c,v
retrieving revision 1.6
diff -p -u -r1.6 symlist.c
--- src/symlist.c       11 Dec 2002 06:51:21 -0000      1.6
+++ src/symlist.c       13 Dec 2002 08:16:57 -0000
@@ -32,7 +32,7 @@
 symbol_list *
 symbol_list_new (symbol *sym, location loc)
 {
-  symbol_list *res = XMALLOC (symbol_list, 1);
+  symbol_list *res = MALLOC (res, 1);
   res->next = NULL;
   res->sym = sym;
   res->location = loc;
Index: src/symtab.c
===================================================================
RCS file: /cvsroot/bison/bison/src/symtab.c,v
retrieving revision 1.53
diff -p -u -r1.53 symtab.c
--- src/symtab.c        11 Dec 2002 06:52:55 -0000      1.53
+++ src/symtab.c        13 Dec 2002 08:16:57 -0000
@@ -46,7 +46,7 @@ location startsymbol_location;
 static symbol *
 symbol_new (uniqstr tag, location loc)
 {
-  symbol *res = XMALLOC (symbol, 1);
+  symbol *res = MALLOC (res, 1);
 
   uniqstr_assert (tag);
   res->tag = tag;
@@ -190,23 +190,12 @@ symbol_user_token_number_set (symbol *sy
 }
 
 
-/*-----------.
-| Free SYM.  |
-`-----------*/
-
-static void
-symbol_free (symbol *sym)
-{
-  free (sym);
-}
-
-
 /*----------------------------------------------------------.
 | If SYM is not defined, report an error, and consider it a |
 | nonterminal.                                              |
 `----------------------------------------------------------*/
 
-static bool
+static inline bool
 symbol_check_defined (symbol *sym)
 {
   if (sym->class == unknown_sym)
@@ -222,6 +211,12 @@ symbol_check_defined (symbol *sym)
   return true;
 }
 
+static bool
+symbol_check_defined_processor (void *sym, void *null ATTRIBUTE_UNUSED)
+{
+  return symbol_check_defined (sym);
+}
+
 
 /*------------------------------------------------------------------.
 | Declare the new symbol SYM.  Make it an alias of SYMVAL, and type |
@@ -260,8 +255,8 @@ symbol_make_alias (symbol *sym, symbol *
 | associativity.                                           |
 `---------------------------------------------------------*/
 
-static bool
-symbol_check_alias_consistence (symbol *this)
+static inline bool
+symbol_check_alias_consistency (symbol *this)
 {
   /* Check only those who _are_ the aliases. */
   if (this->alias && this->user_token_number == USER_NUMBER_ALIAS)
@@ -294,13 +289,20 @@ symbol_check_alias_consistence (symbol *
   return true;
 }
 
+static bool
+symbol_check_alias_consistency_processor (void *this,
+                                         void *null ATTRIBUTE_UNUSED)
+{
+  return symbol_check_alias_consistency (this);
+}
+
 
 /*-------------------------------------------------------------------.
 | Assign a symbol number, and write the definition of the token name |
 | into FDEFINES.  Put in SYMBOLS.                                    |
 `-------------------------------------------------------------------*/
 
-static bool
+static inline bool
 symbol_pack (symbol *this)
 {
   if (this->class == nterm_sym)
@@ -337,6 +339,12 @@ symbol_pack (symbol *this)
   return true;
 }
 
+static bool
+symbol_pack_processor (void *this, void *null ATTRIBUTE_UNUSED)
+{
+  return symbol_pack (this);
+}
+
 
 
 
@@ -344,7 +352,7 @@ symbol_pack (symbol *this)
 | Put THIS in TOKEN_TRANSLATIONS if it is a token.  |
 `--------------------------------------------------*/
 
-static bool
+static inline bool
 symbol_translation (symbol *this)
 {
   /* Non-terminal? */
@@ -364,6 +372,12 @@ symbol_translation (symbol *this)
   return true;
 }
 
+static bool
+symbol_translation_processor (void *this, void *null ATTRIBUTE_UNUSED)
+{
+  return symbol_translation (this);
+}
+
 
 /*----------------------.
 | A symbol hash table.  |
@@ -374,18 +388,30 @@ symbol_translation (symbol *this)
 
 static struct hash_table *symbol_table = NULL;
 
-static bool
+static inline bool
 hash_compare_symbol (const symbol *m1, const symbol *m2)
 {
   /* Since tags are unique, we can compare the pointers themselves.  */
   return UNIQSTR_EQ (m1->tag, m2->tag);
 }
 
-static unsigned int
+static bool
+hash_symbol_comparator (void const *m1, void const *m2)
+{
+  return hash_compare_symbol (m1, m2);
+}
+
+static inline unsigned int
 hash_symbol (const symbol *m, unsigned int tablesize)
 {
   /* Since tags are unique, we can hash the pointer itself.  */
-  return ((size_t) m->tag) % tablesize;
+  return ((uintptr_t) m->tag) % tablesize;
+}
+
+static unsigned int
+hash_symbol_hasher (void const *m, unsigned int tablesize)
+{
+  return hash_symbol (m, tablesize);
 }
 
 
@@ -398,9 +424,9 @@ symbols_new (void)
 {
   symbol_table = hash_initialize (HT_INITIAL_CAPACITY,
                                  NULL,
-                                 (Hash_hasher) hash_symbol,
-                                 (Hash_comparator) hash_compare_symbol,
-                                 (Hash_data_freer) symbol_free);
+                                 hash_symbol_hasher,
+                                 hash_symbol_comparator,
+                                 free);
 }
 
 
@@ -417,7 +443,7 @@ symbol_get (const char *key, location lo
 
   /* Keep the symbol in a printable form.  */
   key = uniqstr_new (quotearg_style (escape_quoting_style, key));
-  *(char const **) &probe.tag = key;
+  probe.tag = key;
   entry = hash_lookup (symbol_table, &probe);
 
   if (!entry)
@@ -469,12 +495,10 @@ symbols_free (void)
 | terminals.                                                     |
 `---------------------------------------------------------------*/
 
-void
-symbols_do (symbol_processor processor, void *processor_data)
+static void
+symbols_do (Hash_processor processor, void *processor_data)
 {
-  hash_do_for_each (symbol_table,
-                   (Hash_processor) processor,
-                   processor_data);
+  hash_do_for_each (symbol_table, processor, processor_data);
 }
 
 
@@ -486,7 +510,7 @@ symbols_do (symbol_processor processor, 
 void
 symbols_check_defined (void)
 {
-  symbols_do (symbol_check_defined, NULL);
+  symbols_do (symbol_check_defined_processor, NULL);
 }
 
 /*------------------------------------------------------------------.
@@ -533,14 +557,14 @@ symbols_token_translations_init (void)
        max_user_token_number = this->user_token_number;
     }
 
-  token_translations = XCALLOC (symbol_number, max_user_token_number + 1);
+  CALLOC (token_translations, max_user_token_number + 1);
 
   /* Initialize all entries for literal tokens to 2, the internal
      token number for $undefined, which represents all invalid inputs.
      */
   for (i = 0; i < max_user_token_number + 1; i++)
     token_translations[i] = undeftoken->number;
-  symbols_do (symbol_translation, NULL);
+  symbols_do (symbol_translation_processor, NULL);
 }
 
 
@@ -552,10 +576,10 @@ symbols_token_translations_init (void)
 void
 symbols_pack (void)
 {
-  symbols = XCALLOC (symbol *, nsyms);
+  CALLOC (symbols, nsyms);
 
-  symbols_do (symbol_check_alias_consistence, NULL);
-  symbols_do (symbol_pack, NULL);
+  symbols_do (symbol_check_alias_consistency_processor, NULL);
+  symbols_do (symbol_pack_processor, NULL);
 
   symbols_token_translations_init ();
 
Index: src/symtab.h
===================================================================
RCS file: /cvsroot/bison/bison/src/symtab.h,v
retrieving revision 1.50
diff -p -u -r1.50 symtab.h
--- src/symtab.h        11 Dec 2002 06:53:20 -0000      1.50
+++ src/symtab.h        13 Dec 2002 08:16:57 -0000
@@ -81,7 +81,7 @@ struct symbol
 #define USER_NUMBER_ALIAS -9991
 
 /* Undefined internal token number.  */
-#define NUMBER_UNDEFINED ((symbol_number) -1)
+#define NUMBER_UNDEFINED (-1)
 
 
 /* Fetch (or create) the symbol associated to KEY.  */
@@ -133,13 +133,6 @@ extern location startsymbol_location;
 
 /* Create the symbol table.  */
 void symbols_new (void);
-
-/* A function to apply to each symbol. */
-typedef bool (*symbol_processor) (symbol *);
-
-/* Apply PROCESSOR to all the symbols.  PROCESSOR must return true: on
-   false, the processing stops.  */
-void symbols_do (symbol_processor processor, void *processor_data);
 
 /* Free all the memory allocated for symbols.  */
 void symbols_free (void);
Index: src/system.h
===================================================================
RCS file: /cvsroot/bison/bison/src/system.h,v
retrieving revision 1.57
diff -p -u -r1.57 system.h
--- src/system.h        11 Dec 2002 06:54:00 -0000      1.57
+++ src/system.h        13 Dec 2002 08:16:57 -0000
@@ -22,23 +22,7 @@
 # include <config.h>
 #endif
 
-/* AIX requires this to be the first thing in the file.  */
-#ifdef __GNUC__
-# define alloca(Size) __builtin_alloca (Size)
-#else
-# if HAVE_ALLOCA_H
-#  include <alloca.h>
-# else
-#  ifdef _AIX
- #pragma alloca
-#  else
-#   ifndef alloca /* predefined by HP cc +Olibcalls */
-char *alloca ();
-#   endif
-#  endif
-# endif
-#endif
-
+#include <stddef.h>
 #include <stdio.h>
 
 /* Verify a requirement at compile-time (unlike assert, which is runtime).  */
@@ -81,7 +65,24 @@ char *alloca ();
 
 #include <limits.h>
 
+#if HAVE_UINTPTR_T
+# if HAVE_INTTYPES_H
+#  include <inttypes.h>
+# else
+#  if HAVE_STDINT_H
+#   include <stdint.h>
+#  endif
+# endif
+#else
+/* This isn't perfect, but it's good enough for Bison, which needs
+   only to hash pointers.  */
+typedef size_t uintptr_t;
+#endif
+
 #include <xalloc.h>
+#define CALLOC(P, N) ((P) = xcalloc (N, sizeof *(P)))
+#define MALLOC(P, N) ((P) = xmalloc ((N) * sizeof *(P)))
+#define REALLOC(P, N) ((P) = xrealloc (P, (N) * sizeof *(P)))
 
 /* From xstrndup.c.  */
 char *xstrndup (const char *s, size_t n);
Index: src/tables.c
===================================================================
RCS file: /cvsroot/bison/bison/src/tables.c,v
retrieving revision 1.15
diff -p -u -r1.15 tables.c
--- src/tables.c        11 Dec 2002 06:54:42 -0000      1.15
+++ src/tables.c        13 Dec 2002 08:16:57 -0000
@@ -1,4 +1,5 @@
 /* Output the generated parsing program for Bison.
+
    Copyright (C) 1984, 1986, 1989, 1992, 2000, 2001, 2002
    Free Software Foundation, Inc.
 
@@ -42,10 +43,18 @@
    Of course vector_number_t ought to be wide enough to contain
    state_number and symbol_number.  */
 typedef short vector_number;
-#define state_number_to_vector_number(State) \
-   ((vector_number) State)
-#define symbol_number_to_vector_number(Symbol) \
-   ((vector_number) (state_number_as_int (nstates) + Symbol - ntokens))
+
+static inline vector_number
+state_number_to_vector_number (state_number s)
+{
+  return s;
+}
+
+static inline vector_number
+symbol_number_to_vector_number (symbol_number s)
+{
+  return state_number_as_int (nstates) + s - ntokens;
+}
 
 int nvectors;
 
@@ -112,7 +121,7 @@ static int conflict_list_free;
 /* TABLE_SIZE is the allocated size of both TABLE and CHECK.  We start
    with more or less the original hard-coded value (which was
    SHRT_MAX).  */
-static size_t table_size = 32768;
+static int table_size = 32768;
 base_number *table = NULL;
 base_number *check = NULL;
 /* The value used in TABLE to denote explicit syntax errors
@@ -133,9 +142,9 @@ rule_number *yydefact;
 `----------------------------------------------------------------*/
 
 static void
-table_grow (size_t desired)
+table_grow (int desired)
 {
-  size_t old_size = table_size;
+  int old_size = table_size;
 
   while (table_size <= desired)
     table_size *= 2;
@@ -144,9 +153,9 @@ table_grow (size_t desired)
     fprintf (stderr, "growing table and check from: %d to %d\n",
             old_size, table_size);
 
-  table = XREALLOC (table, base_number, table_size);
-  check = XREALLOC (check, base_number, table_size);
-  conflict_table = XREALLOC (conflict_table, unsigned int, table_size);
+  REALLOC (table, table_size);
+  REALLOC (check, table_size);
+  REALLOC (conflict_table, table_size);
 
   for (/* Nothing. */; old_size < table_size; ++old_size)
     {
@@ -355,10 +364,10 @@ save_row (state_number s)
 {
   symbol_number i;
   int count;
-  base_number *sp = NULL;
-  base_number *sp1 = NULL;
-  base_number *sp2 = NULL;
-  unsigned int *sp3 = NULL;
+  base_number *sp;
+  base_number *sp1;
+  base_number *sp2;
+  unsigned int *sp3 IF_LINT (= NULL);
 
   /* Number of non default actions in S.  */
   count = 0;
@@ -370,12 +379,9 @@ save_row (state_number s)
     return;
 
   /* Allocate non defaulted actions.  */
-  froms[s] = sp1 = sp = XCALLOC (base_number, count);
-  tos[s] = sp2 = XCALLOC (base_number, count);
-  if (glr_parser)
-    conflict_tos[s] = sp3 = XCALLOC (unsigned int, count);
-  else
-    conflict_tos[s] = NULL;
+  froms[s] = sp = CALLOC (sp1, count);
+  tos[s] = CALLOC (sp2, count);
+  conflict_tos[s] = glr_parser ? CALLOC (sp3, count) : NULL;
 
   /* Store non defaulted actions.  */
   for (i = 0; i < ntokens; i++)
@@ -409,12 +415,12 @@ token_actions (void)
 
   int nconflict = glr_parser ? conflicts_total_count () : 0;
 
-  yydefact = XCALLOC (rule_number, nstates);
+  CALLOC (yydefact, nstates);
 
-  actrow = XCALLOC (action_number, ntokens);
-  conflrow = XCALLOC (unsigned int, ntokens);
+  CALLOC (actrow, ntokens);
+  CALLOC (conflrow, ntokens);
 
-  conflict_list = XCALLOC (unsigned int, 1 + 2 * nconflict);
+  CALLOC (conflict_list, 1 + 2 * nconflict);
   conflict_list_free = 2 * nconflict;
   conflict_list_cnt = 1;
 
@@ -466,8 +472,8 @@ save_column (symbol_number sym, state_nu
   int count;
   vector_number symno = symbol_number_to_vector_number (sym);
 
-  goto_number begin = goto_map[sym];
-  goto_number end = goto_map[sym + 1];
+  goto_number begin = goto_map[sym - ntokens];
+  goto_number end = goto_map[sym - ntokens + 1];
 
   /* Number of non default GOTO.  */
   count = 0;
@@ -479,8 +485,8 @@ save_column (symbol_number sym, state_nu
     return;
 
   /* Allocate room for non defaulted gotos.  */
-  froms[symno] = sp1 = sp = XCALLOC (base_number, count);
-  tos[symno] = sp2 = XCALLOC (base_number, count);
+  froms[symno] = sp = CALLOC (sp1, count);
+  tos[symno] = CALLOC (sp2, count);
 
   /* Store the state numbers of the non defaulted gotos.  */
   for (i = begin; i < end; i++)
@@ -504,13 +510,13 @@ default_goto (symbol_number sym, short s
 {
   state_number s;
   int i;
-  goto_number m = goto_map[sym];
-  goto_number n = goto_map[sym + 1];
-  state_number default_state = (state_number) -1;
+  goto_number m = goto_map[sym - ntokens];
+  goto_number n = goto_map[sym - ntokens + 1];
+  state_number default_state = -1;
   int max = 0;
 
   if (m == n)
-    return (state_number) -1;
+    return -1;
 
   for (s = 0; s < nstates; s++)
     state_count[s] = 0;
@@ -542,8 +548,8 @@ static void
 goto_actions (void)
 {
   symbol_number i;
-  short *state_count = XCALLOC (short, nstates);
-  yydefgoto = XMALLOC (state_number, nvars);
+  short *state_count = CALLOC (state_count, nstates);
+  MALLOC (yydefgoto, nvars);
 
   /* For a given nterm I, STATE_COUNT[S] is the number of times there
      is a GOTO to S on I.  */
@@ -607,7 +613,7 @@ matching_state (vector_number vector)
   int prev;
 
   /* If VECTOR is a nterm, return -1.  */
-  if (i >= (int) nstates)
+  if (nstates <= i)
     return -1;
 
   t = tally[i];
@@ -665,13 +671,13 @@ pack_vector (vector_number vector)
       int k;
       int ok = 1;
 
-      if ((int) table_size <= j)
+      if (table_size <= j)
        abort ();
 
       for (k = 0; ok && k < t; k++)
        {
          loc = j + state_number_as_int (from[k]);
-         if (loc >= (int) table_size)
+         if (table_size <= loc)
            table_grow (loc);
 
          if (table[loc] != 0)
@@ -716,10 +722,10 @@ pack_vector (vector_number vector)
 `-------------------------------------------------------------*/
 
 static base_number
-table_ninf_remap (base_number tab[], size_t size, base_number ninf)
+table_ninf_remap (base_number tab[], int size, base_number ninf)
 {
   base_number res = 0;
-  size_t i;
+  int i;
 
   for (i = 0; i < size; i++)
     if (tab[i] < res && tab[i] != ninf)
@@ -739,11 +745,11 @@ pack_table (void)
 {
   int i;
 
-  base = XCALLOC (base_number, nvectors);
-  pos = XCALLOC (base_number, nentries);
-  table = XCALLOC (base_number, table_size);
-  conflict_table = XCALLOC (unsigned int, table_size);
-  check = XCALLOC (base_number, table_size);
+  CALLOC (base, nvectors);
+  CALLOC (pos, nentries);
+  CALLOC (table, table_size);
+  CALLOC (conflict_table, table_size);
+  CALLOC (check, table_size);
 
   lowzero = 0;
   high = 0;
@@ -751,7 +757,7 @@ pack_table (void)
   for (i = 0; i < nvectors; i++)
     base[i] = BASE_MINIMUM;
 
-  for (i = 0; i < (int) table_size; i++)
+  for (i = 0; i < table_size; i++)
     check[i] = -1;
 
   for (i = 0; i < nentries; i++)
@@ -798,20 +804,20 @@ tables_generate (void)
 
   nvectors = state_number_as_int (nstates) + nvars;
 
-  froms = XCALLOC (base_number *, nvectors);
-  tos = XCALLOC (base_number *, nvectors);
-  conflict_tos = XCALLOC (unsigned int *, nvectors);
-  tally = XCALLOC (short, nvectors);
-  width = XCALLOC (base_number, nvectors);
+  CALLOC (froms, nvectors);
+  CALLOC (tos, nvectors);
+  CALLOC (conflict_tos, nvectors);
+  CALLOC (tally, nvectors);
+  CALLOC (width, nvectors);
 
   token_actions ();
 
   goto_actions ();
-  free (goto_map + ntokens);
+  free (goto_map);
   free (from_state);
   free (to_state);
 
-  order = XCALLOC (vector_number, nvectors);
+  CALLOC (order, nvectors);
   sort_actions ();
   pack_table ();
   free (order);
Index: src/uniqstr.c
===================================================================
RCS file: /cvsroot/bison/bison/src/uniqstr.c,v
retrieving revision 1.1
diff -p -u -r1.1 uniqstr.c
--- src/uniqstr.c       11 Dec 2002 05:20:31 -0000      1.1
+++ src/uniqstr.c       13 Dec 2002 08:16:57 -0000
@@ -40,7 +40,7 @@ static struct hash_table *uniqstrs_table
 `-------------------------------------*/
 
 uniqstr
-uniqstr_new (const char *s)
+uniqstr_new (char const *s)
 {
   uniqstr res = hash_lookup (uniqstrs_table, s);
   if (!res)
@@ -58,7 +58,7 @@ uniqstr_new (const char *s)
 `------------------------------*/
 
 void
-uniqstr_assert (const char *s)
+uniqstr_assert (char const *s)
 {
   if (!hash_lookup (uniqstrs_table, s))
     {
@@ -72,33 +72,36 @@ uniqstr_assert (const char *s)
 | Print the uniqstr.  |
 `--------------------*/
 
-static bool
-uniqstr_print (const uniqstr s)
+static inline bool
+uniqstr_print (uniqstr s)
 {
   fprintf (stderr, "%s\n", s);
   return true;
 }
 
+static bool
+uniqstr_print_processor (void *s, void *null ATTRIBUTE_UNUSED)
+{
+  return uniqstr_print (s);
+}
+
 
 /*-----------------------.
 | A uniqstr hash table.  |
 `-----------------------*/
 
 static bool
-hash_compare_uniqstr (const uniqstr m1, const uniqstr m2)
+hash_compare_uniqstr (void const *m1, void const *m2)
 {
   return strcmp (m1, m2) == 0;
 }
 
 static unsigned int
-hash_uniqstr (const uniqstr m, unsigned int tablesize)
+hash_uniqstr (void const *m, unsigned int tablesize)
 {
   return hash_string (m, tablesize);
 }
 
-/* A function to apply to each symbol. */
-typedef bool (*uniqstr_processor) (const uniqstr);
-
 /*----------------------------.
 | Create the uniqstrs table.  |
 `----------------------------*/
@@ -108,9 +111,9 @@ uniqstrs_new (void)
 {
   uniqstrs_table = hash_initialize (HT_INITIAL_CAPACITY,
                                    NULL,
-                                   (Hash_hasher) hash_uniqstr,
-                                   (Hash_comparator) hash_compare_uniqstr,
-                                   (Hash_data_freer) free);
+                                   hash_uniqstr,
+                                   hash_compare_uniqstr,
+                                   free);
 }
 
 
@@ -119,11 +122,9 @@ uniqstrs_new (void)
 `-------------------------------------*/
 
 static void
-uniqstrs_do (uniqstr_processor processor, void *processor_data)
+uniqstrs_do (Hash_processor processor, void *processor_data)
 {
-  hash_do_for_each (uniqstrs_table,
-                   (Hash_processor) processor,
-                   processor_data);
+  hash_do_for_each (uniqstrs_table, processor, processor_data);
 }
 
 
@@ -134,7 +135,7 @@ uniqstrs_do (uniqstr_processor processor
 void
 uniqstrs_print (void)
 {
-  uniqstrs_do (uniqstr_print, NULL);
+  uniqstrs_do (uniqstr_print_processor, NULL);
 }
 
 
Index: src/vcg.c
===================================================================
RCS file: /cvsroot/bison/bison/src/vcg.c,v
retrieving revision 1.11
diff -p -u -r1.11 vcg.c
--- src/vcg.c   11 Dec 2002 06:56:18 -0000      1.11
+++ src/vcg.c   13 Dec 2002 08:16:58 -0000
@@ -420,7 +420,7 @@ add_classname (graph *g, int val, const 
 {
   struct classname *classname;
 
-  classname = XMALLOC (struct classname, 1);
+  MALLOC (classname, 1);
   classname->no = val;
   classname->name = name;
   classname->next = g->classname;
@@ -432,7 +432,7 @@ add_infoname (graph *g, int integer, con
 {
   struct infoname *infoname;
 
-  infoname = XMALLOC (struct infoname, 1);
+  MALLOC (infoname, 1);
   infoname->integer = integer;
   infoname->chars = str;
   infoname->next = g->infoname;
@@ -446,7 +446,7 @@ add_colorentry (graph *g, int color_idx,
 {
   struct colorentry *ce;
 
-  ce = XMALLOC (struct colorentry, 1);
+  MALLOC (ce, 1);
   ce->color_index = color_idx;
   ce->red_cp = red_cp;
   ce->green_cp = green_cp;
Index: src/vcg_defaults.h
===================================================================
RCS file: /cvsroot/bison/bison/src/vcg_defaults.h,v
retrieving revision 1.4
diff -p -u -r1.4 vcg_defaults.h
--- src/vcg_defaults.h  11 Dec 2002 06:59:06 -0000      1.4
+++ src/vcg_defaults.h  13 Dec 2002 08:16:58 -0000
@@ -105,8 +105,7 @@
 
 # define G_BMAX                        100
 # define G_CMIN                        0
-/* computes the max value of an int ... */
-# define G_CMAX                        ((unsigned) 1 << (sizeof(int) * 8 - 1)) 
- 1
+# define G_CMAX                        INT_MAX
 # define G_PMIN                        0
 # define G_PMAX                        100
 # define G_RMIN                        0



reply via email to

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