Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: third_party/tcmalloc/chromium/src/system-alloc.cc

Issue 7033062: Replaced ptrdiff_t with std::ptrdiff_t in all files to enable build with gcc-4.6.0. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2005, Google Inc. 1 // Copyright (c) 2005, Google Inc.
2 // All rights reserved. 2 // All rights reserved.
3 // 3 //
4 // Redistribution and use in source and binary forms, with or without 4 // Redistribution and use in source and binary forms, with or without
5 // modification, are permitted provided that the following conditions are 5 // modification, are permitted provided that the following conditions are
6 // met: 6 // met:
7 // 7 //
8 // * Redistributions of source code must retain the above copyright 8 // * Redistributions of source code must retain the above copyright
9 // notice, this list of conditions and the following disclaimer. 9 // notice, this list of conditions and the following disclaimer.
10 // * Redistributions in binary form must reproduce the above 10 // * Redistributions in binary form must reproduce the above
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 // state) and eventually gets initialized to the specified value. Note 159 // state) and eventually gets initialized to the specified value. Note
160 // that this code runs for a while before the flags are initialized. 160 // that this code runs for a while before the flags are initialized.
161 // That means that even if this flag is set to true, some (initial) 161 // That means that even if this flag is set to true, some (initial)
162 // memory will be allocated with sbrk before the flag takes effect. 162 // memory will be allocated with sbrk before the flag takes effect.
163 if (FLAGS_malloc_skip_sbrk) { 163 if (FLAGS_malloc_skip_sbrk) {
164 return NULL; 164 return NULL;
165 } 165 }
166 166
167 // sbrk will release memory if passed a negative number, so we do 167 // sbrk will release memory if passed a negative number, so we do
168 // a strict check here 168 // a strict check here
169 if (static_cast<ptrdiff_t>(size + alignment) < 0) return NULL; 169 if (static_cast<std::ptrdiff_t>(size + alignment) < 0) return NULL;
170 170
171 // This doesn't overflow because TCMalloc_SystemAlloc has already 171 // This doesn't overflow because TCMalloc_SystemAlloc has already
172 // tested for overflow at the alignment boundary. 172 // tested for overflow at the alignment boundary.
173 size = ((size + alignment - 1) / alignment) * alignment; 173 size = ((size + alignment - 1) / alignment) * alignment;
174 174
175 // "actual_size" indicates that the bytes from the returned pointer 175 // "actual_size" indicates that the bytes from the returned pointer
176 // p up to and including (p + actual_size - 1) have been allocated. 176 // p up to and including (p + actual_size - 1) have been allocated.
177 if (actual_size) { 177 if (actual_size) {
178 *actual_size = size; 178 *actual_size = size;
179 } 179 }
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after
501 501
502 void DumpSystemAllocatorStats(TCMalloc_Printer* printer) { 502 void DumpSystemAllocatorStats(TCMalloc_Printer* printer) {
503 for (int j = 0; j < kMaxAllocators; j++) { 503 for (int j = 0; j < kMaxAllocators; j++) {
504 SysAllocator *a = allocators[j]; 504 SysAllocator *a = allocators[j];
505 if (a == NULL) continue; 505 if (a == NULL) continue;
506 if (a->usable_) { 506 if (a->usable_) {
507 a->DumpStats(printer); 507 a->DumpStats(printer);
508 } 508 }
509 } 509 }
510 } 510 }
OLDNEW
« no previous file with comments | « third_party/tcmalloc/chromium/src/symbolize.h ('k') | third_party/tcmalloc/chromium/src/windows/port.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698