X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Flibgame%2Fhash.h;h=17e511e97fc1c28ceba78e819d632927cc467646;hb=f6477461020eebe6489d4997ac973c985d82e4aa;hp=4be5cc8db5b73e5558b37116699eed351104ca25;hpb=6945f3749927053ee70b47133b2998557a452f75;p=rocksndiamonds.git diff --git a/src/libgame/hash.h b/src/libgame/hash.h index 4be5cc8d..17e511e9 100644 --- a/src/libgame/hash.h +++ b/src/libgame/hash.h @@ -1,7 +1,7 @@ /*********************************************************** * Artsoft Retro-Game Library * *----------------------------------------------------------* -* (c) 1994-2003 Artsoft Entertainment * +* (c) 1994-2006 Artsoft Entertainment * * Holger Schemel * * Detmolder Strasse 189 * * 33604 Bielefeld * @@ -98,26 +98,27 @@ /*****************************************************************************/ struct entry { - void *k, *v; - unsigned int h; - struct entry *next; + void *k, *v; + unsigned int h; + struct entry *next; }; -struct hashtable { - unsigned int tablelength; - struct entry **table; - unsigned int entrycount; - unsigned int loadlimit; - unsigned int (*hashfn) (void *k); - int (*eqfn) (void *k1, void *k2); +struct hashtable +{ + unsigned int tablelength; + struct entry **table; + unsigned int entrycount; + unsigned int loadlimit; + unsigned int (*hashfn) (void *k); + int (*eqfn) (void *k1, void *k2); }; /*****************************************************************************/ struct hashtable_itr { - struct hashtable *h; - struct entry *e; - unsigned int index; + struct hashtable *h; + struct entry *e; + unsigned int index; }; @@ -162,7 +163,7 @@ hashtable_insert(struct hashtable *h, void *k, void *v); #define DEFINE_HASHTABLE_INSERT(fnname, keytype, valuetype) \ int fnname (struct hashtable *h, keytype *k, valuetype *v) \ { \ - return hashtable_insert(h,k,v); \ + return hashtable_insert(h,k,v); \ } /***************************************************************************** @@ -181,7 +182,7 @@ hashtable_change(struct hashtable *h, void *k, void *v); #define DEFINE_HASHTABLE_CHANGE(fnname, keytype, valuetype) \ int fnname (struct hashtable *h, keytype *k, valuetype *v) \ { \ - return hashtable_change(h,k,v); \ + return hashtable_change(h,k,v); \ } /***************************************************************************** @@ -199,7 +200,7 @@ hashtable_search(struct hashtable *h, void *k); #define DEFINE_HASHTABLE_SEARCH(fnname, keytype, valuetype) \ valuetype * fnname (struct hashtable *h, keytype *k) \ { \ - return (valuetype *) (hashtable_search(h,k)); \ + return (valuetype *) (hashtable_search(h,k)); \ } /***************************************************************************** @@ -217,7 +218,7 @@ hashtable_remove(struct hashtable *h, void *k); #define DEFINE_HASHTABLE_REMOVE(fnname, keytype, valuetype) \ valuetype * fnname (struct hashtable *h, keytype *k) \ { \ - return (valuetype *) (hashtable_remove(h,k)); \ + return (valuetype *) (hashtable_remove(h,k)); \ } @@ -250,23 +251,16 @@ struct hashtable_itr * hashtable_iterator(struct hashtable *h); /*****************************************************************************/ -/* hashtable_iterator_key - * - return the value of the (key,value) pair at the current position */ +/* key - return the key of the (key,value) pair at the current position */ -extern inline void * -hashtable_iterator_key(struct hashtable_itr *i) -{ - return i->e->k; -} +void * +hashtable_iterator_key(struct hashtable_itr *i); /*****************************************************************************/ /* value - return the value of the (key,value) pair at the current position */ -extern inline void * -hashtable_iterator_value(struct hashtable_itr *i) -{ - return i->e->v; -} +void * +hashtable_iterator_value(struct hashtable_itr *i); /*****************************************************************************/ /* advance - advance the iterator to the next element