yml: apparently, libyaml's line number in the error context is 0 based

Which makes zero sense when reporting the error to the user.
This commit is contained in:
Daniel Eklöf 2019-01-01 23:27:54 +01:00
parent 4d46a14a67
commit b13305526a

4
yml.c
View file

@ -241,14 +241,14 @@ yml_load(FILE *yml, char **error)
if (error != NULL) {
int cnt = snprintf(
NULL, 0, "%zu:%zu: %s %s",
yaml.problem_mark.line,
yaml.problem_mark.line + 1,
yaml.problem_mark.column,
yaml.problem,
yaml.context != NULL ? yaml.context : "");
*error = malloc(cnt + 1);
snprintf(*error, cnt + 1, "%zu:%zu: %s %s",
yaml.problem_mark.line,
yaml.problem_mark.line + 1,
yaml.problem_mark.column,
yaml.problem,
yaml.context != NULL ? yaml.context : "");