2 * Copyright (c) 2007, Novell Inc.
4 * This program is licensed under the BSD license, read LICENSE.BSD
5 * for further information
16 sat_oom(size_t num, size_t len)
19 fprintf(stderr, "Out of memory allocating %zu*%zu bytes!\n", num, len);
21 fprintf(stderr, "Out of memory allocating %zu bytes!\n", num);
26 sat_malloc(size_t len)
28 void *r = malloc(len ? len : 1);
35 sat_malloc2(size_t num, size_t len)
37 if (len && (num * len) / len != num)
39 return sat_malloc(num * len);
43 sat_realloc(void *old, size_t len)
46 old = malloc(len ? len : 1);
48 old = realloc(old, len ? len : 1);
55 sat_realloc2(void *old, size_t num, size_t len)
57 if (len && (num * len) / len != num)
59 return sat_realloc(old, num * len);
63 sat_calloc(size_t num, size_t len)
66 if (num == 0 || len == 0)