diff options
Diffstat (limited to 'hash.c')
-rw-r--r-- | hash.c | 12 |
1 files changed, 6 insertions, 6 deletions
@@ -14,10 +14,10 @@ A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#include "make.h" +#include "makeint.h" #include "hash.h" -#define CALLOC(t, n) ((t *) calloc (sizeof (t), (n))) +#define CALLOC(t, n) ((t *) xcalloc (sizeof (t) * (n))) #define MALLOC(t, n) ((t *) xmalloc (sizeof (t) * (n))) #define REALLOC(o, t, n) ((t *) xrealloc ((o), sizeof (t) * (n))) #define CLONE(o, t, n) ((t *) memcpy (MALLOC (t, (n)), (o), sizeof (t) * (n))) @@ -26,7 +26,7 @@ static void hash_rehash __P((struct hash_table* ht)); static unsigned long round_up_2 __P((unsigned long rough)); /* Implement double hashing with open addressing. The table size is - always a power of two. The secondary (`increment') hash function + always a power of two. The secondary ('increment') hash function is forced to return an odd-value, in order to be relatively prime to the table size. This guarantees that the increment can potentially hit every slot in the table during collision @@ -61,7 +61,7 @@ hash_init (struct hash_table *ht, unsigned long size, ht->ht_compare = hash_cmp; } -/* Load an array of items into `ht'. */ +/* Load an array of items into 'ht'. */ void hash_load (struct hash_table *ht, void *item_table, @@ -75,9 +75,9 @@ hash_load (struct hash_table *ht, void *item_table, } } -/* Returns the address of the table slot matching `key'. If `key' is +/* Returns the address of the table slot matching 'key'. If 'key' is not found, return the address of an empty slot suitable for - inserting `key'. The caller is responsible for incrementing + inserting 'key'. The caller is responsible for incrementing ht_fill on insertion. */ void ** |