GRASS Programmer's Manual
6.4.2(2012)
|
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 00026 void *G3d_allocTilesType(G3D_Map * map, int nofTiles, int type) 00027 { 00028 void *tiles; 00029 00030 tiles = G3d_malloc(map->tileSize * G3d_length(type) * nofTiles); 00031 if (tiles == NULL) { 00032 G3d_error("G3d_allocTilesType: error in G3d_malloc"); 00033 return NULL; 00034 } 00035 00036 return tiles; 00037 } 00038 00039 /*---------------------------------------------------------------------------*/ 00040 00041 00052 void *G3d_allocTiles(G3D_Map * map, int nofTiles) 00053 { 00054 void *tiles; 00055 00056 tiles = G3d_allocTilesType(map, nofTiles, map->typeIntern); 00057 if (tiles == NULL) { 00058 G3d_error("G3d_allocTiles: error in G3d_allocTilesType"); 00059 return NULL; 00060 } 00061 00062 return tiles; 00063 } 00064 00065 /*---------------------------------------------------------------------------*/ 00066 00067 00077 void G3d_freeTiles(void *tiles) 00078 { 00079 G3d_free(tiles); 00080 }