[GRASS-SVN] r38776 - grass/branches/develbranch_6/raster/r.li/r.li.daemon

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Aug 18 05:04:50 EDT 2009


Author: hamish
Date: 2009-08-18 05:04:49 -0400 (Tue, 18 Aug 2009)
New Revision: 38776

Modified:
   grass/branches/develbranch_6/raster/r.li/r.li.daemon/daemon.c
   grass/branches/develbranch_6/raster/r.li/r.li.daemon/list.c
Log:
malloc to G_malloc, whitespace

Modified: grass/branches/develbranch_6/raster/r.li/r.li.daemon/daemon.c
===================================================================
--- grass/branches/develbranch_6/raster/r.li/r.li.daemon/daemon.c	2009-08-17 17:24:05 UTC (rev 38775)
+++ grass/branches/develbranch_6/raster/r.li/r.li.daemon/daemon.c	2009-08-18 09:04:49 UTC (rev 38776)
@@ -633,6 +633,7 @@
     return ERROR;
 }
 
+
 int next_Area(int parsed, list l, g_areas g, msg * m)
 {
     if (parsed == NORMAL) {
@@ -652,6 +653,7 @@
     }
 }
 
+
 int print_Output(int out, msg m)
 {
     if (m.type != DONE)
@@ -662,6 +664,7 @@
 
 	sprintf(s, "RESULT %i|%f\n", m.f.f_d.aid, m.f.f_d.res);
 	len = strlen(s);
+
 	if (write(out, s, len) == len)
 	    return 1;
 	else
@@ -669,6 +672,7 @@
     }
 }
 
+
 int error_Output(int out, msg m)
 {
     if (m.type != ERROR)
@@ -677,6 +681,7 @@
 	char s[100];
 
 	sprintf(s, "ERROR %i", m.f.f_d.aid);
+
 	if (write(out, s, strlen(s)) == strlen(s))
 	    return 1;
 	else
@@ -684,6 +689,7 @@
     }
 }
 
+
 int raster_Output(int fd, int aid, g_areas g, double res)
 {
     double toPut = res;
@@ -693,11 +699,14 @@
 	G_message(_("Cannot make lseek"));
 	return -1;
     }
+
     if (write(fd, &toPut, sizeof(double)) == 0)
 	return 1;
     else
 	return 0;
 }
+
+
 int write_raster(int mv_fd, int random_access, g_areas g)
 {
     int i = 0, j = 0, letti = 0;
@@ -709,24 +718,33 @@
     rows = g->rows;
     center = g->sf_x + ((int)g->cl / 2);
 
-    file_buf = malloc(cols * sizeof(double));
+    file_buf = G_malloc(cols * sizeof(double));
     lseek(random_access, 0, SEEK_SET);
+
     cell_buf = G_allocate_d_raster_buf();
     G_set_d_null_value(cell_buf, G_window_cols() + 1);
+
     for (i = 0; i < g->sf_y + ((int)g->rl / 2); i++) {
 	G_put_raster_row(mv_fd, cell_buf, DCELL_TYPE);
     }
+
     for (i = 0; i < rows; i++) {
 	letti = read(random_access, file_buf, (cols * sizeof(double)));
+
 	if (letti == -1)
 	    G_message("%s", strerror(errno));
+
 	for (j = 0; j < cols; j++) {
 	    cell_buf[j + center] = file_buf[j];
 	}
+
 	G_put_raster_row(mv_fd, cell_buf, DCELL_TYPE);
     }
+
     G_set_d_null_value(cell_buf, G_window_cols() + 1);
+
     for (i = 0; i < G_window_rows() - g->sf_y - g->rows; i++)
 	G_put_raster_row(mv_fd, cell_buf, DCELL_TYPE);
+
     return 1;
 }

Modified: grass/branches/develbranch_6/raster/r.li/r.li.daemon/list.c
===================================================================
--- grass/branches/develbranch_6/raster/r.li/r.li.daemon/list.c	2009-08-17 17:24:05 UTC (rev 38775)
+++ grass/branches/develbranch_6/raster/r.li/r.li.daemon/list.c	2009-08-18 09:04:49 UTC (rev 38776)
@@ -29,11 +29,13 @@
 {
     node new;
 
-    new = malloc(sizeof(node));
-    new->m = malloc(sizeof(msg));
+    new = G_malloc(sizeof(node));
+    new->m = G_malloc(sizeof(msg));
+
     if (new != NULL) {
 	memcpy(new->m, &mess, sizeof(msg));
 	new->next = new->prev = NULL;
+
 	if (l->head == NULL) {
 	    l->head = l->tail = new;
 	}
@@ -45,6 +47,7 @@
     }
     else
 	G_message(_("Out of memory"));
+
     l->size++;
 }
 



More information about the grass-commit mailing list