OSDN Git Service

PR gcov-profile/51297
authornathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4>
Sat, 26 Nov 2011 21:44:24 +0000 (21:44 +0000)
committernathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4>
Sat, 26 Nov 2011 21:44:24 +0000 (21:44 +0000)
* gcov.c (main): Allocate initial names and sources arrays.
(find_source): Don't check for null name or source arrays here.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@181745 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/gcov.c

index dcc99a0..e20b3f6 100644 (file)
@@ -1,3 +1,9 @@
+2011-11-26  Nathan Sidwell  <nathan@acm.org>
+
+       PR gcov-profile/51297
+       * gcov.c (main): Allocate initial names and sources arrays.
+       (find_source): Don't check for null name or source arrays here.
+
 2011-11-26  Jakub Jelinek  <jakub@redhat.com>
 
        PR rtl-optimization/49912
index c5cc0ef..29907a3 100644 (file)
@@ -406,6 +406,11 @@ main (int argc, char **argv)
   /* Handle response files.  */
   expandargv (&argc, &argv);
 
+  a_names = 10;
+  names = XNEWVEC (name_map_t, a_names);
+  a_sources = 10;
+  sources = XNEWVEC (source_t, a_sources);
+  
   argno = process_args (argc, argv);
   if (optind == argc)
     print_usage (true);
@@ -874,8 +879,6 @@ find_source (const char *file_name)
     {
       /* Extend the name map array -- we'll be inserting one or two
         entries.  */
-      if (!a_names)
-       a_names = 10;
       a_names *= 2;
       name_map = XNEWVEC (name_map_t, a_names);
       memcpy (name_map, names, n_names * sizeof (*names));
@@ -894,8 +897,6 @@ find_source (const char *file_name)
       
       if (n_sources == a_sources)
        {
-         if (!a_sources)
-           a_sources = 10;
          a_sources *= 2;
          src = XNEWVEC (source_t, a_sources);
          memcpy (src, sources, n_sources * sizeof (*sources));