Mercurial > molko
comparison src/core/util.h @ 95:e82eca4f8606
core: simplify error/panic routines
author | David Demelier <markand@malikania.fr> |
---|---|
date | Mon, 30 Mar 2020 14:07:21 +0200 |
parents | 6203e1ac9b18 |
children |
comparison
equal
deleted
inserted
replaced
94:ed72843a7194 | 95:e82eca4f8606 |
---|---|
28 * | 28 * |
29 * \note In contrast to other files, identifiers are not prefixed with `util_` | 29 * \note In contrast to other files, identifiers are not prefixed with `util_` |
30 * for convenience. | 30 * for convenience. |
31 */ | 31 */ |
32 | 32 |
33 #include <stdarg.h> | |
33 #include <stddef.h> | 34 #include <stddef.h> |
35 | |
36 #include "plat.h" | |
34 | 37 |
35 /** | 38 /** |
36 * Get the number of elements in a static array. | 39 * Get the number of elements in a static array. |
37 * | 40 * |
38 * \param x the array | 41 * \param x the array |
72 */ | 75 */ |
73 void * | 76 void * |
74 ememdup(const void *ptr, size_t size); | 77 ememdup(const void *ptr, size_t size); |
75 | 78 |
76 /** | 79 /** |
80 * Create a dynamically allocated string in the printf(3) format string. | |
81 * | |
82 * \pre fmt != NULL | |
83 * \return The heap allocated string. | |
84 * \post Returned string will never be NULL. | |
85 */ | |
86 char * | |
87 eprintf(const char *fmt, ...) PLAT_PRINTF(1, 2); | |
88 | |
89 /** | |
90 * Similar to \ref eprintf with arguments pointer. | |
91 * | |
92 * \copydoc eprintf | |
93 */ | |
94 char * | |
95 evprintf(const char *fmt, va_list ap) PLAT_PRINTF(1, 0); | |
96 | |
97 /** | |
77 * Put the thread to sleep for a given amount of milliseconds. | 98 * Put the thread to sleep for a given amount of milliseconds. |
78 * | 99 * |
79 * \param ms the number of milliseconds to wait | 100 * \param ms the number of milliseconds to wait |
80 */ | 101 */ |
81 void | 102 void |