From 4291248ec1b8706ea2a384b575215d9ccc6cbfcd Mon Sep 17 00:00:00 2001 From: ThoNohT Date: Tue, 11 Aug 2026 16:20:53 +0200 Subject: [PATCH] noh_string_replace: Use arena from source string --- src/noh.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/noh.h b/src/noh.h index 16359a0..c04e016 100644 --- a/src/noh.h +++ b/src/noh.h @@ -381,6 +381,8 @@ void noh_string_append_cstr(Noh_String *string, const char *cstr); void noh_string_append_null(Noh_String *string); // Replace all occurrences of one character with another in a Noh_String. +// If the string does not use an arena, its original data will be cleared. +// If it does not use an arena, this data will remain orphaned in the arena. void noh_string_replace(Noh_String *string, const char from, const char to); // Frees a Noh_String, freeing the memory used and settings the count and capacity to 0. @@ -922,6 +924,7 @@ void noh_string_append_null(Noh_String *string) { void noh_string_replace(Noh_String *string, const char from, const char to) { Noh_String result = {0}; + result.arena = string->arena; for (size_t i = 0; i < string->count; i++) { if (result.arena) { if (string->elems[i] == from) {