properly initialize NULL fields in h_cfgrammar_new and h_stringmap_new

This commit is contained in:
Sven M. Hallberg 2013-05-25 14:49:59 +02:00
parent 02f1c80eea
commit e0207b8d5f

View file

@ -18,6 +18,7 @@ HCFGrammar *h_cfgrammar_new(HAllocator *mm__)
g->mm__ = mm__;
g->arena = h_new_arena(mm__, 0); // default blocksize
g->nts = h_hashset_new(g->arena, h_eq_ptr, h_hash_ptr);
g->start = NULL;
g->geneps = NULL;
g->first = NULL;
g->follow = NULL;
@ -222,6 +223,8 @@ static void collect_geneps(HCFGrammar *g)
HCFStringMap *h_stringmap_new(HArena *a)
{
HCFStringMap *m = h_arena_malloc(a, sizeof(HCFStringMap));
m->epsilon_branch = NULL;
m->end_branch = NULL;
m->char_branches = h_hashtable_new(a, h_eq_ptr, h_hash_ptr);
m->arena = a;
return m;