From 4944437e894637ad99b3b22b3fd7aa60e3243aaa Mon Sep 17 00:00:00 2001 From: "C. McEnroe" Date: Fri, 21 Aug 2020 18:00:52 -0400 Subject: Use a static buffer for base directory paths --- database.h | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'database.h') 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; } -- cgit 1.4.1