aboutsummaryrefslogtreecommitdiff
path: root/external/hash/ptr_set.h
diff options
context:
space:
mode:
Diffstat (limited to 'external/hash/ptr_set.h')
1 files changed, 19 insertions, 0 deletions
diff --git a/external/hash/ptr_set.h b/external/hash/ptr_set.h
new file mode 100644
index 0000000..f66e70e
--- /dev/null
+++ b/external/hash/ptr_set.h
@@ -0,0 +1,19 @@
+#ifndef HT_PTR_SET_H
+#define HT_PTR_SET_H
+
+#include "hash_table.h"
+
+DECLARE_HASH_TABLE(ptr_set, void *)
+
+/* Return value helpers - these are specific to the implementation. */
+#define PTR_SET_IS_MISSING(x) ((void *)x == (void *)0)
+#define PTR_SET_IS_ERROR(x) ((void *)x == (void *)2)
+#define PTR_SET_IS_VALID(x) ((void *)x > (void *)2)
+
+/* Extensions to std. interface. */
+static inline int ptr_set_exists(ptr_set_t *S, void *p)
+{
+ return ptr_set_find_item(S, p) != (void *)0;
+}
+
+#endif /* HT_PTR_SET_H */