added some utility functions + fixed error in ostrAppendview

This commit is contained in:
snarmph 2021-10-31 10:25:46 +00:00
parent aa39e2563d
commit be71719f73
7 changed files with 47 additions and 18 deletions

View file

@ -534,7 +534,7 @@ void ostrAppenddouble(str_ostream_t *ctx, double val) {
}
void ostrAppendview(str_ostream_t *ctx, strview_t view) {
if((ctx->allocated - ctx->size) < view.len) {
if((ctx->allocated - ctx->size) <= view.len) {
_ostrRealloc(ctx, view.len + 1);
}
memcpy(ctx->buf + ctx->size, view.buf, view.len);