summary refs log tree commit diff
path: root/archive.h
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2020-11-29 16:57:55 -0500
committerJune McEnroe <june@causal.agency>2020-11-29 16:57:55 -0500
commit08c8ff154fbcfa24ed89df7dfdedd5f4e0deab77 (patch)
tree7b6c505c304f02e73bf46daac92acc929fdc5db2 /archive.h
parentRearrange archive.h (diff)
downloadbubger-08c8ff154fbcfa24ed89df7dfdedd5f4e0deab77.tar.gz
bubger-08c8ff154fbcfa24ed89df7dfdedd5f4e0deab77.zip
Factor out uint32_t stringify
Diffstat (limited to '')
-rw-r--r--archive.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/archive.h b/archive.h
index 3605a4b..0b8b6d8 100644
--- a/archive.h
+++ b/archive.h
@@ -25,6 +25,7 @@
  * covered work.
  */
 
+#include <inttypes.h>
 #include <stdbool.h>
 #include <stdint.h>
 #include <stdio.h>
@@ -54,6 +55,14 @@ extern const char *baseTitle;
 extern const char *baseMailto;
 extern const char *baseSubscribe;
 
+static inline struct U32 {
+	char s[sizeof("4294967295")];
+} u32(uint32_t u) {
+	struct U32 buf;
+	snprintf(buf.s, sizeof(buf.s), "%" PRIu32, u);
+	return buf;
+}
+
 static inline struct ISO8601 {
 	char s[sizeof("0000-00-00T00:00:00Z")];
 } iso8601(time_t time) {