summaryrefslogtreecommitdiffstats
path: root/tools/test/perform/pio_standalone.c
diff options
context:
space:
mode:
authorDana Robinson <derobins@hdfgroup.org>2021-03-25 00:39:37 (GMT)
committerDana Robinson <derobins@hdfgroup.org>2021-03-25 00:39:37 (GMT)
commitfeb20aac304b39e18c70f88cae2f7cf7d5c82db2 (patch)
treee15d7e751af4e3c42e77ea955d91db4cf27a71cf /tools/test/perform/pio_standalone.c
parentbdac2ecdbff2c389a222b3d93ff1eb1d23ec6b23 (diff)
downloadhdf5-feb20aac304b39e18c70f88cae2f7cf7d5c82db2.zip
hdf5-feb20aac304b39e18c70f88cae2f7cf7d5c82db2.tar.gz
hdf5-feb20aac304b39e18c70f88cae2f7cf7d5c82db2.tar.bz2
Formats the source and updates the gcc warning pragmas
Diffstat (limited to 'tools/test/perform/pio_standalone.c')
-rw-r--r--tools/test/perform/pio_standalone.c114
1 files changed, 55 insertions, 59 deletions
diff --git a/tools/test/perform/pio_standalone.c b/tools/test/perform/pio_standalone.c
index 8cdca85..9d88727 100644
--- a/tools/test/perform/pio_standalone.c
+++ b/tools/test/perform/pio_standalone.c
@@ -10,7 +10,6 @@
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
/* This file contains the definition of functions required to build h5perf in
* STANDALONE mode.
* Created: Christian Chilan, 2005/5/18.
@@ -19,31 +18,31 @@
#include "pio_perf.h"
#ifdef STANDALONE
-MPI_Info h5_io_info_g=MPI_INFO_NULL;/* MPI INFO object for IO */
+MPI_Info h5_io_info_g = MPI_INFO_NULL; /* MPI INFO object for IO */
#endif
/** From h5tools_utils.c **/
/* global variables */
-int nCols = 80;
+int nCols = 80;
/* ``get_option'' variables */
-int opt_err = 1; /*get_option prints errors if this is on */
-int opt_ind = 1; /*token pointer */
-const char *opt_arg; /*flag argument (or value) */
-
+int opt_err = 1; /*get_option prints errors if this is on */
+int opt_ind = 1; /*token pointer */
+const char *opt_arg; /*flag argument (or value) */
int
get_option(int argc, const char **argv, const char *opts, const struct long_options *l_opts)
{
- static int sp = 1; /* character index in current token */
- int opt_opt = '?'; /* option character passed back to user */
+ static int sp = 1; /* character index in current token */
+ int opt_opt = '?'; /* option character passed back to user */
if (sp == 1) {
/* check for more flag-like tokens */
if (opt_ind >= argc || argv[opt_ind][0] != '-' || argv[opt_ind][1] == '\0') {
return EOF;
- } else if (HDstrcmp(argv[opt_ind], "--") == 0) {
+ }
+ else if (HDstrcmp(argv[opt_ind], "--") == 0) {
opt_ind++;
return EOF;
}
@@ -52,7 +51,7 @@ get_option(int argc, const char **argv, const char *opts, const struct long_opti
if (sp == 1 && argv[opt_ind][0] == '-' && argv[opt_ind][1] == '-') {
/* long command line option */
const char *arg = &argv[opt_ind][2];
- int i;
+ int i;
for (i = 0; l_opts && l_opts[i].name; i++) {
size_t len = HDstrlen(l_opts[i].name);
@@ -64,22 +63,21 @@ get_option(int argc, const char **argv, const char *opts, const struct long_opti
if (l_opts[i].has_arg != no_arg) {
if (arg[len] == '=') {
opt_arg = &arg[len + 1];
- } else if (opt_ind < (argc - 1) && argv[opt_ind + 1][0] != '-') {
+ }
+ else if (opt_ind < (argc - 1) && argv[opt_ind + 1][0] != '-') {
opt_arg = argv[++opt_ind];
- } else if (l_opts[i].has_arg == require_arg) {
+ }
+ else if (l_opts[i].has_arg == require_arg) {
if (opt_err)
- HDfprintf(stderr,
- "%s: option required for \"--%s\" flag\n",
- argv[0], arg);
+ HDfprintf(stderr, "%s: option required for \"--%s\" flag\n", argv[0], arg);
opt_opt = '?';
}
- } else {
+ }
+ else {
if (arg[len] == '=') {
if (opt_err)
- HDfprintf(stderr,
- "%s: no option required for \"%s\" flag\n",
- argv[0], arg);
+ HDfprintf(stderr, "%s: no option required for \"%s\" flag\n", argv[0], arg);
opt_opt = '?';
}
@@ -101,8 +99,9 @@ get_option(int argc, const char **argv, const char *opts, const struct long_opti
opt_ind++;
sp = 1;
- } else {
- register char *cp; /* pointer into current token */
+ }
+ else {
+ register char *cp; /* pointer into current token */
/* short command line option */
opt_opt = argv[opt_ind][sp];
@@ -110,8 +109,7 @@ get_option(int argc, const char **argv, const char *opts, const struct long_opti
if (opt_opt == ':' || (cp = strchr(opts, opt_opt)) == 0) {
if (opt_err)
- HDfprintf(stderr, "%s: unknown option \"%c\"\n",
- argv[0], opt_opt);
+ HDfprintf(stderr, "%s: unknown option \"%c\"\n", argv[0], opt_opt);
/* if no chars left in this token, move to next token */
if (argv[opt_ind][++sp] == '\0') {
@@ -127,20 +125,21 @@ get_option(int argc, const char **argv, const char *opts, const struct long_opti
if (argv[opt_ind][sp + 1] != '\0') {
/* flag value is rest of current token */
opt_arg = &argv[opt_ind++][sp + 1];
- } else if (++opt_ind >= argc) {
+ }
+ else if (++opt_ind >= argc) {
if (opt_err)
- HDfprintf(stderr,
- "%s: value expected for option \"%c\"\n",
- argv[0], opt_opt);
+ HDfprintf(stderr, "%s: value expected for option \"%c\"\n", argv[0], opt_opt);
opt_opt = '?';
- } else {
+ }
+ else {
/* flag value is next token */
opt_arg = argv[opt_ind++];
}
sp = 1;
- } else {
+ }
+ else {
/* set up to look at next char in token, next time */
if (argv[opt_ind][++sp] == '\0') {
/* no more in current token, so setup next token */
@@ -156,12 +155,10 @@ get_option(int argc, const char **argv, const char *opts, const struct long_opti
return opt_opt;
}
-
void
print_version(const char *progname)
{
- printf("%s: Version %u.%u.%u%s%s\n",
- progname, H5_VERS_MAJOR, H5_VERS_MINOR, H5_VERS_RELEASE,
+ printf("%s: Version %u.%u.%u%s%s\n", progname, H5_VERS_MAJOR, H5_VERS_MINOR, H5_VERS_RELEASE,
H5_VERS_SUBRELEASE[0] ? "-" : "", H5_VERS_SUBRELEASE);
}
@@ -182,16 +179,17 @@ print_version(const char *progname)
int
h5_set_info_object(void)
{
- char *envp; /* environment pointer */
- int ret_value=0;
+ char *envp; /* environment pointer */
+ int ret_value = 0;
/* handle any MPI INFO hints via $HDF5_MPI_INFO */
- if ((envp = HDgetenv("HDF5_MPI_INFO")) != NULL){
+ if ((envp = HDgetenv("HDF5_MPI_INFO")) != NULL) {
char *next, *valp;
valp = envp = next = HDstrdup(envp);
- if (!valp) return 0;
+ if (!valp)
+ return 0;
/* create an INFO object if not created yet */
if (h5_io_info_g == MPI_INFO_NULL)
@@ -199,14 +197,14 @@ h5_set_info_object(void)
do {
size_t len;
- char *key_val, *endp, *namep;
+ char * key_val, *endp, *namep;
if (*valp == ';')
valp++;
/* copy key/value pair into temporary buffer */
- len = strcspn(valp, ";");
- next = &valp[len];
+ len = strcspn(valp, ";");
+ next = &valp[len];
key_val = (char *)HDcalloc(1, len + 1);
/* increment the next pointer past the terminating semicolon */
@@ -219,7 +217,8 @@ h5_set_info_object(void)
while (*namep && (*namep == ' ' || *namep == '\t'))
namep++;
- if (!*namep) continue; /* was all white space, so move to next k/v pair */
+ if (!*namep)
+ continue; /* was all white space, so move to next k/v pair */
/* eat up any ending white spaces */
endp = &namep[HDstrlen(namep) - 1];
@@ -230,7 +229,7 @@ h5_set_info_object(void)
/* find the '=' */
valp = HDstrchr(namep, '=');
- if (valp != NULL) { /* it's a valid key/value pairing */
+ if (valp != NULL) { /* it's a valid key/value pairing */
char *tmp_val = valp + 1;
/* change '=' to \0, move valp down one */
@@ -263,7 +262,6 @@ h5_set_info_object(void)
return ret_value;
}
-
/*
* Function: h5_dump_info_object
* Purpose: Display content of an MPI Info object
@@ -274,25 +272,23 @@ h5_set_info_object(void)
void
h5_dump_info_object(MPI_Info info)
{
- char key[MPI_MAX_INFO_KEY+1];
- char value[MPI_MAX_INFO_VAL+1];
- int flag;
- int i, nkeys;
+ char key[MPI_MAX_INFO_KEY + 1];
+ char value[MPI_MAX_INFO_VAL + 1];
+ int flag;
+ int i, nkeys;
HDprintf("Dumping MPI Info Object (up to %d bytes per item):\n", MPI_MAX_INFO_VAL);
- if (info==MPI_INFO_NULL){
- HDprintf("object is MPI_INFO_NULL\n");
+ if (info == MPI_INFO_NULL) {
+ HDprintf("object is MPI_INFO_NULL\n");
}
else {
- MPI_Info_get_nkeys(info, &nkeys);
- HDprintf("object has %d items\n", nkeys);
- for (i=0; i<nkeys; i++){
- MPI_Info_get_nthkey(info, i, key);
- MPI_Info_get(info, key, MPI_MAX_INFO_VAL, value, &flag);
- HDprintf("%s=%s\n", key, value);
- }
-
+ MPI_Info_get_nkeys(info, &nkeys);
+ HDprintf("object has %d items\n", nkeys);
+ for (i = 0; i < nkeys; i++) {
+ MPI_Info_get_nthkey(info, i, key);
+ MPI_Info_get(info, key, MPI_MAX_INFO_VAL, value, &flag);
+ HDprintf("%s=%s\n", key, value);
+ }
}
}
-#endif /* STANDALONE */
-
+#endif /* STANDALONE */