[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
hurd-l4/libhurd-ihash ihash.c ihash.h
From: |
Marcus Brinkmann |
Subject: |
hurd-l4/libhurd-ihash ihash.c ihash.h |
Date: |
Sun, 17 Aug 2003 01:14:48 -0400 |
CVSROOT: /cvsroot/hurd
Module name: hurd-l4
Branch:
Changes by: Marcus Brinkmann <address@hidden> 03/08/17 01:14:48
Modified files:
libhurd-ihash : ihash.c ihash.h
Log message:
Fix a couple of bugs.
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/hurd/hurd-l4/libhurd-ihash/ihash.c.diff?tr1=1.3&tr2=1.4&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/hurd/hurd-l4/libhurd-ihash/ihash.h.diff?tr1=1.4&tr2=1.5&r1=text&r2=text
Patches:
Index: hurd-l4/libhurd-ihash/ihash.c
diff -u hurd-l4/libhurd-ihash/ihash.c:1.3 hurd-l4/libhurd-ihash/ihash.c:1.4
--- hurd-l4/libhurd-ihash/ihash.c:1.3 Sun Aug 17 00:16:09 2003
+++ hurd-l4/libhurd-ihash/ihash.c Sun Aug 17 01:14:48 2003
@@ -234,14 +234,14 @@
if (ht->keys[idx] == key)
{
- if (!ht->cleanup)
+ if (ht->cleanup)
ht->cleanup (ht->table[idx], ht->cleanup_data);
ht->table[idx] = _HURD_IHASH_DELETED;
}
- /* If we have not found a deleted slot, maybe the last one we
+ /* If we have not found an empty slot, maybe the last one we
looked at was empty (or just got deleted). */
- if (ht->table[first_free] != _HURD_IHASH_DELETED)
+ if (!index_empty (ht, first_free))
first_free = idx;
if (index_empty (ht, first_free))
Index: hurd-l4/libhurd-ihash/ihash.h
diff -u hurd-l4/libhurd-ihash/ihash.h:1.4 hurd-l4/libhurd-ihash/ihash.h:1.5
--- hurd-l4/libhurd-ihash/ihash.h:1.4 Sun Aug 17 00:18:38 2003
+++ hurd-l4/libhurd-ihash/ihash.h Sun Aug 17 01:14:48 2003
@@ -50,7 +50,7 @@
/* The type of the cleanup function, which is called for every value
removed from the hash table. */
-typedef void *(*hurd_ihash_cleanup_t) (hurd_ihash_value_t value, void *arg);
+typedef void (*hurd_ihash_cleanup_t) (hurd_ihash_value_t value, void *arg);
struct hurd_ihash
@@ -145,9 +145,9 @@
value of the current element is available via the macro
HURD_IHASH_ITERATOR_VALUE. */
#define HURD_IHASH_ITERATE(ht, value) \
- for (hurd_ihash_value_t value = (ht)->table[0], \
- *_hurd_ihash_valuep = &(ht)->table[0]; \
- _hurd_ihash_valuep - &(ht)->table[0] < (ht)->size \
+ for (hurd_ihash_value_t value = (ht)->size ? (ht)->table[0] : 0, \
+ *_hurd_ihash_valuep = (ht)->size ? &(ht)->table[0] : 0; \
+ (ht)->size && _hurd_ihash_valuep - &(ht)->table[0] < (ht)->size \
&& (value = *_hurd_ihash_valuep, 1); \
_hurd_ihash_valuep++) \
if (value != _HURD_IHASH_EMPTY && value != _HURD_IHASH_DELETED)