aboutsummaryrefslogtreecommitdiff
path: root/gold/merge.cc
diff options
context:
space:
mode:
authorRafael Ávila de Espíndola <rafael.espindola@gmail.com>2015-02-04 17:37:05 -0500
committerRafael Ávila de Espíndola <rafael.espindola@gmail.com>2015-02-04 17:37:05 -0500
commitb39b8b9d90e142179709e846c15afdebd49b0fb1 (patch)
treeeeb295d2e10e4ab4c052751d01d9b151dd3da56b /gold/merge.cc
parentb9394193d08bef2193f805ded0af898e4c10a509 (diff)
downloadbinutils-b39b8b9d90e142179709e846c15afdebd49b0fb1.zip
binutils-b39b8b9d90e142179709e846c15afdebd49b0fb1.tar.gz
binutils-b39b8b9d90e142179709e846c15afdebd49b0fb1.tar.bz2
Combine loop epilogue into main loop body to reduce duplication.
Diffstat (limited to 'gold/merge.cc')
-rw-r--r--gold/merge.cc15
1 files changed, 2 insertions, 13 deletions
diff --git a/gold/merge.cc b/gold/merge.cc
index 269e6bf..f547388 100644
--- a/gold/merge.cc
+++ b/gold/merge.cc
@@ -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.