Compare commits
1 Commits
arenastrin
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 4291248ec1 |
@@ -381,6 +381,8 @@ void noh_string_append_cstr(Noh_String *string, const char *cstr);
|
|||||||
void noh_string_append_null(Noh_String *string);
|
void noh_string_append_null(Noh_String *string);
|
||||||
|
|
||||||
// Replace all occurrences of one character with another in a Noh_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);
|
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.
|
// 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) {
|
void noh_string_replace(Noh_String *string, const char from, const char to) {
|
||||||
Noh_String result = {0};
|
Noh_String result = {0};
|
||||||
|
result.arena = string->arena;
|
||||||
for (size_t i = 0; i < string->count; i++) {
|
for (size_t i = 0; i < string->count; i++) {
|
||||||
if (result.arena) {
|
if (result.arena) {
|
||||||
if (string->elems[i] == from) {
|
if (string->elems[i] == from) {
|
||||||
|
|||||||
Reference in New Issue
Block a user