minor cleanup from the bar
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
// Generated by the DN single header generator 2026-07-12 16:23:32
|
||||
// Generated by the DN single header generator 2026-07-12 23:15:45
|
||||
|
||||
// DN: Single header generator commented out => #if defined(_CLANGD)
|
||||
// #define DN_WITH_TESTS 1
|
||||
@@ -1542,14 +1542,14 @@ DN_API void DN_MemListClear(DN_MemList *mem)
|
||||
DN_MemListPopTo(mem, 0);
|
||||
}
|
||||
|
||||
DN_API bool DN_MemListOwnsPtr(DN_MemList const *mem, void *ptr)
|
||||
DN_API bool DN_MemListOwnsPtr(DN_MemList const *mem, void const *ptr)
|
||||
{
|
||||
bool result = false;
|
||||
uintptr_t uint_ptr = DN_Cast(uintptr_t) ptr;
|
||||
bool result = false;
|
||||
DN_UPtr uint_ptr = DN_Cast(DN_UPtr) ptr;
|
||||
for (DN_MemBlock const *block = mem ? mem->curr : nullptr; !result && block; block = block->prev) {
|
||||
uintptr_t begin = DN_Cast(uintptr_t) block + DN_ARENA_HEADER_SIZE;
|
||||
uintptr_t end = begin + block->reserve;
|
||||
result = uint_ptr >= begin && uint_ptr <= end;
|
||||
DN_UPtr begin = DN_Cast(DN_UPtr) block + DN_ARENA_HEADER_SIZE;
|
||||
DN_UPtr end = begin + block->reserve;
|
||||
result = uint_ptr >= begin && uint_ptr <= end;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -11537,13 +11537,21 @@ DN_API DN_Str8 DN_OS_Str8FromStr8BuilderHeap(DN_Str8Builder const *builder)
|
||||
return result;
|
||||
}
|
||||
|
||||
DN_API void DN_OS_LogPrint(DN_LogTypeParam type, void *user_data, DN_CallSite call_site, DN_LogFlags flags, DN_FMT_ATTRIB char const *fmt, va_list args)
|
||||
DN_API void DN_OS_LogPrintFV(DN_LogTypeParam type, void *user_data, DN_CallSite call_site, DN_LogFlags flags, DN_FMT_ATTRIB char const *fmt, va_list args)
|
||||
{
|
||||
DN_OSCore *os = DN_Cast(DN_OSCore *)user_data;
|
||||
DN_OSLogger *logger = &os->logger;
|
||||
DN_OS_LoggerFV(logger, type, call_site, flags, fmt, args);
|
||||
}
|
||||
|
||||
DN_API void DN_OS_LogPrintF(DN_LogTypeParam type, void *user_data, DN_CallSite call_site, DN_LogFlags flags, DN_FMT_ATTRIB char const *fmt, ...)
|
||||
{
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
DN_OS_LogPrintFV(type, user_data, call_site, flags, fmt, args);
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
DN_API DN_Str8 DN_OS_LoggerGetRotateFilePath(DN_Str8 base_file_path, DN_Arena *arena, DN_USize rotate_index)
|
||||
{
|
||||
DN_Str8 result = {};
|
||||
@@ -11740,7 +11748,7 @@ DN_API void DN_OS_LoggerF(DN_OSLogger *logger, DN_LogTypeParam type, DN_CallSite
|
||||
DN_API void DN_OS_SetLogPrintFuncToOS()
|
||||
{
|
||||
DN_Core *dn = DN_Get();
|
||||
DN_LogSetPrintFunc(DN_OS_LogPrint, &dn->os);
|
||||
DN_LogSetPrintFunc(DN_OS_LogPrintFV, &dn->os);
|
||||
}
|
||||
|
||||
DN_API void *DN_OS_HeapBasicAlloc(DN_USize size)
|
||||
@@ -11780,6 +11788,20 @@ DN_API DN_Heap DN_OS_HeapInitDefault()
|
||||
return result;
|
||||
}
|
||||
|
||||
DN_API DN_Arena DN_OS_ArenaFromHeapVirtual(DN_U64 reserve, DN_U64 commit, DN_MemFlags flags)
|
||||
{
|
||||
DN_Heap heap = DN_OS_HeapInitVirtual();
|
||||
DN_Arena result = DN_ArenaFromHeap(reserve, commit, flags, heap);
|
||||
return result;
|
||||
}
|
||||
|
||||
DN_API DN_Arena DN_OS_ArenaFromHeapBasic(DN_U64 size, DN_MemFlags flags)
|
||||
{
|
||||
DN_Heap heap = DN_OS_HeapInitBasic();
|
||||
DN_Arena result = DN_ArenaFromHeap(/*reserve=*/ size, /*commit=*/ size, flags, heap);
|
||||
return result;
|
||||
}
|
||||
|
||||
// NOTE: Date
|
||||
DN_API DN_Str8x32 DN_OS_DateLocalTimeStr8(DN_Date time, char date_separator, char hms_separator)
|
||||
{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Generated by the DN single header generator 2026-07-12 16:23:32
|
||||
// Generated by the DN single header generator 2026-07-12 23:15:45
|
||||
|
||||
#if !defined(DN_H)
|
||||
#define DN_H
|
||||
@@ -4770,7 +4770,7 @@ DN_API void DN_MemListPopTo
|
||||
DN_API void DN_MemListPop (DN_MemList *mem, DN_U64 amount);
|
||||
DN_API DN_U64 DN_MemListPos (DN_MemList const *mem);
|
||||
DN_API void DN_MemListClear (DN_MemList *mem);
|
||||
DN_API bool DN_MemListOwnsPtr (DN_MemList const *mem, void *ptr);
|
||||
DN_API bool DN_MemListOwnsPtr (DN_MemList const *mem, void const *ptr);
|
||||
DN_API DN_Str8x64 DN_MemListInfoStr8x64 (DN_MemListInfo info);
|
||||
DN_API DN_MemListTemp DN_MemListTempBegin (DN_MemList *mem);
|
||||
DN_API void DN_MemListTempEnd (DN_MemListTemp mem);
|
||||
@@ -6430,7 +6430,8 @@ DN_API void DN_LeakDump_
|
||||
|
||||
#if DN_WITH_OS
|
||||
DN_API DN_Str8 DN_OS_Str8FromStr8BuilderHeap (DN_Str8Builder const *builder);
|
||||
DN_API void DN_OS_LogPrint (DN_LogTypeParam type, void *user_data, DN_CallSite call_site, DN_LogFlags flags, DN_FMT_ATTRIB char const *fmt, va_list args);
|
||||
DN_API void DN_OS_LogPrintFV (DN_LogTypeParam type, void *user_data, DN_CallSite call_site, DN_LogFlags flags, DN_FMT_ATTRIB char const *fmt, va_list args);
|
||||
DN_API void DN_OS_LogPrintF (DN_LogTypeParam type, void *user_data, DN_CallSite call_site, DN_LogFlags flags, DN_FMT_ATTRIB char const *fmt, ...);
|
||||
DN_API void DN_OS_SetLogPrintFuncToOS ();
|
||||
|
||||
// NOTE: Logger
|
||||
@@ -6497,6 +6498,9 @@ DN_API DN_Heap DN_OS_HeapInitBasic ()
|
||||
DN_API DN_Heap DN_OS_HeapInitVirtual ();
|
||||
DN_API DN_Heap DN_OS_HeapInitDefault ();
|
||||
|
||||
DN_API DN_Arena DN_OS_ArenaFromHeapVirtual (DN_U64 reserve, DN_U64 commit, DN_MemFlags flags);
|
||||
DN_API DN_Arena DN_OS_ArenaFromHeapBasic (DN_U64 size, DN_MemFlags flags);
|
||||
|
||||
DN_API void * DN_OS_MemReserve (DN_USize count, DN_MemCommit commit, DN_MemPage page_flags);
|
||||
DN_API bool DN_OS_MemCommit (void *ptr, DN_USize count, DN_U32 page_flags);
|
||||
DN_API void DN_OS_MemDecommit (void *ptr, DN_USize count);
|
||||
|
||||
@@ -862,7 +862,7 @@ DN_INIField *DN_INI_AppendKeyF(DN_INICore *ini, DN_INIArena *arena, DN_INISectio
|
||||
}
|
||||
|
||||
#if defined(DN_INI_WITH_TESTS)
|
||||
void DN_INI_UnitTests()
|
||||
void DN_INI_TestSuite()
|
||||
{
|
||||
// NOTE: Section and comments
|
||||
{
|
||||
|
||||
+30
-8
@@ -1540,14 +1540,14 @@ DN_API void DN_MemListClear(DN_MemList *mem)
|
||||
DN_MemListPopTo(mem, 0);
|
||||
}
|
||||
|
||||
DN_API bool DN_MemListOwnsPtr(DN_MemList const *mem, void *ptr)
|
||||
DN_API bool DN_MemListOwnsPtr(DN_MemList const *mem, void const *ptr)
|
||||
{
|
||||
bool result = false;
|
||||
uintptr_t uint_ptr = DN_Cast(uintptr_t) ptr;
|
||||
bool result = false;
|
||||
DN_UPtr uint_ptr = DN_Cast(DN_UPtr) ptr;
|
||||
for (DN_MemBlock const *block = mem ? mem->curr : nullptr; !result && block; block = block->prev) {
|
||||
uintptr_t begin = DN_Cast(uintptr_t) block + DN_ARENA_HEADER_SIZE;
|
||||
uintptr_t end = begin + block->reserve;
|
||||
result = uint_ptr >= begin && uint_ptr <= end;
|
||||
DN_UPtr begin = DN_Cast(DN_UPtr) block + DN_ARENA_HEADER_SIZE;
|
||||
DN_UPtr end = begin + block->reserve;
|
||||
result = uint_ptr >= begin && uint_ptr <= end;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -11535,13 +11535,21 @@ DN_API DN_Str8 DN_OS_Str8FromStr8BuilderHeap(DN_Str8Builder const *builder)
|
||||
return result;
|
||||
}
|
||||
|
||||
DN_API void DN_OS_LogPrint(DN_LogTypeParam type, void *user_data, DN_CallSite call_site, DN_LogFlags flags, DN_FMT_ATTRIB char const *fmt, va_list args)
|
||||
DN_API void DN_OS_LogPrintFV(DN_LogTypeParam type, void *user_data, DN_CallSite call_site, DN_LogFlags flags, DN_FMT_ATTRIB char const *fmt, va_list args)
|
||||
{
|
||||
DN_OSCore *os = DN_Cast(DN_OSCore *)user_data;
|
||||
DN_OSLogger *logger = &os->logger;
|
||||
DN_OS_LoggerFV(logger, type, call_site, flags, fmt, args);
|
||||
}
|
||||
|
||||
DN_API void DN_OS_LogPrintF(DN_LogTypeParam type, void *user_data, DN_CallSite call_site, DN_LogFlags flags, DN_FMT_ATTRIB char const *fmt, ...)
|
||||
{
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
DN_OS_LogPrintFV(type, user_data, call_site, flags, fmt, args);
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
DN_API DN_Str8 DN_OS_LoggerGetRotateFilePath(DN_Str8 base_file_path, DN_Arena *arena, DN_USize rotate_index)
|
||||
{
|
||||
DN_Str8 result = {};
|
||||
@@ -11738,7 +11746,7 @@ DN_API void DN_OS_LoggerF(DN_OSLogger *logger, DN_LogTypeParam type, DN_CallSite
|
||||
DN_API void DN_OS_SetLogPrintFuncToOS()
|
||||
{
|
||||
DN_Core *dn = DN_Get();
|
||||
DN_LogSetPrintFunc(DN_OS_LogPrint, &dn->os);
|
||||
DN_LogSetPrintFunc(DN_OS_LogPrintFV, &dn->os);
|
||||
}
|
||||
|
||||
DN_API void *DN_OS_HeapBasicAlloc(DN_USize size)
|
||||
@@ -11778,6 +11786,20 @@ DN_API DN_Heap DN_OS_HeapInitDefault()
|
||||
return result;
|
||||
}
|
||||
|
||||
DN_API DN_Arena DN_OS_ArenaFromHeapVirtual(DN_U64 reserve, DN_U64 commit, DN_MemFlags flags)
|
||||
{
|
||||
DN_Heap heap = DN_OS_HeapInitVirtual();
|
||||
DN_Arena result = DN_ArenaFromHeap(reserve, commit, flags, heap);
|
||||
return result;
|
||||
}
|
||||
|
||||
DN_API DN_Arena DN_OS_ArenaFromHeapBasic(DN_U64 size, DN_MemFlags flags)
|
||||
{
|
||||
DN_Heap heap = DN_OS_HeapInitBasic();
|
||||
DN_Arena result = DN_ArenaFromHeap(/*reserve=*/ size, /*commit=*/ size, flags, heap);
|
||||
return result;
|
||||
}
|
||||
|
||||
// NOTE: Date
|
||||
DN_API DN_Str8x32 DN_OS_DateLocalTimeStr8(DN_Date time, char date_separator, char hms_separator)
|
||||
{
|
||||
|
||||
+6
-2
@@ -2840,7 +2840,7 @@ DN_API void DN_MemListPopTo
|
||||
DN_API void DN_MemListPop (DN_MemList *mem, DN_U64 amount);
|
||||
DN_API DN_U64 DN_MemListPos (DN_MemList const *mem);
|
||||
DN_API void DN_MemListClear (DN_MemList *mem);
|
||||
DN_API bool DN_MemListOwnsPtr (DN_MemList const *mem, void *ptr);
|
||||
DN_API bool DN_MemListOwnsPtr (DN_MemList const *mem, void const *ptr);
|
||||
DN_API DN_Str8x64 DN_MemListInfoStr8x64 (DN_MemListInfo info);
|
||||
DN_API DN_MemListTemp DN_MemListTempBegin (DN_MemList *mem);
|
||||
DN_API void DN_MemListTempEnd (DN_MemListTemp mem);
|
||||
@@ -4500,7 +4500,8 @@ DN_API void DN_LeakDump_
|
||||
|
||||
#if DN_WITH_OS
|
||||
DN_API DN_Str8 DN_OS_Str8FromStr8BuilderHeap (DN_Str8Builder const *builder);
|
||||
DN_API void DN_OS_LogPrint (DN_LogTypeParam type, void *user_data, DN_CallSite call_site, DN_LogFlags flags, DN_FMT_ATTRIB char const *fmt, va_list args);
|
||||
DN_API void DN_OS_LogPrintFV (DN_LogTypeParam type, void *user_data, DN_CallSite call_site, DN_LogFlags flags, DN_FMT_ATTRIB char const *fmt, va_list args);
|
||||
DN_API void DN_OS_LogPrintF (DN_LogTypeParam type, void *user_data, DN_CallSite call_site, DN_LogFlags flags, DN_FMT_ATTRIB char const *fmt, ...);
|
||||
DN_API void DN_OS_SetLogPrintFuncToOS ();
|
||||
|
||||
// NOTE: Logger
|
||||
@@ -4567,6 +4568,9 @@ DN_API DN_Heap DN_OS_HeapInitBasic ()
|
||||
DN_API DN_Heap DN_OS_HeapInitVirtual ();
|
||||
DN_API DN_Heap DN_OS_HeapInitDefault ();
|
||||
|
||||
DN_API DN_Arena DN_OS_ArenaFromHeapVirtual (DN_U64 reserve, DN_U64 commit, DN_MemFlags flags);
|
||||
DN_API DN_Arena DN_OS_ArenaFromHeapBasic (DN_U64 size, DN_MemFlags flags);
|
||||
|
||||
DN_API void * DN_OS_MemReserve (DN_USize count, DN_MemCommit commit, DN_MemPage page_flags);
|
||||
DN_API bool DN_OS_MemCommit (void *ptr, DN_USize count, DN_U32 page_flags);
|
||||
DN_API void DN_OS_MemDecommit (void *ptr, DN_USize count);
|
||||
|
||||
Reference in New Issue
Block a user