about summary refs log tree commit diff
path: root/archive.h
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2020-04-13 12:00:17 -0400
committerJune McEnroe <june@causal.agency>2020-04-13 12:00:17 -0400
commit2060d70f0574019381cbf6f2c78db941f391224c (patch)
treee4e80d26ee609f4870e6206adcfc2296897a0e6c /archive.h
parentRename atom rendering functions (diff)
downloadbubger-2060d70f0574019381cbf6f2c78db941f391224c.tar.gz
bubger-2060d70f0574019381cbf6f2c78db941f391224c.zip
Rework path functions again
Diffstat (limited to 'archive.h')
-rw-r--r--archive.h26
1 files changed, 12 insertions, 14 deletions
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 \