Skip to content

Growable hash table

Simple hash table that can store arbitrary objects associated with string names.

API Quick Tour

To create a hash table:

RHash *table = rAllocHash(size, 0);

To free the table:

rFreeHash(table);

To add a name and value to the hash:

RName *name = rAddName(table, "some-name", value, flags);

To lookup a name, use:

void *value = rLookupName(hash, "some-name");

To remove a name, use:

rRemoveName(table, "some-name");

To iterate over hashed names:

1
2
3
4
RName *item;
for (ITERATE_NAMES(table, item)) {
    printf("Item %s has value %s", item->name, item->value);
}