[GRASS-SVN] r40836 - in grass/trunk: general/g.region
imagery/i.rectify include lib/g3d lib/gis lib/raster raster/r.region
svn_grass at osgeo.org
svn_grass at osgeo.org
Fri Feb 5 21:35:05 EST 2010
Author: glynn
Date: 2010-02-05 21:35:04 -0500 (Fri, 05 Feb 2010)
New Revision: 40836
Removed:
grass/trunk/lib/gis/copy.c
Modified:
grass/trunk/general/g.region/main.c
grass/trunk/imagery/i.rectify/rectify.c
grass/trunk/include/gisdefs.h
grass/trunk/lib/g3d/g3dregion.c
grass/trunk/lib/gis/env.c
grass/trunk/lib/gis/parser.c
grass/trunk/lib/gis/set_window.c
grass/trunk/lib/gis/wind_2_box.c
grass/trunk/lib/raster/opencell.c
grass/trunk/lib/raster/raster.c
grass/trunk/raster/r.region/main.c
Log:
Eliminate G_copy(); replace with memcpy() or assignment
Modified: grass/trunk/general/g.region/main.c
===================================================================
--- grass/trunk/general/g.region/main.c 2010-02-05 23:59:16 UTC (rev 40835)
+++ grass/trunk/general/g.region/main.c 2010-02-06 02:35:04 UTC (rev 40836)
@@ -414,7 +414,7 @@
G_fatal_error(_("Unable to open 3dview file <%s> in <%s>"), name,
mapset);
- G_copy(&temp_window, &window, sizeof(window));
+ temp_window = window;
if (0 > (ret = G_get_3dview(name, mapset, &v)))
G_fatal_error(_("Unable to read 3dview file <%s> in <%s>"), name,
@@ -452,7 +452,7 @@
G_fatal_error(_("Raster map <%s> not found"), rast_name);
Rast_get_cellhd(rast_name, mapset, &temp_window);
if (!first) {
- G_copy(&window, &temp_window, sizeof(window));
+ window = temp_window;
first = 1;
}
else {
@@ -500,7 +500,7 @@
if (!mapset)
G_fatal_error(_("Vector map <%s> not found"), vect_name);
- G_copy(&temp_window, &window, sizeof(window));
+ temp_window = window;
Vect_set_open_level(2);
if (2 != Vect_open_old(&Map, vect_name, mapset))
@@ -517,7 +517,7 @@
map_window.bottom = box.B;
if (!first) {
- G_copy(&window, &map_window, sizeof(window));
+ window = map_window;
first = 1;
}
else {
@@ -788,7 +788,7 @@
/* save= */
if ((name = parm.save->answer)) {
- G_copy(&temp_window, &window, sizeof(window));
+ temp_window = window;
G_adjust_Cell_head3(&temp_window, 0, 0, 0);
if (G__put_window(&temp_window, "windows", name) < 0)
G_fatal_error(_("Unable to set region <%s>"), name);
Modified: grass/trunk/imagery/i.rectify/rectify.c
===================================================================
--- grass/trunk/imagery/i.rectify/rectify.c 2010-02-05 23:59:16 UTC (rev 40835)
+++ grass/trunk/imagery/i.rectify/rectify.c 2010-02-06 02:35:04 UTC (rev 40836)
@@ -45,7 +45,7 @@
rast = (void *)G_calloc(Rast_window_cols() + 1, Rast_cell_size(map_type));
Rast_set_null_value(rast, Rast_window_cols() + 1, map_type);
- G_copy(&win, &target_window, sizeof(win));
+ win = target_window;
win.west += win.ew_res / 2;
ncols = target_window.cols;
Modified: grass/trunk/include/gisdefs.h
===================================================================
--- grass/trunk/include/gisdefs.h 2010-02-05 23:59:16 UTC (rev 40835)
+++ grass/trunk/include/gisdefs.h 2010-02-06 02:35:04 UTC (rev 40836)
@@ -124,9 +124,6 @@
int G_insert_commas(char *);
void G_remove_commas(char *);
-/* copy.c */
-void G_copy(void *, const void *, int);
-
/* copy_dir.c */
int G_recursive_copy(const char *, const char *);
Modified: grass/trunk/lib/g3d/g3dregion.c
===================================================================
--- grass/trunk/lib/g3d/g3dregion.c 2010-02-05 23:59:16 UTC (rev 40835)
+++ grass/trunk/lib/g3d/g3dregion.c 2010-02-06 02:35:04 UTC (rev 40836)
@@ -199,8 +199,6 @@
* \brief
*
* Copies the values of <em>regionSrc</em> into <em>regionDst</em>.
- * (The unfortunate order of parameters was chosen in order to conform to the
- * order used in <em>G_copy ()</em>).
*
* \param regionDest
* \param regionSrc
@@ -209,7 +207,7 @@
void G3d_regionCopy(G3D_Region * regionDest, G3D_Region * regionSrc)
{
- G_copy(regionDest, regionSrc, sizeof(G3D_Region));
+ *regionDest = *regionSrc;
}
/*---------------------------------------------------------------------------*/
Deleted: grass/trunk/lib/gis/copy.c
===================================================================
--- grass/trunk/lib/gis/copy.c 2010-02-05 23:59:16 UTC (rev 40835)
+++ grass/trunk/lib/gis/copy.c 2010-02-06 02:35:04 UTC (rev 40836)
@@ -1,33 +0,0 @@
-
-/**
- * \file copy.c
- *
- * \brief GIS Library - Memory copy functions.
- *
- * (C) 2001-2008 by the GRASS Development Team
- *
- * This program is free software under the GNU General Public License
- * (>=v2). Read the file COPYING that comes with GRASS for details.
- *
- * \author GRASS GIS Development Team
- *
- * \date 1999-2008
- */
-
-#include <grass/gis.h>
-#include <string.h>
-
-/**
- * \brief Copies <b>n</b> bytes starting at address <b>b</b> into
- * address <b>a</b>.
- *
- * \param[out] a destination (to)
- * \param[in] b source (from)
- * \param[in] n number of bytes to copy
- *
- * \return
- */
-void G_copy(void *a, const void *b, int n)
-{
- memcpy(a, b, n);
-}
Modified: grass/trunk/lib/gis/env.c
===================================================================
--- grass/trunk/lib/gis/env.c 2010-02-05 23:59:16 UTC (rev 40835)
+++ grass/trunk/lib/gis/env.c 2010-02-06 02:35:04 UTC (rev 40836)
@@ -496,7 +496,7 @@
int i;
/* copy env to env2 */
- G_copy(&st->env2, &st->env, sizeof(st->env));
+ st->env2 = st->env;
st->env.count = 0;
st->env.size = 0;
Modified: grass/trunk/lib/gis/parser.c
===================================================================
--- grass/trunk/lib/gis/parser.c 2010-02-05 23:59:16 UTC (rev 40835)
+++ grass/trunk/lib/gis/parser.c 2010-02-06 02:35:04 UTC (rev 40836)
@@ -1155,7 +1155,7 @@
if (len > 0) { /* skip ,, */
opt->answers[ans_num] = (char *)G_malloc(len + 1);
- G_copy(opt->answers[ans_num], ptr1, len);
+ memcpy(opt->answers[ans_num], ptr1, len);
opt->answers[ans_num][len] = 0;
ans_num++;
Modified: grass/trunk/lib/gis/set_window.c
===================================================================
--- grass/trunk/lib/gis/set_window.c 2010-02-05 23:59:16 UTC (rev 40835)
+++ grass/trunk/lib/gis/set_window.c 2010-02-06 02:35:04 UTC (rev 40836)
@@ -27,7 +27,7 @@
void G_get_set_window(struct Cell_head *window)
{
G__init_window();
- G_copy(window, &G__.window, sizeof(*window));
+ *window = G__.window;
}
/*!
@@ -41,15 +41,10 @@
void G_set_window(struct Cell_head *window)
{
/* adjust window, check for valid window */
- /* adjust the real one, not a copy
- G_copy (&twindow, window, sizeof(struct Cell_head));
- window = &twindow;
- */
G_adjust_Cell_head(window, 0, 0);
/* copy the window to the current window */
- G_copy((char *)&G__.window, (char *)window, sizeof(*window));
-
+ G__.window = *window;
G__.window_set = 1;
}
Modified: grass/trunk/lib/gis/wind_2_box.c
===================================================================
--- grass/trunk/lib/gis/wind_2_box.c 2010-02-05 23:59:16 UTC (rev 40835)
+++ grass/trunk/lib/gis/wind_2_box.c 2010-02-06 02:35:04 UTC (rev 40836)
@@ -35,7 +35,7 @@
{
double ew, ns;
- G_copy((char *)dst, (char *)src, sizeof(*dst));
+ *dst = *src;
/* calculate the effective resolutions */
ns = (src->ns_res * src->rows) / rows;
Modified: grass/trunk/lib/raster/opencell.c
===================================================================
--- grass/trunk/lib/raster/opencell.c 2010-02-05 23:59:16 UTC (rev 40835)
+++ grass/trunk/lib/raster/opencell.c 2010-02-06 02:35:04 UTC (rev 40836)
@@ -266,7 +266,7 @@
fcb->map_type = MAP_TYPE;
/* Save cell header */
- G_copy((char *)&fcb->cellhd, (char *)&cellhd, sizeof(cellhd));
+ fcb->cellhd = cellhd;
/* allocate null bitstream buffers for reading null rows */
fcb->null_fd = -1;
@@ -285,7 +285,7 @@
/* if reclass, copy reclass structure */
if ((fcb->reclass_flag = reclass_flag))
- G_copy(&fcb->reclass, &reclass, sizeof(reclass));
+ fcb->reclass = reclass;
fcb->gdal = gdal;
if (!gdal)
@@ -619,7 +619,7 @@
* for compressed writing
* allocate space to hold the row address array
*/
- G_copy(&fcb->cellhd, &R__.wr_window, sizeof(fcb->cellhd));
+ fcb->cellhd = R__.wr_window;
if (open_mode == OPEN_NEW_COMPRESSED && fcb->map_type == CELL_TYPE) {
fcb->row_ptr = G_calloc(fcb->cellhd.rows + 1, sizeof(off_t));
Modified: grass/trunk/lib/raster/raster.c
===================================================================
--- grass/trunk/lib/raster/raster.c 2010-02-05 23:59:16 UTC (rev 40835)
+++ grass/trunk/lib/raster/raster.c 2010-02-06 02:35:04 UTC (rev 40836)
@@ -75,7 +75,7 @@
void Rast_raster_cpy(void *v1, const void *v2, int n,
RASTER_MAP_TYPE data_type)
{
- G_copy(v1, v2, n * Rast_cell_size(data_type));
+ memcpy(v1, v2, n * Rast_cell_size(data_type));
}
/*!
Modified: grass/trunk/raster/r.region/main.c
===================================================================
--- grass/trunk/raster/r.region/main.c 2010-02-05 23:59:16 UTC (rev 40835)
+++ grass/trunk/raster/r.region/main.c 2010-02-06 02:35:04 UTC (rev 40836)
@@ -154,7 +154,7 @@
Rast_get_cellhd(name, G_mapset(), &cellhd);
- G_copy(&window, &cellhd, sizeof(window));
+ window = cellhd;
if (flag.dflt->answer)
G_get_default_window(&window);
More information about the grass-commit
mailing list