diff options
author | David Young <dyoung@hdfgroup.org> | 2020-04-28 13:35:12 (GMT) |
---|---|---|
committer | David Young <dyoung@hdfgroup.org> | 2020-04-28 13:35:12 (GMT) |
commit | 4e48041a136beef974097a7e4683b308097af84e (patch) | |
tree | a269a6f3d41ae368d88bd39e94a2319a4d50c97c /test/vfd_swmr.c | |
parent | d16006c45d7d574e8a8f530cc3f4dbd1f3e7e25e (diff) | |
download | hdf5-4e48041a136beef974097a7e4683b308097af84e.zip hdf5-4e48041a136beef974097a7e4683b308097af84e.tar.gz hdf5-4e48041a136beef974097a7e4683b308097af84e.tar.bz2 |
Move fetch_env_ulong() from vfd_swmr.c to vfd_swmr_common.c for eventual
reuse by the zoo writer.
Diffstat (limited to 'test/vfd_swmr.c')
-rw-r--r-- | test/vfd_swmr.c | 30 |
1 files changed, 1 insertions, 29 deletions
diff --git a/test/vfd_swmr.c b/test/vfd_swmr.c index 96c9cf7..e235db9 100644 --- a/test/vfd_swmr.c +++ b/test/vfd_swmr.c @@ -21,6 +21,7 @@ #include "bsdqueue.h" #include "h5test.h" +#include "vfd_swmr_common.h" /* * This file needs to access private information from the H5F package. @@ -2635,35 +2636,6 @@ error: #define _arraycount(_a) (sizeof(_a)/sizeof(_a[0])) #endif -/* Fetch a variable from the environment and parse it for unsigned long - * content. Return 0 if the variable is not present, -1 if it is present - * but it does not parse and compare less than `limit`, 1 if it's present, - * parses, and is in-bounds. - */ -static int -fetch_env_ulong(const char *varname, unsigned long limit, unsigned long *valp) -{ - char *end; - unsigned long ul; - char *tmp; - - if ((tmp = getenv(varname)) == NULL) - return 0; - - errno = 0; - ul = strtoul(tmp, &end, 0); - if ((ul == ULONG_MAX && errno != 0) || end == tmp || *end != '\0') { - fprintf(stderr, "could not parse %s: %s\n", varname, strerror(errno)); - return -1; - } - if (ul > limit) { - fprintf(stderr, "%s (%lu) out of range\n", varname, ul); - return -1; - } - *valp = ul; - return 1; -} - static unsigned test_shadow_index_lookup(void) { |