cppalloc.c: Add xstrdup here.
authorZack Weinberg <zack@rabi.phys.columbia.edu>
Tue, 15 Dec 1998 11:23:27 +0000 (11:23 +0000)
committerDave Brolley <brolley@gcc.gnu.org>
Tue, 15 Dec 1998 11:23:27 +0000 (06:23 -0500)
1998-12-15  Zack Weinberg  <zack@rabi.phys.columbia.edu>
* cppalloc.c: Add xstrdup here.
* cpplib.h: Remove savestring prototype.
* cpplib.c: Remove savestring function. s/savestring/xstrdup/
  throughout.
* cppfiles.c: s/savestring/xstrdup/ throughout.

From-SVN: r24327

gcc/ChangeLog
gcc/cppalloc.c
gcc/cppfiles.c
gcc/cpplib.c
gcc/cpplib.h

index ea9f1d09178c4e65ec67e66518082c0cff152f6e..0b4e5a84db9dd6667e3a6b110bb2574ea665e6d6 100644 (file)
@@ -1,3 +1,11 @@
+1998-12-15  Zack Weinberg  <zack@rabi.phys.columbia.edu>
+
+       * cppalloc.c: Add xstrdup here.
+       * cpplib.h: Remove savestring prototype.
+       * cpplib.c: Remove savestring function. s/savestring/xstrdup/
+         throughout. 
+       * cppfiles.c: s/savestring/xstrdup/ throughout.
+
 1998-12-15  Zack Weinberg  <zack@rabi.phys.columbia.edu>
 
        * cpplib.c: Make all directive handlers read their own
index a852d00cb15d71d862653d3c4fbcd87a20e338eb..880a56dba62752dbd8da9507326b226b12203ee1 100644 (file)
@@ -65,3 +65,13 @@ xrealloc (old, size)
     memory_full ();
   return ptr;
 }
+
+char *
+xstrdup (input)
+  const char *input;
+{
+  unsigned size = strlen (input);
+  char *output = xmalloc (size + 1);
+  strcpy (output, input);
+  return output;
+}
index 8c01cddc787ba3c6c7698d4dc440f7d8ebdac433..108bf8751fb581330d7617dc5623096042ce7ac0 100644 (file)
@@ -74,7 +74,7 @@ append_include_chain (pfile, list, dir, sysp)
   struct stat st;
   unsigned int len;
 
-  dir = savestring (dir);
+  dir = xstrdup (dir);
   simplify_pathname (dir);
   if (stat (dir, &st))
     {
@@ -410,7 +410,7 @@ find_include_file (pfile, fname, search_start, ihash, before)
     }
   *before = 0;
   *ihash = ih;
-  ih->nshort = savestring (fname);
+  ih->nshort = xstrdup (fname);
   ih->control_macro = NULL;
   
   /* If the pathname is absolute, just open it. */ 
@@ -539,7 +539,7 @@ read_name_map (pfile, dirname)
 
   map_list_ptr = ((struct file_name_map_list *)
                  xmalloc (sizeof (struct file_name_map_list)));
-  map_list_ptr->map_list_name = savestring (dirname);
+  map_list_ptr->map_list_name = xstrdup (dirname);
 
   name = (char *) alloca (strlen (dirname) + strlen (FILE_NAME_MAP_FILE) + 2);
   strcpy (name, dirname);
@@ -772,7 +772,7 @@ actual_directory (pfile, fname)
   size_t dlen;
   struct file_name_list *x;
   
-  dir = savestring (fname);
+  dir = xstrdup (fname);
   last_slash = rindex (dir, '/');
   if (last_slash)
     {
index 537d2dce4043aed0eb4df02c7604bc142aa9b3c9..fb85bf56ffb1358fc3d97ed1eeafa359c81152ed 100644 (file)
@@ -4892,7 +4892,7 @@ cpp_start_read (pfile, fname)
          else
            nstore[endp-startp] = '\0';
 
-         include_defaults[num_dirs].fname = savestring (nstore);
+         include_defaults[num_dirs].fname = xstrdup (nstore);
          include_defaults[num_dirs].component = 0;
          include_defaults[num_dirs].cplusplus = opts->cplusplus;
          include_defaults[num_dirs].cxx_aware = 1;
@@ -4915,7 +4915,7 @@ cpp_start_read (pfile, fname)
   if (!opts->no_standard_includes) {
     struct default_include *p = include_defaults;
     char *specd_prefix = opts->include_prefix;
-    char *default_prefix = savestring (GCC_INCLUDE_DIR);
+    char *default_prefix = xstrdup (GCC_INCLUDE_DIR);
     int default_len = 0;
     /* Remove the `include' from /usr/local/lib/gcc.../include.  */
     if (!strcmp (default_prefix + strlen (default_prefix) - 8, "/include")) {
@@ -6164,20 +6164,6 @@ cpp_read_check_assertion (pfile)
   return result;
 }
 
-/* FIXME: savestring() should be renamed strdup() and should
-   be moved into cppalloc.c.  We can't do that right now because
-   then we'd get multiple-symbol clashes with toplev.c and several
-   other people. */
-char *
-savestring (input)
-     char *input;
-{
-  unsigned size = strlen (input);
-  char *output = xmalloc (size + 1);
-  strcpy (output, input);
-  return output;
-}
-\f
 /* Initialize PMARK to remember the current position of PFILE.  */
 
 void
index 7e9aa7d3fdb0d024f046fc91380400391f1c9233..68c77a1aeab9b1c0b6383dc34c8ab3b8c5b8fd94 100644 (file)
@@ -725,8 +725,6 @@ extern int finclude                 PROTO ((cpp_reader *, int,
 extern void deps_output                        PROTO ((cpp_reader *, char *, int));
 extern struct include_hash *include_hash PROTO ((cpp_reader *, char *, int));
 
-/* Bleargh. */
-extern char *savestring                        PROTO ((char *));
 #ifndef INCLUDE_LEN_FUDGE
 #define INCLUDE_LEN_FUDGE 0
 #endif