X-Git-Url: http://andersk.mit.edu/gitweb/splint.git/blobdiff_plain/6252ab26bcefaa493fee28775bc03613cd46b0f2..51bc6ecce8b6e9877dccd8bda2cf220b47e6929c:/src/genericTable.c diff --git a/src/genericTable.c b/src/genericTable.c index 5e1b2a3..75067f6 100644 --- a/src/genericTable.c +++ b/src/genericTable.c @@ -140,19 +140,22 @@ static /*@null@*/ /*@exposed@*/ void *ghbucket_lookup (ghbucket p_h, cstring p_k static void ghbucket_add (/*@notnull@*/ ghbucket h, /*@only@*/ ghentry e) { - void *exloc = ghbucket_lookup (h, e->key); - - if (exloc != NULL) { - llassert (FALSE); - } - - if (h->nspace == 0) { - ghbucket_grow (h); - } - - h->entries[h->size] = e; - h->size++; - h->nspace--; + void *exloc = ghbucket_lookup (h, e->key); + + if (exloc != NULL) { + llcontbug (message ("ghbucket_add: adding duplicate entry: %s", + e->key)); + ghentry_free (e); + return; + } + + if (h->nspace == 0) { + ghbucket_grow (h); + } + + h->entries[h->size] = e; + h->size++; + h->nspace--; } static int