Commit 976eed80 by Patrick Steinhardt

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.
parent b6b2d9d7
...@@ -54,7 +54,7 @@ static void opts_add_commit(describe_options *opts, const char *commit) ...@@ -54,7 +54,7 @@ static void opts_add_commit(describe_options *opts, const char *commit)
assert(opts != NULL); assert(opts != NULL);
sz = ++opts->commit_count * sizeof(opts->commits[0]); 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; opts->commits[opts->commit_count - 1] = commit;
} }
......
...@@ -57,7 +57,7 @@ static void opts_add_refish(merge_options *opts, const char *refish) ...@@ -57,7 +57,7 @@ static void opts_add_refish(merge_options *opts, const char *refish)
assert(opts != NULL); assert(opts != NULL);
sz = ++opts->heads_count * sizeof(opts->heads[0]); 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; opts->heads[opts->heads_count - 1] = refish;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment