diff options
-rw-r--r-- | runtime/ChangeLog | 4 | ||||
-rw-r--r-- | runtime/map-gen.c | 35 |
2 files changed, 39 insertions, 0 deletions
diff --git a/runtime/ChangeLog b/runtime/ChangeLog index d14c5b8f..bee42c6d 100644 --- a/runtime/ChangeLog +++ b/runtime/ChangeLog @@ -1,3 +1,7 @@ +2007-01-22 Martin Hunt <hunt@redhat.com> + + * map-gen.c (_stp_map_exists): New. Check for membership only. + 2007-01-19 Josh Stone <joshua.i.stone@intel.com> PR 3079 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 |