summaryrefslogtreecommitdiffstats
path: root/tools/lib/h5tools_utils.c
diff options
context:
space:
mode:
authorSean McBride <sean@rogue-research.com>2021-02-22 17:37:12 (GMT)
committerGitHub <noreply@github.com>2021-02-22 17:37:12 (GMT)
commit5ed255a607d604b45e92b06548682ae9b716535d (patch)
tree3dcf8239efca99143e561743c2ae997ce9ceca09 /tools/lib/h5tools_utils.c
parent99669024ff93df3ade5b8a1e6eee8bef6df57161 (diff)
downloadhdf5-5ed255a607d604b45e92b06548682ae9b716535d.zip
hdf5-5ed255a607d604b45e92b06548682ae9b716535d.tar.gz
hdf5-5ed255a607d604b45e92b06548682ae9b716535d.tar.bz2
Fixed all -Wincompatible-pointer-types-discards-qualifiers warnings (#341)
* Fixed various -Wincompatible-pointer-types-discards-qualifiers warnings by adding const * Fixed various -Wincompatible-pointer-types-discards-qualifiers warning by removing extraneous consts There were casts with const, but the function parameter doesn't actaully take const, so just modified the casts. In the other case, a local variable was const that should not have been, becuase its source wasn't const either. * Fixed a -Wincompatible-pointer-types-discards-qualifiers warning by strdup-ing a string Create a duplicate string instead of mutating a supposedly const one.
Diffstat (limited to 'tools/lib/h5tools_utils.c')
-rw-r--r--tools/lib/h5tools_utils.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/tools/lib/h5tools_utils.c b/tools/lib/h5tools_utils.c
index 70b715a..bee6262 100644
--- a/tools/lib/h5tools_utils.c
+++ b/tools/lib/h5tools_utils.c
@@ -196,7 +196,7 @@ get_option(int argc, const char **argv, const char *opts, const struct long_opti
/* long command line option */
int i;
const char ch = '=';
- char * arg = &argv[opt_ind][2];
+ char * arg = HDstrdup(&argv[opt_ind][2]);
size_t arg_len = 0;
opt_arg = strchr(&argv[opt_ind][2], ch);
@@ -253,6 +253,8 @@ get_option(int argc, const char **argv, const char *opts, const struct long_opti
opt_ind++;
sp = 1;
+
+ HDfree(arg);
}
else {
register char *cp; /* pointer into current token */