summaryrefslogtreecommitdiff
path: root/src/parse.c
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2017-07-14 15:33:32 +0200
committerPatrick Steinhardt <ps@pks.im>2017-11-11 17:06:23 +0000
commit7bdfc0a68506709b05c40ac519ded044a5ad7124 (patch)
treeff17093c4ec6b03ee3b14f5c8af7691e6bc42bcb /src/parse.c
parente72cb769f6b8c11344463a9784fd4d32ded4a685 (diff)
downloadlibgit2-7bdfc0a68506709b05c40ac519ded044a5ad7124.tar.gz
parse: always initialize line pointer
Upon initializing the parser context, we do not currently initialize the current line, line length and line number. Do so in order to make the interface easier to use and more obvious for future consumers of the parsing API.
Diffstat (limited to 'src/parse.c')
-rw-r--r--src/parse.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/parse.c b/src/parse.c
index c1bd213ec..6b8902c35 100644
--- a/src/parse.c
+++ b/src/parse.c
@@ -16,6 +16,9 @@ int git_parse_ctx_init(git_parse_ctx *ctx, const char *content, size_t content_l
ctx->content_len = content_len;
ctx->remain = ctx->content;
ctx->remain_len = ctx->content_len;
+ ctx->line = ctx->remain;
+ ctx->line_len = git__linenlen(ctx->line, ctx->remain_len);
+ ctx->line_num = 1;
return 0;
}