noh.h: noh_string_append_sv

This commit is contained in:
2026-05-04 15:01:57 +02:00
parent 53c5155078
commit d107c58da7

View File

@@ -357,6 +357,9 @@ typedef struct {
const char *elems; const char *elems;
} Noh_String_View; } Noh_String_View;
// Appends a Noh_String_View view into a Noh_String.
void noh_string_append_sv(Noh_String *string, Noh_String_View sv);
// Increases the position of a string view by the specified amount, reducing its count by the same // Increases the position of a string view by the specified amount, reducing its count by the same
// amount. If the end is reached, the string view will remain empty without moving further. // amount. If the end is reached, the string view will remain empty without moving further.
void noh_sv_increase_position(Noh_String_View *sv, size_t distance); void noh_sv_increase_position(Noh_String_View *sv, size_t distance);
@@ -880,6 +883,10 @@ defer:
///////////////////////// String view ///////////////////////// ///////////////////////// String view /////////////////////////
void noh_string_append_sv(Noh_String *string, Noh_String_View sv) {
noh_da_append_multiple(string, sv.elems, sv.count);
}
void noh_sv_increase_position(Noh_String_View *sv, size_t distance) { void noh_sv_increase_position(Noh_String_View *sv, size_t distance) {
if (distance < sv->count) { if (distance < sv->count) {
sv->count -= distance; sv->count -= distance;