summaryrefslogtreecommitdiff
path: root/src/core/wee-hdata.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/wee-hdata.c')
-rw-r--r--src/core/wee-hdata.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/core/wee-hdata.c b/src/core/wee-hdata.c
index 5222af69e..2204af014 100644
--- a/src/core/wee-hdata.c
+++ b/src/core/wee-hdata.c
@@ -236,6 +236,33 @@ hdata_get_list (struct t_hdata *hdata, const char *name)
}
/*
+ * hdata_check_pointer: check if a pointer is valid for a given hdata/list
+ * return 1 if pointer exists in list
+ * 0 if pointer does not exist
+ */
+
+int
+hdata_check_pointer (struct t_hdata *hdata, void *list, void *pointer)
+{
+ void *ptr_current;
+
+ if (hdata && list && pointer)
+ {
+ if (pointer == list)
+ return 1;
+ ptr_current = list;
+ while (ptr_current)
+ {
+ ptr_current = hdata_move (hdata, ptr_current, 1);
+ if (ptr_current && (ptr_current == pointer))
+ return 1;
+ }
+ }
+
+ return 0;
+}
+
+/*
* hdata_move: move pointer to another element in list
*/