/Users/huttone/Devel/sedflux-new/sedflux/trunk/ew/hydrotrend/hydrofree_mem.c

Go to the documentation of this file.
00001 #include "hydrofree_mem.h"
00002 #include <stdlib.h>
00003 
00004 /**********************************************/
00005 /*** for freeing memory (1D "matrices") ***/
00006 /* format is: matrix name  */
00007 
00008 
00009 void freematrix1D(void *matrixname)
00010 {     
00011    free(matrixname);
00012 }
00013 
00014 
00015 /**********************************************/
00016 /*** for freeing memory (2D matrices) ***/
00017 /* format is: matrix name, number of rows */
00018 
00019 
00020 void freematrix2D(void **matrixname, int num_of_rows)
00021 {
00022    int i;
00023       
00024    for(i=0; i<num_of_rows; ++i)
00025       free(matrixname[i]);
00026       
00027    free(matrixname);
00028 }
00029 
00030 
00031 /**********************************************/
00032 /*** for freeing memory (3D matrices) ***/
00033 /* format is: matrix name, number of rows, number of columns */
00034 
00035 
00036 void freematrix3D(void ***matrixname, int num_of_rows, int num_of_columns)
00037 {
00038    int i, j;
00039       
00040    for(i=0; i<num_of_rows; ++i)
00041       for(j=0; j<num_of_columns; ++j)
00042          free(matrixname[i][j]);
00043          
00044    for(i=0; i<num_of_rows; ++i)
00045       free(matrixname[i]);     
00046      
00047    free(matrixname);
00048 }
00049 

Generated on Fri Jan 4 18:04:14 2008 for sedflux by  doxygen 1.5.2