From fd5d68c819d41cb5966408713ed3fb5d27e3ff57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ekl=C3=B6f?= Date: Sun, 3 Jan 2021 16:21:36 +0100 Subject: [PATCH] =?UTF-8?q?extract:=20finish:=20increase=20=E2=80=98idx?= =?UTF-8?q?=E2=80=99=20when=20pushing=20new=20data,=20for=20consistency?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- extract.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/extract.c b/extract.c index d6214f70..a6492716 100644 --- a/extract.c +++ b/extract.c @@ -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'; } }