summaryrefslogtreecommitdiff
path: root/src/include/gnunet_container_lib.h
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2011-01-24 20:53:23 +0000
committerChristian Grothoff <christian@grothoff.org>2011-01-24 20:53:23 +0000
commit5a69a953728fd06510657fbe5f2de176b0f05f89 (patch)
tree4b4ba26982507703423d1817508beea7650f9d1f /src/include/gnunet_container_lib.h
parent9c9fa9702688a45e30de90cd75f8d7fc466dc412 (diff)
downloadgnunet-5a69a953728fd06510657fbe5f2de176b0f05f89.tar.gz
gnunet-5a69a953728fd06510657fbe5f2de176b0f05f89.zip
assert element in/not-in list
Diffstat (limited to 'src/include/gnunet_container_lib.h')
-rw-r--r--src/include/gnunet_container_lib.h30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/include/gnunet_container_lib.h b/src/include/gnunet_container_lib.h
index 85b17c7dd..c5f46b419 100644
--- a/src/include/gnunet_container_lib.h
+++ b/src/include/gnunet_container_lib.h
@@ -617,6 +617,23 @@ int GNUNET_CONTAINER_multihashmap_contains (const struct
617 617
618 618
619/** 619/**
620 * Check if the map contains the given value under the given
621 * key.
622 *
623 * @param map the map
624 * @param key the key to test if a value exists for it
625 * @param value value to test for
626 * @return GNUNET_YES if such a value exists,
627 * GNUNET_NO if not
628 */
629int GNUNET_CONTAINER_multihashmap_contains_value (const struct
630 GNUNET_CONTAINER_MultiHashMap
631 *map,
632 const GNUNET_HashCode * key,
633 const void *value);
634
635
636/**
620 * Store a key-value pair in the map. 637 * Store a key-value pair in the map.
621 * 638 *
622 * @param map the map 639 * @param map the map
@@ -690,6 +707,8 @@ int GNUNET_CONTAINER_multihashmap_get_multiple (const struct
690 * @param element element to insert 707 * @param element element to insert
691 */ 708 */
692#define GNUNET_CONTAINER_DLL_insert(head,tail,element) do { \ 709#define GNUNET_CONTAINER_DLL_insert(head,tail,element) do { \
710 GNUNET_assert ( ( (element)->prev == NULL) && ((head) != (element))); \
711 GNUNET_assert ( ( (element)->next == NULL) && ((tail) != (element))); \
693 (element)->next = (head); \ 712 (element)->next = (head); \
694 (element)->prev = NULL; \ 713 (element)->prev = NULL; \
695 if ((tail) == NULL) \ 714 if ((tail) == NULL) \
@@ -698,6 +717,7 @@ int GNUNET_CONTAINER_multihashmap_get_multiple (const struct
698 (head)->prev = element; \ 717 (head)->prev = element; \
699 (head) = (element); } while (0) 718 (head) = (element); } while (0)
700 719
720
701/** 721/**
702 * Insert an element at the tail of a DLL. Assumes that head, tail and 722 * Insert an element at the tail of a DLL. Assumes that head, tail and
703 * element are structs with prev and next fields. 723 * element are structs with prev and next fields.
@@ -707,6 +727,8 @@ int GNUNET_CONTAINER_multihashmap_get_multiple (const struct
707 * @param element element to insert 727 * @param element element to insert
708 */ 728 */
709#define GNUNET_CONTAINER_DLL_insert_tail(head,tail,element) do { \ 729#define GNUNET_CONTAINER_DLL_insert_tail(head,tail,element) do { \
730 GNUNET_assert ( ( (element)->prev == NULL) && ((head) != (element))); \
731 GNUNET_assert ( ( (element)->next == NULL) && ((tail) != (element))); \
710 (element)->prev = (tail); \ 732 (element)->prev = (tail); \
711 (element)->next = NULL; \ 733 (element)->next = NULL; \
712 if ((head) == NULL) \ 734 if ((head) == NULL) \
@@ -715,6 +737,7 @@ int GNUNET_CONTAINER_multihashmap_get_multiple (const struct
715 (tail)->next = element; \ 737 (tail)->next = element; \
716 (tail) = (element); } while (0) 738 (tail) = (element); } while (0)
717 739
740
718/** 741/**
719 * Insert an element into a DLL after the given other element. Insert 742 * Insert an element into a DLL after the given other element. Insert
720 * at the head if the other element is NULL. 743 * at the head if the other element is NULL.
@@ -725,6 +748,8 @@ int GNUNET_CONTAINER_multihashmap_get_multiple (const struct
725 * @param element element to insert 748 * @param element element to insert
726 */ 749 */
727#define GNUNET_CONTAINER_DLL_insert_after(head,tail,other,element) do { \ 750#define GNUNET_CONTAINER_DLL_insert_after(head,tail,other,element) do { \
751 GNUNET_assert ( ( (element)->prev == NULL) && ((head) != (element))); \
752 GNUNET_assert ( ( (element)->next == NULL) && ((tail) != (element))); \
728 (element)->prev = (other); \ 753 (element)->prev = (other); \
729 if (NULL == other) \ 754 if (NULL == other) \
730 { \ 755 { \
@@ -741,6 +766,7 @@ int GNUNET_CONTAINER_multihashmap_get_multiple (const struct
741 else \ 766 else \
742 (element)->next->prev = (element); } while (0) 767 (element)->next->prev = (element); } while (0)
743 768
769
744/** 770/**
745 * Insert an element into a DLL before the given other element. Insert 771 * Insert an element into a DLL before the given other element. Insert
746 * at the tail if the other element is NULL. 772 * at the tail if the other element is NULL.
@@ -751,6 +777,8 @@ int GNUNET_CONTAINER_multihashmap_get_multiple (const struct
751 * @param element element to insert 777 * @param element element to insert
752 */ 778 */
753#define GNUNET_CONTAINER_DLL_insert_before(head,tail,other,element) do { \ 779#define GNUNET_CONTAINER_DLL_insert_before(head,tail,other,element) do { \
780 GNUNET_assert ( ( (element)->prev == NULL) && ((head) != (element))); \
781 GNUNET_assert ( ( (element)->next == NULL) && ((tail) != (element))); \
754 (element)->next = (other); \ 782 (element)->next = (other); \
755 if (NULL == other) \ 783 if (NULL == other) \
756 { \ 784 { \
@@ -778,6 +806,8 @@ int GNUNET_CONTAINER_multihashmap_get_multiple (const struct
778 * @param element element to remove 806 * @param element element to remove
779 */ 807 */
780#define GNUNET_CONTAINER_DLL_remove(head,tail,element) do { \ 808#define GNUNET_CONTAINER_DLL_remove(head,tail,element) do { \
809 GNUNET_assert ( ( (element)->prev != NULL) || ((head) == (element))); \
810 GNUNET_assert ( ( (element)->next != NULL) || ((tail) == (element))); \
781 if ((element)->prev == NULL) \ 811 if ((element)->prev == NULL) \
782 (head) = (element)->next; \ 812 (head) = (element)->next; \
783 else \ 813 else \