mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-14 14:53:03 +00:00
* src/state.h (CORE_ALLOC, SHIFTS_ALLOC, ERRS_ALLOC)
(REDUCTIONS_ALLOC): New. * src/LR0.c, src/conflicts.c: Use them to de-obfuscate memory allocation.
This commit is contained in:
15
src/state.h
15
src/state.h
@@ -99,7 +99,9 @@ typedef struct core
|
||||
}
|
||||
core;
|
||||
|
||||
|
||||
#define CORE_ALLOC(Nitems) \
|
||||
(core *) xcalloc ((unsigned) (sizeof (core) \
|
||||
+ (Nitems - 1) * sizeof (short)), 1)
|
||||
|
||||
typedef struct shifts
|
||||
{
|
||||
@@ -110,6 +112,9 @@ typedef struct shifts
|
||||
}
|
||||
shifts;
|
||||
|
||||
#define SHIFTS_ALLOC(Nshifts) \
|
||||
(shifts *) xcalloc ((unsigned) (sizeof (shifts) \
|
||||
+ (Nshifts - 1) * sizeof (short)), 1)
|
||||
|
||||
|
||||
typedef struct errs
|
||||
@@ -119,6 +124,10 @@ typedef struct errs
|
||||
}
|
||||
errs;
|
||||
|
||||
#define ERRS_ALLOC(Nerrs) \
|
||||
(errs *) xcalloc ((unsigned) (sizeof (errs) \
|
||||
+ (Nerrs - 1) * sizeof (short)), 1)
|
||||
|
||||
|
||||
|
||||
typedef struct reductions
|
||||
@@ -130,4 +139,8 @@ typedef struct reductions
|
||||
}
|
||||
reductions;
|
||||
|
||||
#define REDUCTIONS_ALLOC(Nreductions) \
|
||||
(reductions *) xcalloc ((unsigned) (sizeof (reductions) \
|
||||
+ (Nreductions - 1) * sizeof (short)), 1)
|
||||
|
||||
#endif /* !STATE_H_ */
|
||||
|
||||
Reference in New Issue
Block a user