aboutsummaryrefslogtreecommitdiff
path: root/dtc.h
diff options
context:
space:
mode:
authorDavid Gibson <david@gibson.dropbear.id.au>2009-01-05 12:50:23 +1100
committerJon Loeliger <jdl@example.com>2009-01-07 09:46:04 -0600
commitb2b4990bbf03a1b9def187cbc37488eed66a182c (patch)
treee2804549856de22dda0d8fa0d6d931d08c380357 /dtc.h
parent75bdd849dc3083038113791c4050746999d60989 (diff)
downloaddtc-b2b4990bbf03a1b9def187cbc37488eed66a182c.zip
dtc-b2b4990bbf03a1b9def187cbc37488eed66a182c.tar.gz
dtc-b2b4990bbf03a1b9def187cbc37488eed66a182c.tar.bz2
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 <david@gibson.dropbear.id.au>
Diffstat (limited to 'dtc.h')
-rw-r--r--dtc.h30
1 files changed, 0 insertions, 30 deletions
diff --git a/dtc.h b/dtc.h
index 5cb9f58..45adaed 100644
--- a/dtc.h
+++ b/dtc.h
@@ -53,36 +53,6 @@ extern int reservenum; /* Number of memory reservation slots */
extern int minsize; /* Minimum blob size */
extern int padsize; /* Additional padding to blob */
-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;
-}
-
-static inline void *xrealloc(void *p, size_t len)
-{
- void *new = realloc(p, len);
-
- if (! new)
- die("realloc() failed (len=%d)\n", len);
-
- return new;
-}
-
typedef uint32_t cell_t;