mirror of
https://github.com/webmproject/libwebp.git
synced 2025-04-19 23:36:45 +02:00
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:
parent
3a23b0f008
commit
ed7cd6a7f3
@ -60,9 +60,9 @@ static int countdown_to_fail = 0; // 0 = off
|
|||||||
|
|
||||||
typedef struct MemBlock MemBlock;
|
typedef struct MemBlock MemBlock;
|
||||||
struct MemBlock {
|
struct MemBlock {
|
||||||
void* ptr_;
|
void* ptr;
|
||||||
size_t size_;
|
size_t size;
|
||||||
MemBlock* next_;
|
MemBlock* next;
|
||||||
};
|
};
|
||||||
|
|
||||||
static MemBlock* all_blocks = NULL;
|
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);
|
fprintf(stderr, "high-water mark: %u\n", (uint32_t)high_water_mark);
|
||||||
while (all_blocks != NULL) {
|
while (all_blocks != NULL) {
|
||||||
MemBlock* b = all_blocks;
|
MemBlock* b = all_blocks;
|
||||||
all_blocks = b->next_;
|
all_blocks = b->next;
|
||||||
free(b);
|
free(b);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -121,10 +121,10 @@ static void AddMem(void* ptr, size_t size) {
|
|||||||
if (ptr != NULL) {
|
if (ptr != NULL) {
|
||||||
MemBlock* const b = (MemBlock*)malloc(sizeof(*b));
|
MemBlock* const b = (MemBlock*)malloc(sizeof(*b));
|
||||||
if (b == NULL) abort();
|
if (b == NULL) abort();
|
||||||
b->next_ = all_blocks;
|
b->next = all_blocks;
|
||||||
all_blocks = b;
|
all_blocks = b;
|
||||||
b->ptr_ = ptr;
|
b->ptr = ptr;
|
||||||
b->size_ = size;
|
b->size = size;
|
||||||
total_mem += size;
|
total_mem += size;
|
||||||
total_mem_allocated += size;
|
total_mem_allocated += size;
|
||||||
#if defined(PRINT_MEM_TRAFFIC)
|
#if defined(PRINT_MEM_TRAFFIC)
|
||||||
@ -143,18 +143,18 @@ static void SubMem(void* ptr) {
|
|||||||
if (ptr != NULL) {
|
if (ptr != NULL) {
|
||||||
MemBlock** b = &all_blocks;
|
MemBlock** b = &all_blocks;
|
||||||
// Inefficient search, but that's just for debugging.
|
// 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) {
|
if (*b == NULL) {
|
||||||
fprintf(stderr, "Invalid pointer free! (%p)\n", ptr);
|
fprintf(stderr, "Invalid pointer free! (%p)\n", ptr);
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
MemBlock* const block = *b;
|
MemBlock* const block = *b;
|
||||||
*b = block->next_;
|
*b = block->next;
|
||||||
total_mem -= block->size_;
|
total_mem -= block->size;
|
||||||
#if defined(PRINT_MEM_TRAFFIC)
|
#if defined(PRINT_MEM_TRAFFIC)
|
||||||
fprintf(stderr, "Mem: %u (-%u)\n",
|
fprintf(stderr, "Mem: %u (-%u)\n",
|
||||||
(uint32_t)total_mem, (uint32_t)block->size_);
|
(uint32_t)total_mem, (uint32_t)block->size);
|
||||||
#endif
|
#endif
|
||||||
free(block);
|
free(block);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user