From 96342de68d0d6de71a062d984dafd2a0905ed9fe Mon Sep 17 00:00:00 2001 From: Lukas Nykryn Date: Mon, 13 Aug 2012 13:58:01 +0200 Subject: service: add options RestartPreventExitStatus and SuccessExitStatus In some cases, like wrong configuration, restarting after error does not help, so administrator can specify statuses by RestartPreventExitStatus which will not cause restart of a service. Sometimes you have non-standart exit status, so this can be specified by SuccessfulExitStatus. --- src/shared/hashmap.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/shared/hashmap.c') diff --git a/src/shared/hashmap.c b/src/shared/hashmap.c index e2395d4d42..be37a3659d 100644 --- a/src/shared/hashmap.c +++ b/src/shared/hashmap.c @@ -378,6 +378,21 @@ void* hashmap_get(Hashmap *h, const void *key) { return e->value; } +bool hashmap_contains(Hashmap *h, const void *key) { + unsigned hash; + struct hashmap_entry *e; + + if (!h) + return false; + + hash = h->hash_func(key) % NBUCKETS; + + if (!(e = hash_scan(h, hash, key))) + return false; + + return true; +} + void* hashmap_remove(Hashmap *h, const void *key) { struct hashmap_entry *e; unsigned hash; -- cgit v1.2.3-54-g00ecf