summaryrefslogtreecommitdiffstats
path: root/test/efc.c
diff options
context:
space:
mode:
authorDana Robinson <derobins@hdfgroup.org>2020-01-18 19:15:39 (GMT)
committerDana Robinson <derobins@hdfgroup.org>2020-01-18 19:15:39 (GMT)
commit66a94df13b3801547523f1ea90bc84fe2ee6824b (patch)
tree24fced71c832d01e3dc084400f8fb82c8df8d88f /test/efc.c
parent3ef5b9e977556bdea7836b4c5d1d745f92f46d41 (diff)
parent44739ccd4715cc9e15595575700e945341fcdbcc (diff)
downloadhdf5-66a94df13b3801547523f1ea90bc84fe2ee6824b.zip
hdf5-66a94df13b3801547523f1ea90bc84fe2ee6824b.tar.gz
hdf5-66a94df13b3801547523f1ea90bc84fe2ee6824b.tar.bz2
Merge pull request #2269 in HDFFV/hdf5 from ~DEROBINS/hdf5_der:stack_size_warnings to develop
* commit '44739ccd4715cc9e15595575700e945341fcdbcc': Tidying from code review. Fixed stack and frame size warnings. Not complete, but fixes most of the easier cases.
Diffstat (limited to 'test/efc.c')
-rw-r--r--test/efc.c31
1 files changed, 24 insertions, 7 deletions
diff --git a/test/efc.c b/test/efc.c
index e62f6cc..e508b47 100644
--- a/test/efc.c
+++ b/test/efc.c
@@ -33,7 +33,8 @@ const char *FILENAME[] = {
};
/* Global patched filename buffer */
-static char filename[6][128];
+#define N_FILENAMES 6
+static char *filename[N_FILENAMES];
/* Global property lists - just copies of the defaults (necessary to use
* internal functions */
@@ -2896,10 +2897,11 @@ error:
int
main(void)
{
- unsigned nerrors = 0; /* track errors */
- H5P_genplist_t *plist; /* Property list pointer for FAPL */
- H5VL_connector_prop_t connector_prop; /* Property for VOL connector ID & info */
- hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */
+ unsigned nerrors = 0; /* track errors */
+ H5P_genplist_t *plist; /* Property list pointer for FAPL */
+ H5VL_connector_prop_t connector_prop; /* Property for VOL connector ID & info */
+ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */
+ int i; /* iterator */
/* Test Setup */
HDputs("Testing the external file cache");
@@ -2908,6 +2910,11 @@ main(void)
fcpl_id = H5Pcreate(H5P_FILE_CREATE);
fapl_id = h5_fileaccess();
+ /* Allocate memory for filenames */
+ for(i = 0; i < N_FILENAMES; i++) {
+ filename[i] = (char *)HDcalloc(PATH_MAX, sizeof(char));
+ }
+
/* Patch filenames */
h5_fixname(FILENAME[0], fapl_id, filename[0], sizeof(filename[0]));
h5_fixname(FILENAME[1], fapl_id, filename[1], sizeof(filename[1]));
@@ -2942,7 +2949,8 @@ main(void)
nerrors += (h5_verify_cached_stabs(FILENAME, fapl_id) < 0 ? 1 : 0);
/* Pop API context */
- if(api_ctx_pushed && H5CX_pop() < 0) FAIL_STACK_ERROR
+ if(api_ctx_pushed && H5CX_pop() < 0)
+ FAIL_STACK_ERROR
api_ctx_pushed = FALSE;
if(nerrors)
@@ -2952,6 +2960,10 @@ main(void)
h5_clean_files(FILENAME, fapl_id);
+ for(i = 0; i < N_FILENAMES; i++) {
+ HDfree(filename[i]);
+ }
+
return EXIT_SUCCESS;
error:
@@ -2961,7 +2973,12 @@ error:
H5Pclose(fapl_id);
} H5E_END_TRY
- if(api_ctx_pushed) H5CX_pop();
+ if(api_ctx_pushed)
+ H5CX_pop();
+
+ for(i = 0; i < N_FILENAMES; i++) {
+ HDfree(filename[i]);
+ }
return EXIT_FAILURE;
} /* end main() */