Bläddra i källkod

Elminate G_strdup(); replace with G_store()

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@40837 15284696-431f-4ddb-bdfa-cd5b030d7da7
Glynn Clements 15 år sedan
förälder
incheckning
0c79adbbf7
3 ändrade filer med 2 tillägg och 26 borttagningar
  1. 0 1
      include/gisdefs.h
  2. 0 23
      lib/gis/strings.c
  3. 2 2
      vector/v.in.ogr/main.c

+ 0 - 1
include/gisdefs.h

@@ -581,7 +581,6 @@ void G_str_to_upper(char *);
 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);

+ 0 - 23
lib/gis/strings.c

@@ -108,29 +108,6 @@ char *G_strchg(char *bug, char character, char new)
 }
 
 /*!
- * \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:

+ 2 - 2
vector/v.in.ogr/main.c

@@ -675,7 +675,7 @@ int main(int argc, char *argv[])
 		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 @@ int main(int argc, char *argv[])
 		/* 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 */