Combine loop epilogue into main loop body to reduce duplication.
authorRafael Ávila de Espíndola <rafael.espindola@gmail.com>
Wed, 4 Feb 2015 22:37:05 +0000 (17:37 -0500)
committerRafael Ávila de Espíndola <rafael.espindola@gmail.com>
Wed, 4 Feb 2015 22:37:05 +0000 (17:37 -0500)
gold/ChangeLog
gold/merge.cc

index a7deb7730f19e2805858fd687f295ac41050db46..73ee43e37bf604a9673033190318988c4bef9717 100644 (file)
@@ -1,3 +1,8 @@
+2015-02-04  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
+
+       * merge.cc (do_add_input_section): Combine loop epilogue into main loop
+       body.
+
 2015-02-04  Peter Collingbourne  <pcc@google.com>
 
        * plugin.cc (Pluginobj::get_symbol_resolution_info): Resolve
index 269e6bf6e3c7a479fb79254ebcf8c263c3dd221c..f547388e3089dc16f0e5be33f8f2ef7faa0765bc 100644 (file)
@@ -564,9 +564,9 @@ Output_merge_string<Char_type>::do_add_input_section(Relobj* object,
                                 & (this->addralign() - 1));
   bool has_misaligned_strings = false;
 
-  while (p < pend0)
+  while (p < pend)
     {
-      size_t len = string_length(p);
+      size_t len = p < pend0 ? string_length(p) : pend - p;
 
       // Within merge input section each string must be aligned.
       if (len != 0
@@ -581,17 +581,6 @@ Output_merge_string<Char_type>::do_add_input_section(Relobj* object,
       p += len + 1;
       i += (len + 1) * sizeof(Char_type);
     }
-  if (p < pend)
-    {
-      size_t len = pend - p;
-
-      Stringpool::Key key;
-      this->stringpool_.add_with_length(p, len, true, &key);
-
-      merged_strings.push_back(Merged_string(i, key));
-
-      i += (len + 1) * sizeof(Char_type);
-    }
 
   // Record the last offset in the input section so that we can
   // compute the length of the last string.
This page took 0.034454 seconds and 4 git commands to generate.