X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;ds=sidebyside;f=src%2Flibgame%2Fhash.h;h=8fe6f7fabbd4ab0c8861ba9f077c4a6f4c3d6064;hb=afba55b62615e9b162159c0f7b0df602f27f69a7;hp=8d0eff235c38348e4e7afbb5b9667aa33510e51d;hpb=e1342541fd884143a3d43a5cc7a44de99aa7c715;p=rocksndiamonds.git diff --git a/src/libgame/hash.h b/src/libgame/hash.h index 8d0eff23..8fe6f7fa 100644 --- a/src/libgame/hash.h +++ b/src/libgame/hash.h @@ -196,6 +196,24 @@ static int fnname (struct hashtable *h, keytype *k, valuetype *v) \ return hashtable_change(h, k, v); \ } +/***************************************************************************** + * hashtable_exists + + * @name hashtable_exists + * @param h the hashtable to search + * @param k the key to search for + * @return non-zero if key exists, else zero + */ + +int +hashtable_exists(struct hashtable *h, void *k); + +#define DEFINE_HASHTABLE_EXISTS(fnname, keytype, valuetype) \ +static int fnname (struct hashtable *h, keytype *k) \ +{ \ + return hashtable_exists(h, k); \ +} + /***************************************************************************** * hashtable_search