examples: cast away constness for reallocating head arrays

When reallocating commit arrays in `opts_add_commit` and
`opts_add_refish`, respectively, we simply pass the const pointer to
`xrealloc`. As `xrealloc` expects a non-const pointer, though, this will
generate a warning with some compilers.

Cast away the constness to silence compilers.
This commit is contained in:
Patrick Steinhardt
2019-06-27 15:12:11 +02:00
parent b6b2d9d78a
commit 976eed8078
2 changed files with 2 additions and 2 deletions

View File

@@ -54,7 +54,7 @@ static void opts_add_commit(describe_options *opts, const char *commit)
assert(opts != NULL);
sz = ++opts->commit_count * sizeof(opts->commits[0]);
opts->commits = (const char **)xrealloc(opts->commits, sz);
opts->commits = xrealloc((void *) opts->commits, sz);
opts->commits[opts->commit_count - 1] = commit;
}

View File

@@ -57,7 +57,7 @@ static void opts_add_refish(merge_options *opts, const char *refish)
assert(opts != NULL);
sz = ++opts->heads_count * sizeof(opts->heads[0]);
opts->heads = (const char **)xrealloc(opts->heads, sz);
opts->heads = xrealloc((void *) opts->heads, sz);
opts->heads[opts->heads_count - 1] = refish;
}