blob: a71a4d46baa75cde208d4b414c0226673a02ffa9 [file] [log] [blame]
#include "string_pool.h"
#include <stdlib.h>
StringPool::StringPool() {
}
StringPool::~StringPool() {
for (char* b : pool_) {
free(b);
}
}
StringPiece StringPool::Add(StringPiece s) {
char* b = static_cast<char*>(malloc(s.size()));
memcpy(b, s.data(), s.size());
pool_.push_back(b);
return StringPiece(b, s.size());
}