X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Flibgame%2Fhash.h;h=004d9c581183c5a5537583c37150eb6d673d3fa1;hb=HEAD;hp=0d20f2c42283475d7e4b7362343799c9102c1d8a;hpb=6b9be0de63f8e031e8400b829fd2dc9b125bb0b4;p=rocksndiamonds.git diff --git a/src/libgame/hash.h b/src/libgame/hash.h index 0d20f2c4..f87f8b90 100644 --- a/src/libgame/hash.h +++ b/src/libgame/hash.h @@ -1,15 +1,13 @@ -/*********************************************************** -* Artsoft Retro-Game Library * -*----------------------------------------------------------* -* (c) 1994-2006 Artsoft Entertainment * -* Holger Schemel * -* Detmolder Strasse 189 * -* 33604 Bielefeld * -* Germany * -* e-mail: info@artsoft.org * -*----------------------------------------------------------* -* hash.h * -***********************************************************/ +// ============================================================================ +// Artsoft Retro-Game Library +// ---------------------------------------------------------------------------- +// (c) 1995-2014 by Artsoft Entertainment +// Holger Schemel +// info@artsoft.org +// https://www.artsoft.org/ +// ---------------------------------------------------------------------------- +// hash.h +// ============================================================================ /* * Copyright (C) 2002 Christopher Clark @@ -136,7 +134,7 @@ struct hashtable_itr struct hashtable * create_hashtable(unsigned int minsize, float maxloadfactor, unsigned int (*hashfunction) (void*), - int (*key_eq_fn) (void*,void*)); + int (*key_eq_fn) (void*, void*)); /***************************************************************************** * hashtable_insert @@ -161,9 +159,9 @@ int 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) \ +static int fnname (struct hashtable *h, keytype *k, valuetype *v) \ { \ - return hashtable_insert(h,k,v); \ + return hashtable_insert(h, k, v); \ } /***************************************************************************** @@ -180,9 +178,9 @@ int 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) \ +static int fnname (struct hashtable *h, keytype *k, valuetype *v) \ { \ - return hashtable_change(h,k,v); \ + return hashtable_change(h, k, v); \ } /***************************************************************************** @@ -198,9 +196,9 @@ void * hashtable_search(struct hashtable *h, void *k); #define DEFINE_HASHTABLE_SEARCH(fnname, keytype, valuetype) \ -valuetype * fnname (struct hashtable *h, keytype *k) \ +static valuetype * fnname (struct hashtable *h, keytype *k) \ { \ - return (valuetype *) (hashtable_search(h,k)); \ + return (valuetype *) (hashtable_search(h, k)); \ } /***************************************************************************** @@ -216,9 +214,9 @@ void * /* returns value */ hashtable_remove(struct hashtable *h, void *k); #define DEFINE_HASHTABLE_REMOVE(fnname, keytype, valuetype) \ -valuetype * fnname (struct hashtable *h, keytype *k) \ +static valuetype * fnname (struct hashtable *h, keytype *k) \ { \ - return (valuetype *) (hashtable_remove(h,k)); \ + return (valuetype *) (hashtable_remove(h, k)); \ } @@ -251,23 +249,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 */ +/* 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