* x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
[binutils-gdb.git] / gold / stringpool.h
index df3826d9eb02c25f5ba23239f03870780989740f..2f9a3139358540ba517ba607b2698f321ad732a0 100644 (file)
@@ -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:
 
@@ -178,8 +200,10 @@ class Stringpool_template
   void
   set_no_zero_null()
   {
-    gold_assert(this->string_set_.empty());
+    gold_assert(this->string_set_.empty()
+               && this->offset_ == sizeof(Stringpool_char));
     this->zero_null_ = false;
+    this->offset_ = 0;
   }
 
   // Indicate that this string pool should be optimized, even if not
@@ -264,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*);