/[bison]/bison/src/state.c
ViewVC logotype

Diff of /bison/src/state.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.14 by akim, Sun Jun 30 17:33:37 2002 UTC revision 1.15 by akim, Sun Jun 30 17:34:31 2002 UTC
# Line 76  transitions_to (transitions_t *shifts, s Line 76  transitions_to (transitions_t *shifts, s
76    
77  #define ERRS_ALLOC(Nerrs)                                               \  #define ERRS_ALLOC(Nerrs)                                               \
78    (errs_t *) xcalloc ((unsigned) (sizeof (errs_t)                       \    (errs_t *) xcalloc ((unsigned) (sizeof (errs_t)                       \
79                                    + (Nerrs - 1) * sizeof (short)), 1)                                    + (Nerrs - 1) * sizeof (symbol_number_t)), 1)
80    
81    
82  errs_t *  errs_t *
83  errs_new (int n)  errs_new (int n)
84  {  {
85    errs_t *res = ERRS_ALLOC (n);    errs_t *res = ERRS_ALLOC (n);
86    res->nerrs = n;    res->num = n;
87    return res;    return res;
88  }  }
89    
# Line 91  errs_new (int n) Line 91  errs_new (int n)
91  errs_t *  errs_t *
92  errs_dup (errs_t *src)  errs_dup (errs_t *src)
93  {  {
94    errs_t *res = errs_new (src->nerrs);    errs_t *res = errs_new (src->num);
95    memcpy (res->errs, src->errs, src->nerrs * sizeof (src->errs[0]));    memcpy (res->symbols, src->symbols, src->num * sizeof (src->symbols[0]));
96    return res;    return res;
97  }  }
98    
# Line 110  errs_dup (errs_t *src) Line 110  errs_dup (errs_t *src)
110    
111  #define REDUCTIONS_ALLOC(Nreductions)                                   \  #define REDUCTIONS_ALLOC(Nreductions)                                   \
112    (reductions_t *) xcalloc ((unsigned) (sizeof (reductions_t)           \    (reductions_t *) xcalloc ((unsigned) (sizeof (reductions_t)           \
113                                    + (Nreductions - 1) * sizeof (short)), 1)                                    + (Nreductions - 1) * sizeof (rule_number_t)), 1)
114    
115  static reductions_t *  static reductions_t *
116  reductions_new (int nreductions, short *reductions)  reductions_new (int nreductions, short *reductions)
117  {  {
118    reductions_t *res = REDUCTIONS_ALLOC (nreductions);    reductions_t *res = REDUCTIONS_ALLOC (nreductions);
119    res->nreds = nreductions;    res->num = nreductions;
120    memcpy (res->rules, reductions, nreductions * sizeof (reductions[0]));    memcpy (res->rules, reductions, nreductions * sizeof (reductions[0]));
121    return res;    return res;
122  }  }

Legend:
Removed from v.1.14  
changed lines
  Added in v.1.15

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26