More cleanup
This commit is contained in:
@@ -662,81 +662,6 @@ DN_DSMapKey DN_DSMapKeyStr8(DN_DSMap<T> const *map, DN_Str8 string)
|
||||
return result;
|
||||
}
|
||||
|
||||
DN_API DN_Str8 DN_Slice_Str8Render(DN_Arena *arena, DN_Slice<DN_Str8> array, DN_Str8 separator)
|
||||
{
|
||||
DN_Str8 result = {};
|
||||
if (!arena)
|
||||
return result;
|
||||
|
||||
DN_USize total_size = 0;
|
||||
for (DN_USize index = 0; index < array.size; index++) {
|
||||
if (index)
|
||||
total_size += separator.size;
|
||||
DN_Str8 item = array.data[index];
|
||||
total_size += item.size;
|
||||
}
|
||||
|
||||
result = DN_Str8FromArena(arena, total_size, DN_ZMem_No);
|
||||
if (result.data) {
|
||||
DN_USize write_index = 0;
|
||||
for (DN_USize index = 0; index < array.size; index++) {
|
||||
if (index) {
|
||||
DN_Memcpy(result.data + write_index, separator.data, separator.size);
|
||||
write_index += separator.size;
|
||||
}
|
||||
DN_Str8 item = array.data[index];
|
||||
DN_Memcpy(result.data + write_index, item.data, item.size);
|
||||
write_index += item.size;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
DN_API DN_Str8 DN_Slice_Str8RenderSpaceSeparated(DN_Arena *arena, DN_Slice<DN_Str8> array)
|
||||
{
|
||||
DN_Str8 result = DN_Slice_Str8Render(arena, array, DN_Str8Lit(" "));
|
||||
return result;
|
||||
}
|
||||
|
||||
DN_API DN_Str16 DN_Slice_Str16Render(DN_Arena *arena, DN_Slice<DN_Str16> array, DN_Str16 separator)
|
||||
{
|
||||
DN_Str16 result = {};
|
||||
if (!arena)
|
||||
return result;
|
||||
|
||||
DN_USize total_size = 0;
|
||||
for (DN_USize index = 0; index < array.size; index++) {
|
||||
if (index)
|
||||
total_size += separator.size;
|
||||
DN_Str16 item = array.data[index];
|
||||
total_size += item.size;
|
||||
}
|
||||
|
||||
result = {DN_ArenaNewArray(arena, wchar_t, total_size + 1, DN_ZMem_No), total_size};
|
||||
if (result.data) {
|
||||
DN_USize write_index = 0;
|
||||
for (DN_USize index = 0; index < array.size; index++) {
|
||||
if (index) {
|
||||
DN_Memcpy(result.data + write_index, separator.data, separator.size * sizeof(result.data[0]));
|
||||
write_index += separator.size;
|
||||
}
|
||||
DN_Str16 item = array.data[index];
|
||||
DN_Memcpy(result.data + write_index, item.data, item.size * sizeof(result.data[0]));
|
||||
write_index += item.size;
|
||||
}
|
||||
}
|
||||
|
||||
result.data[total_size] = 0;
|
||||
return result;
|
||||
}
|
||||
|
||||
DN_API DN_Str16 DN_Slice_Str16RenderSpaceSeparated(DN_Arena *arena, DN_Slice<DN_Str16> array)
|
||||
{
|
||||
DN_Str16 result = DN_Slice_Str16Render(arena, array, DN_Str16Lit(L" "));
|
||||
return result;
|
||||
}
|
||||
|
||||
// NOTE: DN_DSMap
|
||||
DN_API DN_DSMapKey DN_DSMapKeyU64NoHash(DN_U64 u64)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user