[GRASS-SVN] r40837 - in grass/trunk: include lib/gis vector/v.in.ogr

svn_grass at osgeo.org svn_grass at osgeo.org
Fri Feb 5 21:37:43 EST 2010


Author: glynn
Date: 2010-02-05 21:37:43 -0500 (Fri, 05 Feb 2010)
New Revision: 40837

Modified:
   grass/trunk/include/gisdefs.h
   grass/trunk/lib/gis/strings.c
   grass/trunk/vector/v.in.ogr/main.c
Log:
Elminate G_strdup(); replace with G_store()


Modified: grass/trunk/include/gisdefs.h
===================================================================
--- grass/trunk/include/gisdefs.h	2010-02-06 02:35:04 UTC (rev 40836)
+++ grass/trunk/include/gisdefs.h	2010-02-06 02:37:43 UTC (rev 40837)
@@ -581,7 +581,6 @@
 void G_str_to_lower(char *);
 int G_str_to_sql(char *);
 char *G_squeeze(char *);
-char *G_strdup(const char *);
 
 /* tempfile.c */
 void G_init_tempfile(void);

Modified: grass/trunk/lib/gis/strings.c
===================================================================
--- grass/trunk/lib/gis/strings.c	2010-02-06 02:35:04 UTC (rev 40836)
+++ grass/trunk/lib/gis/strings.c	2010-02-06 02:37:43 UTC (rev 40837)
@@ -108,29 +108,6 @@
 }
 
 /*!
- * \brief Copies the null-terminated string into a newly
- * allocated string. The string is allocated using G_malloc().
- *
- * \param[in] string the string to duplicate
- *
- * \return pointer to a string that is a duplicate of the string
- *  given to G_strdup().
- * \return NULL if unable to allocate the required space
- */
-char *G_strdup(const char *string)
-{
-    char *p;
-
-    p = G_malloc(strlen(string) + 1);
-
-    if (p != NULL) {
-	strcpy(p, string);
-    }
-
-    return p;
-}
-
-/*!
  * \brief Replace all occurencies of old_str in buffer with new_str
  *
  * Code example:

Modified: grass/trunk/vector/v.in.ogr/main.c
===================================================================
--- grass/trunk/vector/v.in.ogr/main.c	2010-02-06 02:35:04 UTC (rev 40836)
+++ grass/trunk/vector/v.in.ogr/main.c	2010-02-06 02:37:43 UTC (rev 40837)
@@ -675,7 +675,7 @@
 		G_debug(3, "Ogr_ftype: %i", Ogr_ftype);	/* look up below */
 
 		if (i < ncnames - 1) {
-		    Ogr_fieldname = G_strdup(cnames_opt->answers[i + 1]);
+		    Ogr_fieldname = G_store(cnames_opt->answers[i + 1]);
 		}
 		else {
 		    /* Change column names to [A-Za-z][A-Za-z0-9_]* */
@@ -691,7 +691,7 @@
 		/* avoid that we get the 'cat' column twice */
 		if (strcmp(Ogr_fieldname, "cat") == 0) {
 		    sprintf(namebuf, "%s_", Ogr_fieldname);
-		    Ogr_fieldname = G_strdup(namebuf);
+		    Ogr_fieldname = G_store(namebuf);
 		}
 
 		/* captial column names are a pain in SQL */



More information about the grass-commit mailing list