Explorar el Código

libgis: G__alloca() -> G_alloca()
update modules
(merge r63858-9 from trunk)


git-svn-id: https://svn.osgeo.org/grass/grass/branches/releasebranch_7_0@63860 15284696-431f-4ddb-bdfa-cd5b030d7da7

Martin Landa hace 10 años
padre
commit
6e5b46c3ef
Se han modificado 5 ficheros con 60 adiciones y 60 borrados
  1. 2 2
      lib/gis/parser_interface.c
  2. 28 28
      lib/raster/get_row.c
  3. 4 4
      lib/raster/get_row_colr.c
  4. 10 10
      lib/raster/put_row.c
  5. 16 16
      raster/r.mapcalc/map.c

+ 2 - 2
lib/gis/parser_interface.c

@@ -59,7 +59,7 @@ static void print_escaped_for_xml(FILE *fp, const char *str)
 	char *src = (char *) str;
 	size_t srclen = strlen(src);
 	size_t dstlen = srclen * 4 + 1;
-	char *dst = G__alloca(dstlen);
+	char *dst = G_alloca(dstlen);
 	size_t ret;
 
 	enc = dst;
@@ -90,7 +90,7 @@ static void print_escaped_for_xml(FILE *fp, const char *str)
 
 #ifdef HAVE_ICONV_H
     if (enc)
-	G__freea(enc);
+	G_freea(enc);
 
     if (conv != (iconv_t) -1)
 	iconv_close(conv);

+ 28 - 28
lib/raster/get_row.c

