GRASS Programmer's Manual  6.4.2(2012)
g3dalloc.c
Go to the documentation of this file.
00001 #include <stdio.h>
00002 #include <stdlib.h>
00003 #include <sys/types.h>
00004 #include <unistd.h>
00005 #include <rpc/types.h>
00006 #include <rpc/xdr.h>
00007 #include "G3d_intern.h"
00008 
00009 /*---------------------------------------------------------------------------*/
00010 
00011 
00024 void *G3d_malloc(int nBytes)
00025 {
00026     void *buf;
00027 
00028     if (nBytes <= 0)
00029         nBytes = 1;
00030     if ((buf = malloc(nBytes)) != NULL)
00031         return buf;
00032 
00033     G3d_error("G3d_malloc: out of memory");
00034     return (void *)NULL;
00035 }
00036 
00037 
00050 void *G3d_realloc(void *ptr, int nBytes)
00051 {
00052     if (nBytes <= 0)
00053         nBytes = 1;
00054     if ((ptr = realloc(ptr, nBytes)) != NULL)
00055         return ptr;
00056 
00057     G3d_error("G3d_realloc: out of memory");
00058     return (void *)NULL;
00059 }
00060 
00061 
00071 void G3d_free(void *buf)
00072 {
00073     free(buf);
00074 }
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines