X-Git-Url: http://andersk.mit.edu/gitweb/splint.git/blobdiff_plain/028230a4017e67c2de99d101f97b7c2e1f21e2a8..8fd556fb32e6886724d72e99270d429554f28ea6:/src/cstringTable.c diff --git a/src/cstringTable.c b/src/cstringTable.c index 9be49ed..5eeb122 100644 --- a/src/cstringTable.c +++ b/src/cstringTable.c @@ -83,7 +83,7 @@ hbucket_unparse (hbucket h) for (i = 0; i < h->size; i++) { - /*drl bee: si*/ s = message ("%q %s:%d", s, h->entries[i]->key, h->entries[i]->val); + s = message ("%q %s:%d", s, h->entries[i]->key, h->entries[i]->val); } } @@ -98,7 +98,7 @@ hbucket_single (/*@only@*/ hentry e) h->size = 1; h->nspace = HBUCKET_BASESIZE - 1; h->entries = (hentry *) dmalloc (HBUCKET_BASESIZE * sizeof (*h->entries)); - /*drl bee: dm*/ h->entries[0] = e; + h->entries[0] = e; return (h); } @@ -116,8 +116,7 @@ hbucket_grow (/*@notnull@*/ hbucket h) for (i = 0; i < h->size; i++) { - /*drl bee: dm*/ - /*drl bee: si*/ newentries[i] = h->entries[i]; + newentries[i] = h->entries[i]; } /*@i32@*/ sfree (h->entries); @@ -148,7 +147,7 @@ hbucket_add (/*@notnull@*/ hbucket h, /*@only@*/ hentry e) } llassert (e->val != HBUCKET_DNE); - /*drl bee: si*/ h->entries[h->size] = e; + h->entries[h->size] = e; h->size++; h->nspace--; } @@ -171,7 +170,7 @@ hbucket_lookup (hbucket h, cstring key) for (i = 0; i < h->size; i++) { - /*drl bee: si*/ if (cstring_equal (h->entries[i]->key, key)) + if (cstring_equal (h->entries[i]->key, key)) { return h->entries[i]->val; } @@ -207,7 +206,7 @@ cstringTable_free (/*@only@*/ cstringTable h) for (i = 0; i < h->size; i++) { - /*drl bee: si*/ hbucket_free (h->buckets[i]); + hbucket_free (h->buckets[i]); } sfree (h->buckets); @@ -224,7 +223,7 @@ cstringTable_countCollisions (cstringTable h) for (i = 0; i < h->size; i++) { - /*drl bee: si*/ nc += hbucket_ncollisions (h->buckets[i]); + nc += hbucket_ncollisions (h->buckets[i]); } return (nc); @@ -241,7 +240,7 @@ cstringTable_countEmpty (cstringTable h) for (i = 0; i < h->size; i++) { - /*drl bee: si*/ if (hbucket_isEmpty (h->buckets[i])) + if (hbucket_isEmpty (h->buckets[i])) { nc++; } @@ -263,7 +262,7 @@ cstringTable_hashValue (/*@notnull@*/ cstringTable h, cstring key) for (p = cstring_toCharsSafe (key); *p != '\0'; p++) { - /*drl bee: nm*/ hash_value = (hash_value << 1) ^ g_randomNumbers[*p % 256]; + hash_value = (hash_value << 1) ^ g_randomNumbers[*p % 256]; } return (hash_value % h->size); @@ -289,7 +288,7 @@ cstringTable_create (int size) /*@+loopexec@*/ for (i = 0; i < size; i++) { - /*drl bee: dm*/ h->buckets[i] = hbucket_undefined; + h->buckets[i] = hbucket_undefined; } /*@-loopexec@*/ return h; @@ -304,7 +303,7 @@ cstring cstringTable_unparse (cstringTable h) { for (i = 0; i < h->size; i++) { - /*drl bee: si*/ hbucket hb = h->buckets[i]; + hbucket hb = h->buckets[i]; if (hb != NULL) { @@ -356,15 +355,15 @@ cstringTable_rehash (/*@notnull@*/ cstringTable h) /*@+loopexec@*/ for (i = 0; i < newsize; i++) { - /*drl bee: dm*/ h->buckets[i] = hbucket_undefined; + h->buckets[i] = hbucket_undefined; } /*@=loopexec@*/ for (i = 0; i < oldsize; i++) { - /*drl bee: dm*/ hbucket bucket = oldbuckets[i]; + hbucket bucket = oldbuckets[i]; - /*drl bee: dm*/ oldbuckets[i] = NULL; + oldbuckets[i] = NULL; if (!hbucket_isNull (bucket)) { @@ -372,7 +371,7 @@ cstringTable_rehash (/*@notnull@*/ cstringTable h) for (j = 0; j < bucket->size; j++) { - /*drl bee: si*/ cstringTable_addEntry (h, bucket->entries[j]); + cstringTable_addEntry (h, bucket->entries[j]); } /* @@ -399,9 +398,9 @@ cstringTable_addEntry (/*@notnull@*/ cstringTable h, /*@only@*/ hentry e) ** instead reveals a bug I don't want to deal with right now! */ - /*drl bee: si*/ if (hbucket_isNull (h->buckets[hindex])) + if (hbucket_isNull (h->buckets[hindex])) { - /*drl bee: si*/ h->buckets[hindex] = hbucket_single (e); + h->buckets[hindex] = hbucket_single (e); h->nentries++; } else @@ -440,11 +439,11 @@ cstringTable_insert (cstringTable h, cstring key, int value) hindex = cstringTable_hashValue (h, key); e = hentry_create (key, value); - /*drl bee: si*/ hb = h->buckets[hindex]; + hb = h->buckets[hindex]; if (hbucket_isNull (hb)) { - /*drl bee: si*/ h->buckets[hindex] = hbucket_single (e); + h->buckets[hindex] = hbucket_single (e); } else { @@ -478,9 +477,9 @@ cstringTable_update (cstringTable h, cstring key, int newval) for (i = 0; i < hb->size; i++) { - /*drl bee: si*/ if (cstring_equal (hb->entries[i]->key, key)) + if (cstring_equal (hb->entries[i]->key, key)) { - /*drl bee: si*/ hb->entries[i]->val = newval; + hb->entries[i]->val = newval; return; } } @@ -508,9 +507,9 @@ cstringTable_replaceKey (cstringTable h, cstring oldkey, /*@only@*/ cstring newk for (i = 0; i < hb->size; i++) { - /*drl bee: si*/ if (cstring_equal (hb->entries[i]->key, oldkey)) + if (cstring_equal (hb->entries[i]->key, oldkey)) { - /*drl bee: si*/ hb->entries[i]->key = newkey; + hb->entries[i]->key = newkey; return; } } @@ -533,12 +532,11 @@ cstringTable_remove (cstringTable h, cstring key) for (i = 0; i < hb->size; i++) { - /*drl bee: si*/ if (cstring_equal (hb->entries[i]->key, key)) + if (cstring_equal (hb->entries[i]->key, key)) { if (i < hb->size - 1) { - /*drl bee: si*/ - hb->entries[i] = hb->entries[hb->size - 1]; + hb->entries[i] = hb->entries[hb->size - 1]; } hb->size--;