2 * Copyright (c) 2007, Novell Inc.
4 * This program is licensed under the BSD license, read LICENSE.BSD
5 * for further information
14 #include "sat_debug.h"
19 void *r = malloc(len ? len : 1);
22 sat_debug (ERROR, "Out of memory allocating %zu bytes!\n", len);
27 xmalloc2(size_t num, size_t len)
29 if (len && (num * len) / len != num)
31 sat_debug (ERROR, "Out of memory allocating %zu*%zu bytes!\n", num, len);
34 return xmalloc(num * len);
38 xrealloc(void *old, size_t len)
41 old = malloc(len ? len : 1);
43 old = realloc(old, len ? len : 1);
46 sat_debug (ERROR, "Out of memory reallocating %zu bytes!\n", len);
51 xrealloc2(void *old, size_t num, size_t len)
53 if (len && (num * len) / len != num)
55 sat_debug (ERROR, "Out of memory allocating %zu*%zu bytes!\n", num, len);
58 return xrealloc(old, num * len);
62 xcalloc(size_t num, size_t len)
65 if (num == 0 || len == 0)
71 sat_debug (ERROR, "Out of memory allocating %zu bytes!\n", num * len);