aboutsummaryrefslogtreecommitdiff
path: root/src/common/linux
diff options
context:
space:
mode:
authorthestig@chromium.org <thestig@chromium.org@4c0a9323-5329-0410-9bdc-e9ce6186880e>2010-08-14 01:41:39 +0000
committerthestig@chromium.org <thestig@chromium.org@4c0a9323-5329-0410-9bdc-e9ce6186880e>2010-08-14 01:41:39 +0000
commitf5c8f6fb61ce609452361ee9b61a343570f62d12 (patch)
tree65726ef8d0093bde007ca244fc6ee349b6f23d83 /src/common/linux
parentMiscellaneous improvements to minidump-2-core. (diff)
downloadbreakpad-f5c8f6fb61ce609452361ee9b61a343570f62d12.tar.xz
Fix a couple of bugs where we generate incorrect minidump files on Linux.o
Patch by Markus Gutschke <markus@chromium.org>. R=thestig Review URL: http://breakpad.appspot.com/150001 Review URL: http://breakpad.appspot.com/155001 git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@649 4c0a9323-5329-0410-9bdc-e9ce6186880e
Diffstat (limited to 'src/common/linux')
-rw-r--r--src/common/linux/memory.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/common/linux/memory.h b/src/common/linux/memory.h
index f10a194b..725ed8b3 100644
--- a/src/common/linux/memory.h
+++ b/src/common/linux/memory.h
@@ -148,6 +148,24 @@ class wasteful_vector {
return used_;
}
+ void resize(unsigned sz, T c = T()) {
+ // No need to test "sz >= 0", as "sz" is unsigned.
+ if (sz <= used_) {
+ used_ = sz;
+ } else {
+ unsigned a = allocated_;
+ if (sz > a) {
+ while (sz > a) {
+ a *= 2;
+ }
+ Realloc(a);
+ }
+ while (sz > used_) {
+ a_[used_++] = c;
+ }
+ }
+ }
+
T& operator[](size_t index) {
return a_[index];
}