diff options
author | Patrick Steinhardt <ps@pks.im> | 2019-06-27 15:12:11 +0200 |
---|---|---|
committer | Patrick Steinhardt <ps@pks.im> | 2019-07-05 11:28:57 +0200 |
commit | 976eed8078c69857c698f8753a4a66bda4690882 (patch) | |
tree | b7174ab77a030bdbd9d8eef7844013a5a1394a3b /examples | |
parent | b6b2d9d78a54aa11708ea300b47e9c6e5cb85bcc (diff) | |
download | libgit2-976eed8078c69857c698f8753a4a66bda4690882.tar.gz |
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.
Diffstat (limited to 'examples')
-rw-r--r-- | examples/describe.c | 2 | ||||
-rw-r--r-- | examples/merge.c | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/examples/describe.c b/examples/describe.c index 0437ca17e..53f548c8b 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 3f858f018..914907b70 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; } |