3 /* gras/sysdep.h -- all system dependency */
4 /* no system header should be loaded out of this file so that we have only */
5 /* one file to check when porting to another OS */
7 /* Authors: Martin Quinson */
8 /* Copyright (C) 2004 the OURAGAN project. */
10 /* This program is free software; you can redistribute it and/or modify it
11 under the terms of the license (GNU LGPL) which comes with this package. */
13 #include "gras_private.h"
17 GRAS_LOG_NEW_DEFAULT_SUBCATEGORY(sysdep, gros, "System dependency");
20 **** Memory management
23 void* gras_malloc (long int bytes) {
24 void *ptr = (bytes == 0 ? NULL : (void*) malloc ((size_t) bytes));
25 gras_assert1(ptr, "Malloc of %ld bytes failed",bytes);
28 void* gras_malloc0 (long int bytes) {
29 void *ptr = (bytes == 0 ? NULL : (void*) calloc ((size_t) bytes, 1));
30 gras_assert1(ptr, "Malloc of %ld bytes failed",bytes);
34 void* gras_realloc (void *memory, long int bytes) {
39 void *ptr = (void*) realloc (memory, (size_t) bytes);
40 gras_assert1(ptr, "Realloc of %ld bytes failed",bytes);
44 char* gras_strdup (const char* str) {
45 char *ret = (char*)strdup(str);
46 gras_assert0(ret, "String duplication failed");
50 void gras_free (void *memory) {
59 void gras_abort(void) {