about summary refs log tree commit diff stats
path: root/src/include/pathcoll.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/include/pathcoll.h')
-rwxr-xr-xsrc/include/pathcoll.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/include/pathcoll.h b/src/include/pathcoll.h
new file mode 100755
index 00000000..f1a0b93e
--- /dev/null
+++ b/src/include/pathcoll.h
@@ -0,0 +1,23 @@
+#ifndef __PATHCOLL_H_
+#define __PATHCOLL_H_
+
+// utility to handle path collection (like BOX86_PATH or BOX86_LD_LIBRARY_PATH)
+
+// paths can be resized with realloc, so don't take address as invariant
+typedef struct path_collection_s
+{
+    int    size;
+    int    cap;
+    char** paths;
+} path_collection_t;
+
+void ParseList(const char* List, path_collection_t* collection, int folder);
+void FreeCollection(path_collection_t* collection);
+void CopyCollection(path_collection_t* to, path_collection_t* from);
+void AddPath(const char* path, path_collection_t* collection, int folder);
+void PrependPath(const char* path, path_collection_t* collection, int folder);
+void AppendList(path_collection_t* collection, const char* List, int folder);
+void PrependList(path_collection_t* collection, const char* List, int folder);
+int FindInCollection(const char* path, path_collection_t* collection);
+
+#endif //__PATHCOLL_H_