From ed7cd6a7f373edb0d01acb8b48718d91e8225e25 Mon Sep 17 00:00:00 2001 From: James Zern Date: Mon, 14 Apr 2025 12:35:28 -0700 Subject: [PATCH] utils.c,cosmetics: rm struct member '_' suffix This is a follow up to: ee8e8c62 Fix member naming for VP8LHistogram This better matches Google style and clears some clang-tidy warnings. Change-Id: Ie2f82401e1ba28bd0575b6bb82d12ed55c71718f --- src/utils/utils.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/utils/utils.c b/src/utils/utils.c index 408ce88f..6d2f5a4e 100644 --- a/src/utils/utils.c +++ b/src/utils/utils.c @@ -60,9 +60,9 @@ static int countdown_to_fail = 0; // 0 = off typedef struct MemBlock MemBlock; struct MemBlock { - void* ptr_; - size_t size_; - MemBlock* next_; + void* ptr; + size_t size; + MemBlock* next; }; static MemBlock* all_blocks = NULL; @@ -83,7 +83,7 @@ static void PrintMemInfo(void) { fprintf(stderr, "high-water mark: %u\n", (uint32_t)high_water_mark); while (all_blocks != NULL) { MemBlock* b = all_blocks; - all_blocks = b->next_; + all_blocks = b->next; free(b); } } @@ -121,10 +121,10 @@ static void AddMem(void* ptr, size_t size) { if (ptr != NULL) { MemBlock* const b = (MemBlock*)malloc(sizeof(*b)); if (b == NULL) abort(); - b->next_ = all_blocks; + b->next = all_blocks; all_blocks = b; - b->ptr_ = ptr; - b->size_ = size; + b->ptr = ptr; + b->size = size; total_mem += size; total_mem_allocated += size; #if defined(PRINT_MEM_TRAFFIC) @@ -143,18 +143,18 @@ static void SubMem(void* ptr) { if (ptr != NULL) { MemBlock** b = &all_blocks; // Inefficient search, but that's just for debugging. - while (*b != NULL && (*b)->ptr_ != ptr) b = &(*b)->next_; + while (*b != NULL && (*b)->ptr != ptr) b = &(*b)->next; if (*b == NULL) { fprintf(stderr, "Invalid pointer free! (%p)\n", ptr); abort(); } { MemBlock* const block = *b; - *b = block->next_; - total_mem -= block->size_; + *b = block->next; + total_mem -= block->size; #if defined(PRINT_MEM_TRAFFIC) fprintf(stderr, "Mem: %u (-%u)\n", - (uint32_t)total_mem, (uint32_t)block->size_); + (uint32_t)total_mem, (uint32_t)block->size); #endif free(block); }