comparison util.h @ 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
comparison
equal deleted inserted replaced
76:9643962908ab 77:fe78b16c694d
1 /* 1 /*
2 * util.h -- various utilities 2 * util.h -- various utilities
3 * 3 *
4 * Copyright (c) 2020-2023 David Demelier <markand@malikania.fr> 4 * Copyright (c) 2020-2023 David Demelier <markand@malikania.fr>
5 * 5 *
6 * Permission to use, copy, modify, and/or distribute this software for any 6 * Permission to use, copy, modify, and/or distribute this software for any
7 * purpose with or without fee is hereby granted, provided that the above 7 * purpose with or without fee is hereby granted, provided that the above
8 * copyright notice and this permission notice appear in all copies. 8 * copyright notice and this permission notice appear in all copies.
9 * 9 *
10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
25 #define NELEM(x) (sizeof (x) / sizeof (x)[0]) 25 #define NELEM(x) (sizeof (x) / sizeof (x)[0])
26 26
27 struct tm; 27 struct tm;
28 struct kreq; 28 struct kreq;
29 29
30 extern const char *languages[]; 30 struct duration {
31 const char *title;
32 long long int secs;
33 };
34
35 extern const char * const languages[];
31 extern const size_t languagesz; 36 extern const size_t languagesz;
37
38 extern const struct duration durations[];
39 extern const size_t durationsz;
32 40
33 void 41 void
34 die(const char *, ...); 42 die(const char *, ...);
35 43
36 char * 44 char *