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.
diff --git a/examples/describe.c b/examples/describe.c
index 0437ca1..53f548c 100644
--- a/examples/describe.c
+++ b/examples/describe.c
@@ -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;
}
diff --git a/examples/merge.c b/examples/merge.c
index 3f858f0..914907b 100644
--- a/examples/merge.c
+++ b/examples/merge.c
@@ -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;
}