X-Git-Url: http://www.project-moonshot.org/gitweb/?a=blobdiff_plain;f=src%2Fhashtable.h;h=6d3c736f505ba7971c46b385d28898320503f22a;hb=8d75235ff22dc4aced697e198c3c024f1f4b88fe;hp=d01b7e72087d98d956790fa4a565df186a746bfc;hpb=ca7703fbd127a6279e9842a843f317a639db87e2;p=jansson.git diff --git a/src/hashtable.h b/src/hashtable.h index d01b7e7..6d3c736 100644 --- a/src/hashtable.h +++ b/src/hashtable.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009 Petri Lehtinen + * Copyright (c) 2009, 2010 Petri Lehtinen * * This library is free software; you can redistribute it and/or modify * it under the terms of the MIT license. See LICENSE for details. @@ -13,8 +13,8 @@ typedef int (*key_cmp_fn)(const void *key1, const void *key2); typedef void (*free_fn)(void *key); struct hashtable_list { - struct hashtable_list *prev; - struct hashtable_list *next; + struct hashtable_list *prev; + struct hashtable_list *next; }; struct hashtable_pair { @@ -161,6 +161,17 @@ void hashtable_clear(hashtable_t *hashtable); void *hashtable_iter(hashtable_t *hashtable); /** + * hashtable_iter - Return an iterator at a specific key + * + * @hashtable: The hashtable object + * @key: The key that the iterator should point to + * + * Like hashtable_iter() but returns an iterator pointing to a + * specific key. + */ +void *hashtable_iter_at(hashtable_t *hashtable, const void *key); + +/** * hashtable_iter_next - Advance an iterator * * @hashtable: The hashtable object @@ -185,4 +196,12 @@ void *hashtable_iter_key(void *iter); */ void *hashtable_iter_value(void *iter); +/** + * hashtable_iter_set - Set the value pointed by an iterator + * + * @iter: The iterator + * @value: The value to set + */ +void hashtable_iter_set(hashtable_t *hashtable, void *iter, void *value); + #endif