#include <stdlib.h>#include <errno.h>#include <string.h>#include "gwlib.h"Include dependency graph for gwmem-native.c:

Go to the source code of this file.
Functions | |
| void * | gw_native_noop (void *ptr) |
| void * | gw_native_malloc (size_t size) |
| void * | gw_native_realloc (void *ptr, size_t size) |
| void | gw_native_free (void *ptr) |
| char * | gw_native_strdup (const char *str) |
|
|
Definition at line 108 of file gwmem-native.c. References free. 00109 {
00110 free(ptr);
00111 }
|
|
|
Definition at line 79 of file gwmem-native.c. References gw_assert, malloc, panic, and size. Referenced by gw_native_strdup(). 00080 {
00081 void *ptr;
00082
00083 /* ANSI C89 says malloc(0) is implementation-defined. Avoid it. */
00084 gw_assert(size > 0);
00085
00086 ptr = malloc(size);
00087 if (ptr == NULL)
00088 panic(errno, "Memory allocation failed");
00089
00090 return ptr;
00091 }
|
|
|
Definition at line 77 of file gwmem-native.c. 00077 { return ptr; }
|
|
||||||||||||
|
Definition at line 94 of file gwmem-native.c. References gw_assert, panic, realloc, and size. 00095 {
00096 void *new_ptr;
00097
00098 gw_assert(size > 0);
00099
00100 new_ptr = realloc(ptr, size);
00101 if (new_ptr == NULL)
00102 panic(errno, "Memory re-allocation failed");
00103
00104 return new_ptr;
00105 }
|
|
|
Definition at line 114 of file gwmem-native.c. References gw_assert, and gw_native_malloc(). 00115 {
00116 char *copy;
00117
00118 gw_assert(str != NULL);
00119
00120 copy = gw_native_malloc(strlen(str) + 1);
00121 strcpy(copy, str);
00122 return copy;
00123 }
|
Here is the call graph for this function:
