Sigrid Solveig Haflínudóttirrename .inc → .h48299e11 year agoHistory
29 lines · 870 B · C
RawDownload
//-*- mode:c -*- #include "htable.h" #define HTPROT(HTNAME) \void *HTNAME##_get(sl_htable *h, void *key) sl_purefn; \void HTNAME##_put(sl_htable *h, void *key, void *val); \bool HTNAME##_has(sl_htable *h, void *key) sl_purefn; \bool HTNAME##_remove(sl_htable *h, void *key); \void **HTNAME##_bp(sl_htable *h, void *key); // return value, or HT_NOTFOUND if key not found // add key/value binding // add binding iff key is unbound // does key exist? // logically remove key // get a pointer to the location of the value for the given key.// creates the location if it doesn't exist. only returns nil// if memory allocation fails.// this should be used for updates, for example://     void **bp = ptrhash_bp(h, key);//     *bp = f(*bp);// do not reuse bp if there might be intervening calls to ptrhash_put,// ptrhash_bp, ptrhash_reset, or ptrhash_free.

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t