summaryrefslogtreecommitdiff
path: root/firmware/export
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/export')
-rw-r--r--firmware/export/general.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/firmware/export/general.h b/firmware/export/general.h
index 8da4a0a..16c8240 100644
--- a/firmware/export/general.h
+++ b/firmware/export/general.h
@@ -72,4 +72,19 @@ char *create_datetime_filename(char *buffer, const char *path,
bool unique_time);
#endif /* CONFIG_RTC */
+/***
+ ** Compacted pointer lists
+ **
+ ** N-length list requires N+1 elements to ensure NULL-termination.
+ **/
+
+/* Find a pointer in a pointer array. Returns the addess of the element if
+ found or the address of the terminating NULL otherwise. This can be used
+ to bounds check and add items. */
+void ** find_array_ptr(void **arr, void *ptr);
+
+/* Remove a pointer from a pointer array if it exists. Compacts it so that
+ no gaps exist. Returns 0 on success and -1 if the element wasn't found. */
+int remove_array_ptr(void **arr, void *ptr);
+
#endif /* GENERAL_H */