2 * Copyright (C) 2006 Michael Buesch <mb@bu3sch.de>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2
6 * as published by the Free Software Foundation.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
20 void dump(const char *data,
22 const char *description)
27 fprintf(stderr, "Data dump (%s, %zd bytes):",
29 for (i = 0; i < size; i++) {
32 fprintf(stderr, "\n0x%08zx: 0x%02x, ",
35 fprintf(stderr, "0x%02x, ", c & 0xff);
37 fprintf(stderr, "\n");
40 void * xmalloc(size_t size)
46 fprintf(stderr, "Out of memory\n");
54 char * xstrdup(const char *str)
60 fprintf(stderr, "Out of memory\n");
67 void * xrealloc(void *in, size_t size)
71 out = realloc(in, size);
73 fprintf(stderr, "Out of memory\n");