From 09b056975dacd1f0f815ad820b6dc9913b0118a3 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Tue, 23 Jun 2020 18:55:43 -0400 Subject: fix pointer style to match the style guide We do this in a lot of places, but we're inconsistent. Normalize the code to the Google C++ style guide. Change-Id: Ic2aceab661ce8f6b993dda21b1cdf5d2198dcbbf Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/2262932 Reviewed-by: Sterling Augustine Reviewed-by: Mark Mentovai --- src/common/memory_allocator.h | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'src/common/memory_allocator.h') diff --git a/src/common/memory_allocator.h b/src/common/memory_allocator.h index a3159ea4..69055a15 100644 --- a/src/common/memory_allocator.h +++ b/src/common/memory_allocator.h @@ -71,12 +71,12 @@ class PageAllocator { FreeAll(); } - void *Alloc(size_t bytes) { + void* Alloc(size_t bytes) { if (!bytes) return NULL; if (current_page_ && page_size_ - page_offset_ >= bytes) { - uint8_t *const ret = current_page_ + page_offset_; + uint8_t* const ret = current_page_ + page_offset_; page_offset_ += bytes; if (page_offset_ == page_size_) { page_offset_ = 0; @@ -88,7 +88,7 @@ class PageAllocator { const size_t pages = (bytes + sizeof(PageHeader) + page_size_ - 1) / page_size_; - uint8_t *const ret = GetNPages(pages); + uint8_t* const ret = GetNPages(pages); if (!ret) return NULL; @@ -115,8 +115,8 @@ class PageAllocator { unsigned long pages_allocated() { return pages_allocated_; } private: - uint8_t *GetNPages(size_t num_pages) { - void *a = sys_mmap(NULL, page_size_ * num_pages, PROT_READ | PROT_WRITE, + uint8_t* GetNPages(size_t num_pages) { + void* a = sys_mmap(NULL, page_size_ * num_pages, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); if (a == MAP_FAILED) return NULL; @@ -127,7 +127,7 @@ class PageAllocator { __msan_unpoison(a, page_size_ * num_pages); #endif - struct PageHeader *header = reinterpret_cast(a); + struct PageHeader* header = reinterpret_cast(a); header->next = last_; header->num_pages = num_pages; last_ = header; @@ -138,22 +138,22 @@ class PageAllocator { } void FreeAll() { - PageHeader *next; + PageHeader* next; - for (PageHeader *cur = last_; cur; cur = next) { + for (PageHeader* cur = last_; cur; cur = next) { next = cur->next; sys_munmap(cur, cur->num_pages * page_size_); } } struct PageHeader { - PageHeader *next; // pointer to the start of the next set of pages. + PageHeader* next; // pointer to the start of the next set of pages. size_t num_pages; // the number of pages in this set. }; const size_t page_size_; - PageHeader *last_; - uint8_t *current_page_; + PageHeader* last_; + uint8_t* current_page_; size_t page_offset_; unsigned long pages_allocated_; }; -- cgit v1.2.1