core: Use crypto_generichash. We don't need to roll our own FNV32a.
All checks were successful
Build Tilde Friends / Build-All (push) Successful in 36m37s

This commit is contained in:
2025-06-25 21:10:05 -04:00
parent cef526bcf3
commit 37e1c5d97b
5 changed files with 9 additions and 23 deletions

View File

@ -3,6 +3,7 @@
#include "util.js.h"
#include "quickjs.h"
#include "sodium/crypto_generichash.h"
#include "sqlite3.h"
#include "uv.h"
@ -154,11 +155,11 @@ static void _tf_mem_summarize(void* ptr, size_t size, int frames_count, void* co
{
summary_t* summary = user_data;
tf_mem_allocation_t allocation = {
.stack_hash = tf_util_fnv32a(frames, sizeof(void*) * frames_count, 0),
.count = 1,
.size = size,
.frames_count = frames_count,
};
crypto_generichash((void*)&allocation.stack_hash, sizeof(allocation.stack_hash), (const void*)frames, sizeof(void*) * frames_count, NULL, 0);
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);