void pakfire_oom(size_t num, size_t len);
-void* pakfire_malloc(size_t len);
+void* malloc(size_t len);
void* pakfire_realloc(void* ptr, size_t size);
char* pakfire_strdup(const char* s);
l += strlen(e);
}
- char* buffer = pakfire_malloc(l + 1);
+ char* buffer = malloc(l + 1);
if (e)
snprintf(buffer, l + 1, "%s:%s-%s", e, v, r);
else
Queue q;
queue_init_clone(&q, &pakfire->installonly);
- const char** installonly = pakfire_malloc(sizeof(const char*) * (q.count + 1));
+ const char** installonly = malloc(sizeof(const char*) * (q.count + 1));
int i = 0;
while (q.count) {
char* n = pakfire_strdup(parser->namespace);
size_t length = ((n) ? strlen(n) : 0) + strlen(name) + 1;
- char* buffer = pakfire_malloc(length + 1);
+ char* buffer = malloc(length + 1);
struct pakfire_parser_declaration* d = NULL;
off_t start = groups[1].rm_so, end = groups[1].rm_eo;
// Get the name of the variable
- char* variable = pakfire_malloc(end - start + 1);
+ char* variable = malloc(end - start + 1);
snprintf(variable, end - start + 1, "%s", buffer + start);
DEBUG(parser->pakfire, "Expanding variable: %s\n", variable);
// Length of the new buffer
size_t length = strlen(buffer) - (end - start) + ((value) ? strlen(value) : 0);
- char* b = pakfire_malloc(length + 1);
+ char* b = malloc(length + 1);
// Copy buffer up to the beginning of the match
snprintf(b, start + 1, "%s", buffer);
exit(1);
}
-void* pakfire_malloc(size_t len) {
- void* r = malloc(len ? len : 1);
- if (!r)
- pakfire_oom(0, len);
-
- return r;
-}
-
void* pakfire_realloc(void* ptr, size_t size) {
ptr = realloc(ptr, size);
if (!ptr)
return r;
// Allocate buffer
- *buffer = pakfire_malloc((sizeof(**buffer) * *len) + 1);
+ *buffer = malloc((sizeof(**buffer) * *len) + 1);
if (!*buffer)
return -ENOMEM;
}
// Allocate an array of sufficient size
- char** ret = pakfire_malloc(sizeof(*ret) * (count + 1));
+ char** ret = malloc(sizeof(*ret) * (count + 1));
// Copy strings to heap one by one
unsigned int i = 0;
// Length of string before delim
size_t l = p - s;
- *s1 = pakfire_malloc(l);
+ *s1 = malloc(l);
snprintf(*s1, l, "%s", s);
*s2 = pakfire_strdup(p + strlen(delim));