diff options
author | Cary Coutant <ccoutant@google.com> | 2010-08-03 20:38:09 +0000 |
---|---|---|
committer | Cary Coutant <ccoutant@google.com> | 2010-08-03 20:38:09 +0000 |
commit | fef830db38dc7b443745fca928d5f05c1f867737 (patch) | |
tree | 8e65b43e56f3b3be5b611f436ca821f71773ceab /gold/stringpool.h | |
parent | bfea910e97b4375e2027c52936c79cde94221796 (diff) | |
download | gdb-fef830db38dc7b443745fca928d5f05c1f867737.zip gdb-fef830db38dc7b443745fca928d5f05c1f867737.tar.gz gdb-fef830db38dc7b443745fca928d5f05c1f867737.tar.bz2 |
* merge.cc (Output_merge_string::do_add_input_section): Count strings
to reserve space in merged_strings vector. Keep total input size
for stats.
(Output_merge_string::do_print_merge_stats): Print total input size.
* merge.h (Output_merge_string): Add input_size_ field.
* stringpool.cc (Stringpool_template::string_length): Move
implementations out of Stringpool_template class and place in
stringpool.h.
* stringpool.h (string_length): Move out of Stringpool_template.
Diffstat (limited to 'gold/stringpool.h')
-rw-r--r-- | gold/stringpool.h | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/gold/stringpool.h b/gold/stringpool.h index f353c9d..2f9a313 100644 --- a/gold/stringpool.h +++ b/gold/stringpool.h @@ -32,6 +32,28 @@ namespace gold class Output_file; +// Return the length of a string in units of Char_type. + +template<typename Char_type> +inline size_t +string_length(const Char_type* p) +{ + size_t len = 0; + for (; *p != 0; ++p) + ++len; + return len; +} + +// Specialize string_length for char. Maybe we could just use +// std::char_traits<>::length? + +template<> +inline size_t +string_length(const char* p) +{ + return strlen(p); +} + // A Stringpool is a pool of unique strings. It provides the // following features: @@ -266,10 +288,6 @@ class Stringpool_template Stringpool_template(const Stringpool_template&); Stringpool_template& operator=(const Stringpool_template&); - // Return the length of a string in units of Stringpool_char. - static size_t - string_length(const Stringpool_char*); - // Return whether two strings are equal. static bool string_equal(const Stringpool_char*, const Stringpool_char*); |