ARB
mem.h
Go to the documentation of this file.
1 // ============================================================= //
2 // //
3 // File : mem.h //
4 // Purpose : //
5 // //
6 // Institute of Microbiology (Technical University Munich) //
7 // http://www.arb-home.de/ //
8 // //
9 // ============================================================= //
10 
11 #ifndef MEM_H
12 #define MEM_H
13 
14 #ifndef _STDLIB_H
15 #include <stdlib.h>
16 #endif
17 
18 void *newBlock(size_t s);
19 void freeBlock_(void **v);
20 void **newMatrix(size_t nrow,size_t ncol,size_t s);
21 void freeMatrix_(void ***m);
22 
23 #define newVector(n,s) newBlock((n)*(s))
24 
25 #define freeBlock(v) freeBlock_((void **)(v))
26 
27 #define newDoubleVector(n) (double *)(newVector((size_t)(n),sizeof(double)))
28 #define newFloatVector(n) (float *)(newVector((size_t)(n),sizeof(float)))
29 #define newShortVector(n) (short *)(newVector((size_t)(n),sizeof(short)))
30 #define newLongVector(n) (long *)(newVector((size_t)(n),sizeof(long)))
31 #define newIntVector(n) (int *)(newVector((size_t)(n),sizeof(int)))
32 #define newCharVector(n) (char *)(newVector((size_t)(n),sizeof(char)))
33 
34 #define newDoubleMatrix(r,c) (double **)(newMatrix((size_t)(r),(size_t)(c),sizeof(double)))
35 #define newFloatMatrix(r,c) (float **)(newMatrix((size_t)(r),(size_t)(c),sizeof(float)))
36 #define newShortMatrix(r,c) (short **)(newMatrix((size_t)(r),(size_t)(c),sizeof(short)))
37 #define newLongMatrix(r,c) (long **)(newMatrix((size_t)(r),(size_t)(c),sizeof(long)))
38 #define newIntMatrix(r,c) (int **)(newMatrix((size_t)(r),(size_t)(c),sizeof(int)))
39 #define newCharMatrix(r,c) (char **)(newMatrix((size_t)(r),(size_t)(c),sizeof(char)))
40 #define freeMatrix(m) freeMatrix_((void ***)(m))
41 
42 #else
43 #error mem.h included twice
44 #endif // MEM_H
void freeMatrix_(void ***m)
Definition: mem.cxx:100
void freeBlock_(void **v)
Definition: mem.cxx:63
void ** newMatrix(size_t nrow, size_t ncol, size_t s)
Definition: mem.cxx:87
void * newBlock(size_t s)
Definition: mem.cxx:39
GB_write_int const char s
Definition: AW_awar.cxx:154