summaryrefslogtreecommitdiffstats
path: root/common.h
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2022-01-04 21:15:13 +0100
committerMattias Andrée <maandree@kth.se>2022-01-04 21:15:13 +0100
commitcb0d932597377a6dbc595dbe13f55c9a2cf1ad00 (patch)
tree80ec6488e06a260229acb8a45afc44f5c84a3a48 /common.h
parentRename to makel (diff)
downloadmakel-cb0d932597377a6dbc595dbe13f55c9a2cf1ad00.tar.gz
makel-cb0d932597377a6dbc595dbe13f55c9a2cf1ad00.tar.bz2
makel-cb0d932597377a6dbc595dbe13f55c9a2cf1ad00.tar.xz
Replace dependency on libsimple with boilerplate code
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 'common.h')
-rw-r--r--common.h25
1 files changed, 23 insertions, 2 deletions
diff --git a/common.h b/common.h
index 35988cc..8d2a5f4 100644
--- a/common.h
+++ b/common.h
@@ -1,10 +1,19 @@
/* See LICENSE file for copyright and license details. */
+#include <ctype.h>
+#include <errno.h>
+#include <fcntl.h>
#include <locale.h>
+#include <stdarg.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <wchar.h>
-#include <libsimple.h>
-#include <libsimple-arg.h>
#include <grapheme.h>
+#include "arg.h"
+
#if defined(__GNUC__)
# pragma GCC diagnostic ignored "-Wsuggest-attribute=format"
@@ -24,6 +33,10 @@
#define EXIT_ERROR 8
+#define ELEMSOF(ARRAY) (sizeof(ARRAY) / sizeof(*(ARRAY)))
+#define MAX(A, B) ((A) > (B) ? (A) : (B))
+
+
#define LIST_WARNING_CLASSES(X)\
X(WC_MAKEFILE, "makefile", INFORM)\
X(WC_EXTRA_MAKEFILE, "extra-makefile", WARN)\
@@ -121,3 +134,11 @@ void xprintwarningf(enum warning_class class, int severity, const char *fmt, ...
#define warnf_undefined(CLASS, ...) xprintwarningf(CLASS, EXIT_UNDEFINED, __VA_ARGS__)
void printerrorf(const char *fmt, ...);
void printtipf(enum warning_class class, const char *fmt, ...);
+
+
+/* util.c */
+void *erealloc(void *, size_t);
+void *ecalloc(size_t, size_t);
+void *emalloc(size_t);
+void *ememdup(const void *, size_t);
+void eprintf(const char *, ...);