summary refs log tree commit diff
path: root/database.h
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2020-08-21 18:00:52 -0400
committerJune McEnroe <june@causal.agency>2020-08-21 18:00:52 -0400
commit4944437e894637ad99b3b22b3fd7aa60e3243aaa (patch)
tree9882ab4ac77286eaa3ef6bfd240d4568cd7aab2e /database.h
parentUse configPath to load cert/priv (diff)
downloadlitterbox-4944437e894637ad99b3b22b3fd7aa60e3243aaa.tar.gz
litterbox-4944437e894637ad99b3b22b3fd7aa60e3243aaa.zip
Use a static buffer for base directory paths
Diffstat (limited to '')
-rw-r--r--database.h11
1 files changed, 3 insertions, 8 deletions
diff --git a/database.h b/database.h
index 9fc1fc8..15704f0 100644
--- a/database.h
+++ b/database.h
@@ -41,12 +41,8 @@
 #define SQL(...) #__VA_ARGS__
 #define ARRAY_LEN(a) (sizeof(a) / sizeof((a)[0]))
 
-const char *configPath(
-	char *buf, size_t cap, const char **dirs, const char *path
-);
-const char *dataPath(
-	char *buf, size_t cap, const char **dirs, const char *path
-);
+const char *configPath(const char **dirs, const char *path);
+const char *dataPath(const char **dirs, const char *path);
 FILE *configOpen(const char *path, const char *mode);
 FILE *dataOpen(const char *path, const char *mode);
 void dataMkdir(const char *path);
@@ -122,9 +118,8 @@ static inline void dbFind(const char *path, int flags) {
 		dataMkdir("");
 	}
 
-	char buf[PATH_MAX];
 	const char *dirs = NULL;
-	while (NULL != (path = dataPath(buf, sizeof(buf), &dirs, DatabasePath))) {
+	while (NULL != (path = dataPath(&dirs, DatabasePath))) {
 		dbOpen(path, flags);
 		if (db) return;
 	}