Simplify code.
[oota-llvm.git] / lib / Object / Archive.cpp
index 968ddcdcffc6ede22801897b83ba1df90f386949..8bdab16c04d085eeb16d27c27b96b20a9439f2e7 100644 (file)
@@ -223,7 +223,6 @@ error_code Archive::Symbol::getMember(child_iterator &Result) const {
   uint32_t member_count = *reinterpret_cast<const support::ulittle32_t*>(buf);
   const char *offsets = buf + 4;
   buf += 4 + (member_count * 4); // Skip offsets.
-  uint32_t symbol_count = *reinterpret_cast<const support::ulittle32_t*>(buf);
   const char *indicies = buf + 4;
 
   uint16_t offsetindex =
@@ -243,10 +242,9 @@ error_code Archive::Symbol::getMember(child_iterator &Result) const {
 
 Archive::Symbol Archive::Symbol::getNext() const {
   Symbol t(*this);
-  const char *buf = Parent->SymbolTable->getBuffer()->getBufferStart();
-  buf += t.StringIndex;
-  while (*buf++); // Go to one past next null.
-  t.StringIndex = buf - Parent->SymbolTable->getBuffer()->getBufferStart();
+  // Go to one past next null.
+  t.StringIndex =
+    Parent->SymbolTable->getBuffer()->getBuffer().find('\0', t.StringIndex) + 1;
   ++t.SymbolIndex;
   return t;
 }