* configure.in: Invoke AM_LIB_DMALLOC.

* src/system.h: Use dmalloc.
* src/LR0.c: Be sure to have pointers initialized to NULL.
(allocate_itemsets): Allocate kernel_items only if needed.
This commit is contained in:
Akim Demaille
2001-09-22 17:19:03 +00:00
parent 19f01e885f
commit f2632e420f
11 changed files with 114 additions and 20 deletions

View File

@@ -33,39 +33,39 @@
int nstates;
int final_state;
core *first_state;
shifts *first_shift;
reductions *first_reduction;
core *first_state = NULL;
shifts *first_shift = NULL;
reductions *first_reduction = NULL;
static core *this_state;
static core *last_state;
static shifts *last_shift;
static reductions *last_reduction;
static core *this_state = NULL;
static core *last_state = NULL;
static shifts *last_shift = NULL;
static reductions *last_reduction = NULL;
static int nshifts;
static short *shift_symbol;
static short *shift_symbol = NULL;
static short *redset;
static short *shiftset;
static short *redset = NULL;
static short *shiftset = NULL;
static short **kernel_base;
static short **kernel_end;
static short *kernel_items;
static short **kernel_base = NULL;
static short **kernel_end = NULL;
static short *kernel_items = NULL;
/* hash table for states, to recognize equivalent ones. */
#define STATE_TABLE_SIZE 1009
static core **state_table;
static core **state_table = NULL;
static void
allocate_itemsets (void)
{
short *itemp;
short *itemp = NULL;
int symbol;
int i;
int count;
short *symbol_count;
short *symbol_count = NULL;
count = 0;
symbol_count = XCALLOC (short, nsyms);
@@ -89,7 +89,8 @@ allocate_itemsets (void)
We allocate that much space for each symbol. */
kernel_base = XCALLOC (short *, nsyms);
kernel_items = XCALLOC (short, count);
if (count)
kernel_items = XCALLOC (short, count);
count = 0;
for (i = 0; i < nsyms; i++)

View File

@@ -143,8 +143,6 @@ size_t strnlen PARAMS ((const char *s, size_t maxlen));
# define LOCALEDIR "/usr/local/share/locale"
#endif
#endif /* BISON_SYSTEM_H */
/*-----------.
| Booleans. |
@@ -264,3 +262,17 @@ do { \
# define BISON_HAIRY "c:/usr/local/lib/bison.hairy"
# endif
#endif
/*---------------------------------.
| Debugging the memory allocator. |
`---------------------------------*/
# if WITH_DMALLOC
# define DMALLOC_FUNC_CHECK
# include <dmalloc.h>
# endif /* WITH_DMALLOC */
#endif /* BISON_SYSTEM_H */