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
This commit is contained in:
James Zern 2025-04-14 12:35:28 -07:00
parent 3a23b0f008
commit ed7cd6a7f3

View File

@ -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);
}