From b2b4990bbf03a1b9def187cbc37488eed66a182c Mon Sep 17 00:00:00 2001 From: David Gibson Date: Mon, 5 Jan 2009 12:50:23 +1100 Subject: dtc: Move some functions to util.[ch] Now that we have a util.[ch] file shared between dtc and convert-dtsv0, move some functions which are currently duplicated in the two to util files. Specifically we move the die(), xmalloc() and xrealloc() functions. While we're at it, add standard double-include protection to util.h Signed-off-by: David Gibson --- convert-dtsv0-lexer.l | 20 -------------------- 1 file changed, 20 deletions(-) (limited to 'convert-dtsv0-lexer.l') diff --git a/convert-dtsv0-lexer.l b/convert-dtsv0-lexer.l index 9e75085..59137f1 100644 --- a/convert-dtsv0-lexer.l +++ b/convert-dtsv0-lexer.l @@ -52,26 +52,6 @@ static char *last_name; /* = NULL */ #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) -static inline void __attribute__((noreturn)) die(char * str, ...) -{ - va_list ap; - - va_start(ap, str); - fprintf(stderr, "FATAL ERROR: "); - vfprintf(stderr, str, ap); - exit(1); -} - -static inline void *xmalloc(size_t len) -{ - void *new = malloc(len); - - if (! new) - die("malloc() failed\n"); - - return new; -} - const struct { const char *pattern; int obase, width; -- cgit v1.1