[GRASS-SVN] r33963 - grass-addons/raster/r.sun_horizon/r.horizon

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Oct 21 18:07:14 EDT 2008


Author: neteler
Date: 2008-10-21 18:07:13 -0400 (Tue, 21 Oct 2008)
New Revision: 33963

Modified:
   grass-addons/raster/r.sun_horizon/r.horizon/main.c
Log:
use G_malloc() to catch errors instead of malloc()

Modified: grass-addons/raster/r.sun_horizon/r.horizon/main.c
===================================================================
--- grass-addons/raster/r.sun_horizon/r.horizon/main.c	2008-10-21 22:05:52 UTC (rev 33962)
+++ grass-addons/raster/r.sun_horizon/r.horizon/main.c	2008-10-21 22:07:13 UTC (rev 33963)
@@ -34,7 +34,6 @@
 #include <stdlib.h>
 #include <string.h>
 #include <math.h>
-#include <malloc.h>
 #include <grass/gis.h>
 #include <grass/gprojects.h>
 #include <grass/glocale.h>
@@ -540,14 +539,14 @@
 
     cell1 = G_allocate_f_raster_buf();
 
-    z = (float **)malloc(sizeof(float *) * (m));
-    z100 = (float **)malloc(sizeof(float *) * (m100));
+    z = (float **)G_malloc(sizeof(float *) * (m));
+    z100 = (float **)G_malloc(sizeof(float *) * (m100));
 
     for (l = 0; l < m; l++) {
-	z[l] = (float *)malloc(sizeof(float) * (n));
+	z[l] = (float *)G_malloc(sizeof(float) * (n));
     }
     for (l = 0; l < m100; l++) {
-	z100[l] = (float *)malloc(sizeof(float) * (n100));
+	z100[l] = (float *)G_malloc(sizeof(float) * (n100));
     }
     /*read Z raster */
 
@@ -1108,10 +1107,10 @@
 	/****************************************************************/
 
 	if (horizon != NULL) {
-	    horizon_raster = (float **)malloc(sizeof(float *) * (hor_numrows));
+	    horizon_raster = (float **)G_malloc(sizeof(float *) * (hor_numrows));
 	    for (l = 0; l < hor_numrows; l++) {
 		horizon_raster[l] =
-		    (float *)malloc(sizeof(float) * (hor_numcols));
+		    (float *)G_malloc(sizeof(float) * (hor_numcols));
 	    }
 
 	    for (j = 0; j < hor_numrows; j++) {



More information about the grass-commit mailing list