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", len);
27 sat_malloc(size_t len)
29 void *r = malloc(len ? len : 1);
36 sat_malloc2(size_t num, size_t len)
38 if (len && (num * len) / len != num)
40 return sat_malloc(num * len);
44 sat_realloc(void *old, size_t len)
47 old = malloc(len ? len : 1);
49 old = realloc(old, len ? len : 1);
56 sat_realloc2(void *old, size_t num, size_t len)
58 if (len && (num * len) / len != num)
60 return sat_realloc(old, num * len);
64 sat_calloc(size_t num, size_t len)
67 if (num == 0 || len == 0)