summaryrefslogtreecommitdiff
path: root/libhurd-ihash
diff options
context:
space:
mode:
authorneal <neal>2007-11-13 17:46:51 +0000
committerneal <neal>2007-11-13 17:46:51 +0000
commitf9af68953fbfe1ae7514c4686a8ec0a681f4e391 (patch)
treeb9a98e05e216185ec1617ddb1d1162aecac5aa59 /libhurd-ihash
parent8a113b4d63639f35ea929746431970cfba53a0fd (diff)
2007-11-13 Neal H. Walfield <neal@gnu.org>
* ihash.h (hurd_ihash_locp_remove): Fix comment. * t-ihash.c (program_name): Add variable. (main): Add a test case for hurd_ihash_locp_remove.
Diffstat (limited to 'libhurd-ihash')
-rw-r--r--libhurd-ihash/ChangeLog6
-rw-r--r--libhurd-ihash/ihash.h2
-rw-r--r--libhurd-ihash/t-ihash.c26
3 files changed, 33 insertions, 1 deletions
diff --git a/libhurd-ihash/ChangeLog b/libhurd-ihash/ChangeLog
index a386d61..6ce2684 100644
--- a/libhurd-ihash/ChangeLog
+++ b/libhurd-ihash/ChangeLog
@@ -1,3 +1,9 @@
+2007-11-13 Neal H. Walfield <neal@gnu.org>
+
+ * ihash.h (hurd_ihash_locp_remove): Fix comment.
+ * t-ihash.c (program_name): Add variable.
+ (main): Add a test case for hurd_ihash_locp_remove.
+
2007-10-16 Neal H. Walfield <neal@gnu.org>
* ihash.h: Don't include <sys/types.h>.
diff --git a/libhurd-ihash/ihash.h b/libhurd-ihash/ihash.h
index 9c8f2c6..bdcc578 100644
--- a/libhurd-ihash/ihash.h
+++ b/libhurd-ihash/ihash.h
@@ -242,7 +242,7 @@ int hurd_ihash_remove (hurd_ihash_t ht, hurd_ihash_key_t key);
/* Remove from the hast table HT the entry with the location pointer
LOCP. That is, if the location pointer is stored in a field named
- locp in the value, pass &value.locp. This call is faster than
+ locp in the value, pass value.locp. This call is faster than
hurd_ihash_remove(). */
void hurd_ihash_locp_remove (hurd_ihash_t ht, hurd_ihash_locp_t locp);
diff --git a/libhurd-ihash/t-ihash.c b/libhurd-ihash/t-ihash.c
index c0124f5..e906da0 100644
--- a/libhurd-ihash/t-ihash.c
+++ b/libhurd-ihash/t-ihash.c
@@ -20,6 +20,8 @@
#define _GNU_SOURCE
+extern const char program_name[] = "t-ihash";
+
#if HAVE_CONFIG_H
#include <config.h>
#endif
@@ -95,5 +97,29 @@ main (int argc, char *argv[])
printf ("ok\n");
+ printf ("Checking hurd_ihash_locp_remove... ");
+
+ struct s
+ {
+ int value;
+ hurd_ihash_locp_t locp;
+ };
+ hurd_ihash_init (&hash, &(((struct s *)0)->locp));
+
+ if (hurd_ihash_find (&hash, 1))
+ F ("Found object with key 1 in otherwise empty hash");
+
+ struct s s;
+ s.value = 1;
+ hurd_ihash_add (&hash, 1, &s);
+ if (! hurd_ihash_find (&hash, 1))
+ F ("Did not find recently inserted object with key 1");
+
+ hurd_ihash_locp_remove (&hash, s.locp);
+ if (hurd_ihash_find (&hash, 1))
+ F ("Found recently removed object with key 1");
+
+ printf ("ok\n");
+
return 0;
}