diff util.c @ 77:fe78b16c694d

pasterd: refactor json utilities
author David Demelier <markand@malikania.fr>
date Thu, 16 Mar 2023 15:05:26 +0100
parents 6792975da9a0
children 9bfe5ce3cc45
line wrap: on
line diff
--- a/util.c	Thu Mar 16 13:35:17 2023 +0100
+++ b/util.c	Thu Mar 16 15:05:26 2023 +0100
@@ -2,11 +2,11 @@
  * util.c -- various utilities
  *
  * Copyright (c) 2020-2023 David Demelier <markand@malikania.fr>
- * 
+ *
  * Permission to use, copy, modify, and/or distribute this software for any
  * purpose with or without fee is hereby granted, provided that the above
  * copyright notice and this permission notice appear in all copies.
- * 
+ *
  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
@@ -30,7 +30,7 @@
 #include "util.h"
 #include "paste.h"
 
-const char *languages[] = {
+const char * const languages[] = {
 	"nohighlight",
 	"1c",
 	"abnf",
@@ -212,6 +212,15 @@
 
 const size_t languagesz = NELEM(languages);
 
+const struct duration durations[] = {
+	{ "day",        PASTE_DURATION_DAY      },
+	{ "hour",       PASTE_DURATION_HOUR     },
+	{ "week",       PASTE_DURATION_WEEK     },
+	{ "month",      PASTE_DURATION_MONTH    }
+};
+
+const size_t durationsz = NELEM(durations);
+
 void
 die(const char *fmt, ...)
 {