Fixing a clang warning.

This is a followup change from https://breakpad.appspot.com/569002/

This prevents push_back from ever calling Realloc()
with 0 (which could happen if wasteful_vector was
constructed with size_hint set to 0, causing
allocated_ to be 0.
Review URL: https://breakpad.appspot.com/576002

git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1166 4c0a9323-5329-0410-9bdc-e9ce6186880e
This commit is contained in:
ivan.penkov@gmail.com 2013-04-25 21:32:55 +00:00
parent 0bdc714c20
commit 5b36fbe088

View File

@ -35,6 +35,8 @@
#include <unistd.h>
#include <sys/mman.h>
#include <algorithm>
#ifdef __APPLE__
#define sys_mmap mmap
#define sys_mmap2 mmap
@ -159,7 +161,7 @@ class wasteful_vector {
void push_back(const T& new_element) {
if (used_ == allocated_)
Realloc(allocated_ * 2);
Realloc(std::max(allocated_ * 2, 1u));
a_[used_++] = new_element;
}