clang-format the source. Not exactly how I want it, but automated is better than perfect.

git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4845 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
2024-02-15 23:35:01 +00:00
parent c8812b1add
commit fbc3cfeda4
37 changed files with 3141 additions and 1764 deletions

View File

@ -107,12 +107,7 @@ void tf_mem_walk_allocations(void (*callback)(void* ptr, size_t size, int frames
memcpy(frames, node->frames, sizeof(void*) * node->frames_count);
}
}
callback(
(void*)((intptr_t)node->ptr + sizeof(size_t)),
size,
node->frames_count,
node->frames_count ? frames : NULL,
user_data);
callback((void*)((intptr_t)node->ptr + sizeof(size_t)), size, node->frames_count, node->frames_count ? frames : NULL, user_data);
if (node == s_mem_tracked)
{
break;
@ -161,8 +156,7 @@ static int _tf_mem_size_compare(const void* a, const void* b)
static void _tf_mem_summarize(void* ptr, size_t size, int frames_count, void* const* frames, void* user_data)
{
summary_t* summary = user_data;
tf_mem_allocation_t allocation =
{
tf_mem_allocation_t allocation = {
.stack_hash = fnv32a(frames, sizeof(void*) * frames_count, 0),
.count = 1,
.size = size,
@ -171,10 +165,8 @@ static void _tf_mem_summarize(void* ptr, size_t size, int frames_count, void* co
memcpy(allocation.frames, frames, sizeof(void*) * frames_count);
int index = tf_util_insert_index(&allocation, summary->allocations, summary->count, sizeof(tf_mem_allocation_t), _tf_mem_hash_stack_compare);
if (index < summary->count &&
allocation.stack_hash == summary->allocations[index].stack_hash &&
allocation.frames_count == summary->allocations[index].frames_count &&
memcmp(frames, summary->allocations[index].frames, sizeof(void*) * frames_count) == 0)
if (index < summary->count && allocation.stack_hash == summary->allocations[index].stack_hash && allocation.frames_count == summary->allocations[index].frames_count &&
memcmp(frames, summary->allocations[index].frames, sizeof(void*) * frames_count) == 0)
{
summary->allocations[index].count++;
summary->allocations[index].size += size;
@ -457,7 +449,7 @@ char* tf_strdup(const char* string)
}
size_t len = strlen(string);
char* buffer = tf_malloc(len + 1);
if ( buffer)
if (buffer)
{
memcpy(buffer, string, len + 1);
}
@ -543,8 +535,7 @@ static size_t _tf_js_malloc_usable_size(const void* ptr)
void tf_get_js_malloc_functions(JSMallocFunctions* out)
{
*out = (JSMallocFunctions)
{
*out = (JSMallocFunctions) {
.js_malloc = _tf_js_malloc,
.js_free = _tf_js_free,
.js_realloc = _tf_js_realloc,
@ -599,8 +590,7 @@ static void _tf_sqlite_shutdown(void* user_data)
void tf_mem_replace_sqlite_allocator()
{
sqlite3_mem_methods methods =
{
sqlite3_mem_methods methods = {
.xMalloc = _tf_sqlite_malloc,
.xFree = _tf_sqlite_free,
.xRealloc = _tf_sqlite_realloc,