From 2060d70f0574019381cbf6f2c78db941f391224c Mon Sep 17 00:00:00 2001 From: "C. McEnroe" Date: Mon, 13 Apr 2020 12:00:17 -0400 Subject: Rework path functions again --- archive.h | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) (limited to 'archive.h') diff --git a/archive.h b/archive.h index ffe1561..6342236 100644 --- a/archive.h +++ b/archive.h @@ -143,10 +143,10 @@ int templateRender( ); char *templateURL(const char *template, const struct Variable vars[]); -static inline char * -pathUID(char path[static PATH_MAX], uint32_t uid, const char *type) { - snprintf(path, PATH_MAX, "UID/%" PRIu32 ".%s", uid, type); - return path; +static inline const char *pathUID(uint32_t uid, const char *type) { + static char buf[PATH_MAX]; + snprintf(buf, sizeof(buf), "UID/%" PRIu32 ".%s", uid, type); + return buf; } static inline const char *pathMangle(const char *messageID) { @@ -159,18 +159,16 @@ static inline const char *pathMangle(const char *messageID) { return buf; } -static inline char *pathMessage( - char path[static PATH_MAX], const char *messageID, const char *type -) { - snprintf(path, PATH_MAX, "message/%s.%s", pathMangle(messageID), type); - return path; +static inline const char *pathMessage(const char *messageID, const char *type) { + static char buf[PATH_MAX]; + snprintf(buf, sizeof(buf), "message/%s.%s", pathMangle(messageID), type); + return buf; } -static inline char *pathThread( - char path[static PATH_MAX], const char *messageID, const char *type -) { - snprintf(path, PATH_MAX, "thread/%s.%s", pathMangle(messageID), type); - return path; +static inline const char *pathThread(const char *messageID, const char *type) { + static char buf[PATH_MAX]; + snprintf(buf, sizeof(buf), "thread/%s.%s", pathMangle(messageID), type); + return buf; } #define MBOX_HEADERS \ -- cgit 1.4.1