@@ -135,10 +135,10 @@ static void read_data_compressed(int fd, int row, unsigned char *data_buf,
 	G_fatal_error(_("Error reading raster data for row %d of <%s>"),
 		      row, fcb->name);
 
-    cmp = G__alloca(readamount);
+    cmp = G_alloca(readamount);
 
     if (read(fcb->data_fd, cmp, readamount) != readamount) {
-	G__freea(cmp);
+	G_freea(cmp);
 	G_fatal_error(_("Error reading raster data for row %d of <%s>"),
 		      row, fcb->name);
     }
@@ -162,7 +162,7 @@ static void read_data_compressed(int fd, int row, unsigned char *data_buf,
     else
 	memcpy(data_buf, cmp, readamount);
 
-    G__freea(cmp);
+    G_freea(cmp);
 }
 
 static void read_data_uncompressed(int fd, int row, unsigned char *data_buf,
@@ -195,7 +195,7 @@ static void read_data_gdal(int fd, int row, unsigned char *data_buf,
     if (fcb->gdal->vflip)
 	row = fcb->cellhd.rows - 1 - row;
 
-    buf = fcb->gdal->hflip ? G__alloca(fcb->cellhd.cols * fcb->cur_nbytes)
+    buf = fcb->gdal->hflip ? G_alloca(fcb->cellhd.cols * fcb->cur_nbytes)
 	: data_buf;
 
     err =
@@ -210,7 +210,7 @@ static void read_data_gdal(int fd, int row, unsigned char *data_buf,
 	    memcpy(data_buf + i * fcb->cur_nbytes,
 		   buf + (fcb->cellhd.cols - 1 - i) * fcb->cur_nbytes,
 		   fcb->cur_nbytes);
-	G__freea(buf);
+	G_freea(buf);
     }
 
     if (err != CE_None)
@@ -454,7 +454,7 @@ static void transfer_to_cell_XX(int fd, void *cell)
 static void transfer_to_cell_fi(int fd, void *cell)
 {
     struct fileinfo *fcb = &R__.fileinfo[fd];
-    FCELL *work_buf = G__alloca(R__.rd_window.cols * sizeof(FCELL));
+    FCELL *work_buf = G_alloca(R__.rd_window.cols * sizeof(FCELL));
     int i;
 
     transfer_to_cell_XX(fd, work_buf);
@@ -463,13 +463,13 @@ static void transfer_to_cell_fi(int fd, void *cell)
 	((CELL *) cell)[i] = (fcb->col_map[i] == 0)
 	    ? 0 : Rast_quant_get_cell_value(&fcb->quant, work_buf[i]);
 
-    G__freea(work_buf);
+    G_freea(work_buf);
 }
 
 static void transfer_to_cell_di(int fd, void *cell)
 {
     struct fileinfo *fcb = &R__.fileinfo[fd];
-    DCELL *work_buf = G__alloca(R__.rd_window.cols * sizeof(DCELL));
+    DCELL *work_buf = G_alloca(R__.rd_window.cols * sizeof(DCELL));
     int i;
 
     transfer_to_cell_XX(fd, work_buf);
@@ -478,12 +478,12 @@ static void transfer_to_cell_di(int fd, void *cell)
 	((CELL *) cell)[i] = (fcb->col_map[i] == 0)
 	    ? 0 : Rast_quant_get_cell_value(&fcb->quant, work_buf[i]);
 
-    G__freea(work_buf);
+    G_freea(work_buf);
 }
 
 static void transfer_to_cell_if(int fd, void *cell)
 {
-    CELL *work_buf = G__alloca(R__.rd_window.cols * sizeof(CELL));
+    CELL *work_buf = G_alloca(R__.rd_window.cols * sizeof(CELL));
     int i;
 
     transfer_to_cell_XX(fd, work_buf);
@@ -491,12 +491,12 @@ static void transfer_to_cell_if(int fd, void *cell)
     for (i = 0; i < R__.rd_window.cols; i++)
 	((FCELL *) cell)[i] = work_buf[i];
 
-    G__freea(work_buf);
+    G_freea(work_buf);
 }
 
 static void transfer_to_cell_df(int fd, void *cell)
 {
-    DCELL *work_buf = G__alloca(R__.rd_window.cols * sizeof(DCELL));
+    DCELL *work_buf = G_alloca(R__.rd_window.cols * sizeof(DCELL));
     int i;
 
     transfer_to_cell_XX(fd, work_buf);
@@ -504,12 +504,12 @@ static void transfer_to_cell_df(int fd, void *cell)
     for (i = 0; i < R__.rd_window.cols; i++)
 	((FCELL *) cell)[i] = work_buf[i];
 
-    G__freea(work_buf);
+    G_freea(work_buf);
 }
 
 static void transfer_to_cell_id(int fd, void *cell)
 {
-    CELL *work_buf = G__alloca(R__.rd_window.cols * sizeof(CELL));
+    CELL *work_buf = G_alloca(R__.rd_window.cols * sizeof(CELL));
     int i;
 
     transfer_to_cell_XX(fd, work_buf);
@@ -517,12 +517,12 @@ static void transfer_to_cell_id(int fd, void *cell)
     for (i = 0; i < R__.rd_window.cols; i++)
 	((DCELL *) cell)[i] = work_buf[i];
 
-    G__freea(work_buf);
+    G_freea(work_buf);
 }
 
 static void transfer_to_cell_fd(int fd, void *cell)
 {
-    FCELL *work_buf = G__alloca(R__.rd_window.cols * sizeof(FCELL));
+    FCELL *work_buf = G_alloca(R__.rd_window.cols * sizeof(FCELL));
     int i;
 
     transfer_to_cell_XX(fd, work_buf);
@@ -530,7 +530,7 @@ static void transfer_to_cell_fd(int fd, void *cell)
     for (i = 0; i < R__.rd_window.cols; i++)
 	((DCELL *) cell)[i] = work_buf[i];
 
-    G__freea(work_buf);
+    G_freea(work_buf);
 }
 
 /*
@@ -588,7 +588,7 @@ static void get_map_row(int fd, void *rast, int row, RASTER_MAP_TYPE data_type,
     int i;
 
     if (fcb->reclass_flag && data_type != CELL_TYPE) {
-	temp_buf = G__alloca(R__.rd_window.cols * sizeof(CELL));
+	temp_buf = G_alloca(R__.rd_window.cols * sizeof(CELL));
 	buf = temp_buf;
 	type = CELL_TYPE;
     }
@@ -615,7 +615,7 @@ static void get_map_row(int fd, void *rast, int row, RASTER_MAP_TYPE data_type,
 	rast = G_incr_void_ptr(rast, size);
     }
 
-    G__freea(temp_buf);
+    G_freea(temp_buf);
 }
 
 /*!
@@ -854,13 +854,13 @@ static void get_null_value_row_nomask(int fd, char *flags, int row)
 	    fcb->null_cur_row = -1;
 	    if (fcb->map_type == CELL_TYPE) {
 		/* If can't read null row, assume  that all map 0's are nulls */
-		CELL *mask_buf = G__alloca(R__.rd_window.cols * sizeof(CELL));
+		CELL *mask_buf = G_alloca(R__.rd_window.cols * sizeof(CELL));
 
 		get_map_row_nomask(fd, mask_buf, row, CELL_TYPE);
 		for (j = 0; j < R__.rd_window.cols; j++)
 		    flags[j] = (mask_buf[j] == 0);
 
-		G__freea(mask_buf);
+		G_freea(mask_buf);
 	    }
 	    else {		/* fp map */
 		/* if can't read null row, assume  that all data is valid */
@@ -915,14 +915,14 @@ static void get_null_value_row_gdal(int fd, char *flags, int row)
 
 static void embed_mask(char *flags, int row)
 {
-    CELL *mask_buf = G__alloca(R__.rd_window.cols * sizeof(CELL));
+    CELL *mask_buf = G_alloca(R__.rd_window.cols * sizeof(CELL));
     int i;
 
     if (R__.auto_mask <= 0)
 	return;
 
     if (get_map_row_nomask(R__.mask_fd, mask_buf, row, CELL_TYPE) < 0) {
-	G__freea(mask_buf);
+	G_freea(mask_buf);
 	return;
     }
 
@@ -935,7 +935,7 @@ static void embed_mask(char *flags, int row)
 	if (mask_buf[i] == 0 || Rast_is_c_null_value(&mask_buf[i]))
 	    flags[i] = 1;
 
-    G__freea(mask_buf);
+    G_freea(mask_buf);
 }
 
 static void get_null_value_row(int fd, char *flags, int row, int with_mask)
@@ -967,7 +967,7 @@ static void embed_nulls(int fd, void *buf, int row, RASTER_MAP_TYPE map_type,
 	&& (R__.auto_mask <= 0 || !with_mask))
 	return;
 
-    null_buf = G__alloca(R__.rd_window.cols);
+    null_buf = G_alloca(R__.rd_window.cols);
 
     get_null_value_row(fd, null_buf, row, with_mask);
 
@@ -982,7 +982,7 @@ static void embed_nulls(int fd, void *buf, int row, RASTER_MAP_TYPE map_type,
 	buf = G_incr_void_ptr(buf, size);
     }
 
-    G__freea(null_buf);
+    G_freea(null_buf);
 }
 
 /*!
@@ -1009,13 +1009,13 @@ void Rast_get_null_value_row(int fd, char *flags, int row)
     if (!fcb->reclass_flag)
 	get_null_value_row(fd, flags, row, 1);
     else {
-	CELL *buf = G__alloca(R__.rd_window.cols * sizeof(CELL));
+	CELL *buf = G_alloca(R__.rd_window.cols * sizeof(CELL));
 	int i;
 
 	Rast_get_c_row(fd, buf, row);
 	for (i = 0; i < R__.rd_window.cols; i++)
 	    flags[i] = Rast_is_c_null_value(&buf[i]) ? 1 : 0;
 
-	G__freea(buf);
+	G_freea(buf);
     }
 }

+ 4 - 4
lib/raster/get_row_colr.c

@@ -48,7 +48,7 @@ void Rast_get_row_colors(int fd, int row, struct Colors *colors,
     void *p;
     int i;
 
-    array = G__alloca(cols * size);
+    array = G_alloca(cols * size);
 
     Rast_get_row(fd, array, row, type);
 
@@ -56,10 +56,10 @@ void Rast_get_row_colors(int fd, int row, struct Colors *colors,
 	for (i = 0, p = array; i < cols; i++, p = G_incr_void_ptr(p, size))
 	    nul[i] = Rast_is_null_value(p, type);
 
-    set = G__alloca(cols);
+    set = G_alloca(cols);
 
     Rast_lookup_colors(array, red, grn, blu, set, cols, colors, type);
 
-    G__freea(array);
-    G__freea(set);
+    G_freea(array);
+    G_freea(set);
 }

+ 10 - 10
lib/raster/put_row.c

@@ -193,7 +193,7 @@ static void put_fp_data(int fd, char *null_buf, const void *rast,
     if (n <= 0)
 	return;
 
-    work_buf = G__alloca(size + 1);
+    work_buf = G_alloca(size + 1);
 
     if (compressed)
 	set_file_pointer(fd, row);
@@ -208,7 +208,7 @@ static void put_fp_data(int fd, char *null_buf, const void *rast,
     else
 	write_data(fd, row, work_buf, n);
 
-    G__freea(work_buf);
+    G_freea(work_buf);
 }
 
 static void convert_int(unsigned char *wk, char *null_buf, const CELL * rast,
@@ -348,7 +348,7 @@ static void put_data(int fd, char *null_buf, const CELL * cell,
     if (n <= 0)
 	return;
 
-    work_buf = G__alloca(fcb->cellhd.cols * sizeof(CELL) + 1);
+    work_buf = G_alloca(fcb->cellhd.cols * sizeof(CELL) + 1);
     wk = work_buf;
 
     if (compressed)
@@ -373,7 +373,7 @@ static void put_data(int fd, char *null_buf, const CELL * cell,
 	    trim_bytes(wk, n, len, len - nbytes);
 
 	total = nbytes * n;
-	compressed_buf = G__alloca(total + 1);
+	compressed_buf = G_alloca(total + 1);
 
 	compressed_buf[0] = work_buf[0] = nbytes;
 
@@ -396,7 +396,7 @@ static void put_data(int fd, char *null_buf, const CELL * cell,
 			      row, fcb->name);
 	}
 
-	G__freea(compressed_buf);
+	G_freea(compressed_buf);
     }
     else {
 	nwrite = fcb->nbytes * n;
@@ -406,7 +406,7 @@ static void put_data(int fd, char *null_buf, const CELL * cell,
 			  row, fcb->name);
     }
 
-    G__freea(work_buf);
+    G_freea(work_buf);
 }
 
 static void put_data_gdal(int fd, const void *rast, int row, int n,
@@ -428,7 +428,7 @@ static void put_data_gdal(int fd, const void *rast, int row, int n,
     if (n <= 0)
 	return;
 
-    work_buf = G__alloca(n * size);
+    work_buf = G_alloca(n * size);
 
     switch (map_type) {
     case CELL_TYPE:
@@ -458,7 +458,7 @@ static void put_data_gdal(int fd, const void *rast, int row, int n,
     err = Rast_gdal_raster_IO(fcb->gdal->band, GF_Write, 0, row, n, 1,
 			      work_buf, n, 1, datatype, 0, 0);
 
-    G__freea(work_buf);
+    G_freea(work_buf);
 
     if (err != CE_None)
 	G_fatal_error(_("Error writing data via GDAL for row %d of <%s>"),
@@ -696,7 +696,7 @@ static void put_raster_row(int fd, const void *buf, RASTER_MAP_TYPE data_type,
 	return;
     }
 
-    null_buf = G__alloca(fcb->cellhd.cols);
+    null_buf = G_alloca(fcb->cellhd.cols);
     G_zero(null_buf, fcb->cellhd.cols);
 
     put_raster_data(fd, null_buf, buf, fcb->cur_row, fcb->cellhd.cols,
@@ -719,5 +719,5 @@ static void put_raster_row(int fd, const void *buf, RASTER_MAP_TYPE data_type,
     if (!fcb->gdal)
 	put_null_value_row(fd, null_buf);
 
-    G__freea(null_buf);
+    G_freea(null_buf);
 }

+ 16 - 16
raster/r.mapcalc/map.c

@@ -159,9 +159,9 @@ static void *cache_get_raw(struct row_cache *cache, int row, int data_type)
 	return sub->buf[0];
     }
 
-    tmp = G__alloca(cache->nrows * sizeof(void *));
+    tmp = G_alloca(cache->nrows * sizeof(void *));
     memcpy(tmp, sub->buf, cache->nrows * sizeof(void *));
-    vtmp = G__alloca(cache->nrows);
+    vtmp = G_alloca(cache->nrows);
     memcpy(vtmp, sub->valid, cache->nrows);
 
     i = (i < 0)
@@ -179,8 +179,8 @@ static void *cache_get_raw(struct row_cache *cache, int row, int data_type)
     }
 
     sub->row = newrow;
-    G__freea(tmp);
-    G__freea(vtmp);
+    G_freea(tmp);
+    G_freea(vtmp);
 
     Rast_get_row(cache->fd, sub->buf[i], row, data_type);
     sub->valid[i] = 1;
@@ -226,10 +226,10 @@ static void init_cats(struct map *m)
 static void translate_from_colors(struct map *m, DCELL *rast, CELL *cell,
 				  int ncols, int mod)
 {
-    unsigned char *red = G__alloca(columns);
-    unsigned char *grn = G__alloca(columns);
-    unsigned char *blu = G__alloca(columns);
-    unsigned char *set = G__alloca(columns);
+    unsigned char *red = G_alloca(columns);
+    unsigned char *grn = G_alloca(columns);
+    unsigned char *blu = G_alloca(columns);
+    unsigned char *set = G_alloca(columns);
     int i;
 
     Rast_lookup_d_colors(rast, red, grn, blu, set, ncols, &m->colors);
@@ -270,10 +270,10 @@ static void translate_from_colors(struct map *m, DCELL *rast, CELL *cell,
 	break;
     }
 
-    G__freea(red);
-    G__freea(grn);
-    G__freea(blu);
-    G__freea(set);
+    G_freea(red);
+    G_freea(grn);
+    G_freea(blu);
+    G_freea(set);
 }
 
 /* convert cell values to double based on the values in the
@@ -598,10 +598,10 @@ void get_map_row(int idx, int mod, int depth, int row, int col, void *buf,
 	read_map(m, buf, res_type, row, col);
 	break;
     case '@':
-	ibuf = G__alloca(columns * sizeof(CELL));
+	ibuf = G_alloca(columns * sizeof(CELL));
 	read_map(m, ibuf, CELL_TYPE, row, col);
 	translate_from_cats(m, ibuf, buf, columns);
-	G__freea(ibuf);
+	G_freea(ibuf);
 	break;
     case 'r':
     case 'g':
@@ -609,10 +609,10 @@ void get_map_row(int idx, int mod, int depth, int row, int col, void *buf,
     case '#':
     case 'y':
     case 'i':
-	fbuf = G__alloca(columns * sizeof(DCELL));
+	fbuf = G_alloca(columns * sizeof(DCELL));
 	read_map(m, fbuf, DCELL_TYPE, row, col);
 	translate_from_colors(m, fbuf, buf, columns, mod);
-	G__freea(fbuf);
+	G_freea(fbuf);
 	break;
     default:
 	G_fatal_error(_("Invalid map modifier: '%c'"), mod);