summaryrefslogtreecommitdiffstats
path: root/runtime/map-gen.c
diff options
context:
space:
mode:
authorhunt <hunt>2007-01-22 16:54:18 +0000
committerhunt <hunt>2007-01-22 16:54:18 +0000
commit7005d50b4b51408cd5eb1900ab5e355095664d9f (patch)
treee307395c3bc54f848b4c732cdf0b2105b150cf71 /runtime/map-gen.c
parentb4b406f3e27459872deac9f9a2e6523cd5718f5c (diff)
downloadsystemtap-steved-7005d50b4b51408cd5eb1900ab5e355095664d9f.tar.gz
systemtap-steved-7005d50b4b51408cd5eb1900ab5e355095664d9f.tar.xz
systemtap-steved-7005d50b4b51408cd5eb1900ab5e355095664d9f.zip
2007-01-22 Martin Hunt <hunt@redhat.com>
* map-gen.c (_stp_map_exists): New. Check for membership only.
Diffstat (limited to 'runtime/map-gen.c')
-rw-r--r--runtime/map-gen.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/runtime/map-gen.c b/runtime/map-gen.c
index f2b39d40..13c24d76 100644
--- a/runtime/map-gen.c
+++ b/runtime/map-gen.c
@@ -524,6 +524,41 @@ int KEYSYM(_stp_map_del) (MAP map, ALLKEYSD(key))
return 0;
}
+int KEYSYM(_stp_map_exists) (MAP map, ALLKEYSD(key))
+{
+ unsigned int hv;
+ struct hlist_head *head;
+ struct hlist_node *e;
+ struct KEYSYM(map_node) *n;
+
+ if (map == NULL)
+ return 0;
+
+ hv = KEYSYM(hash) (ALLKEYS(key));
+ head = &map->hashes[hv];
+
+ hlist_for_each(e, head) {
+ n = (struct KEYSYM(map_node) *)((long)e - sizeof(struct list_head));
+ if (KEY1_EQ_P(n->key1, key1)
+#if KEY_ARITY > 1
+ && KEY2_EQ_P(n->key2, key2)
+#if KEY_ARITY > 2
+ && KEY3_EQ_P(n->key3, key3)
+#if KEY_ARITY > 3
+ && KEY4_EQ_P(n->key4, key4)
+#if KEY_ARITY > 4
+ && KEY5_EQ_P(n->key5, key5)
+#endif
+#endif
+#endif
+#endif
+ ) {
+ return 1;
+ }
+ }
+ /* key not found */
+ return 0;
+}
#undef KEY1NAME
#undef KEY1N