extract: finish: increase ‘idx’ when pushing new data, for consistency

We don’t write anything more to the buffer after this, but this makes
this code consistent with all other code that pushes new data to the
buffer.

This makes it easier to search, and validate, the
ensure_size()+push-data pattern.
This commit is contained in:
Daniel Eklöf 2021-01-03 16:21:36 +01:00
parent 07078da0f0
commit fd5d68c819
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F

View file

@ -69,7 +69,7 @@ extract_finish(struct extraction_context *ctx, char **text, size_t *len)
/* Selection of empty cells only */
if (!ensure_size(ctx, 1))
goto out;
ctx->buf[ctx->idx] = L'\0';
ctx->buf[ctx->idx++] = L'\0';
} else {
assert(ctx->idx > 0);
assert(ctx->idx <= ctx->size);
@ -78,7 +78,7 @@ extract_finish(struct extraction_context *ctx, char **text, size_t *len)
else {
if (!ensure_size(ctx, 1))
goto out;
ctx->buf[ctx->idx] = L'\0';
ctx->buf[ctx->idx++] = L'\0';
}
}