From c5f3b7fa02e5d2d3aff54458a912bb392871b1d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Achim=20Gsell=C3=BC?= Date: Tue, 4 Sep 2018 10:28:08 +0200 Subject: [PATCH] src/h5core/{h5_file.c,h5_init.c,private/h5_init.h} - refactor 'h5_initialize()' and 'h5_finalize()' --- src/h5core/h5_file.c | 2 +- src/h5core/h5_init.c | 5 +++-- src/h5core/private/h5_init.h | 4 ++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/h5core/h5_file.c b/src/h5core/h5_file.c index 2160111..2b70331 100644 --- a/src/h5core/h5_file.c +++ b/src/h5core/h5_file.c @@ -617,7 +617,7 @@ h5_close_h5hut ( void ) { H5_CORE_API_ENTER (h5_err_t, "%s", ""); - TRY (h5priv_finalize ()); + TRY (h5_finalize ()); TRY (hdf5_close ()); H5_RETURN (H5_SUCCESS); } diff --git a/src/h5core/h5_init.c b/src/h5core/h5_init.c index a7d8386..5684f4b 100644 --- a/src/h5core/h5_init.c +++ b/src/h5core/h5_init.c @@ -741,9 +741,10 @@ _h5_exit (int status) { } h5_err_t -h5priv_initialize ( +h5_initialize ( void ) { + if (h5_initialized) return 0; memset (&h5_call_stack, 0, sizeof (h5_call_stack)); // must be set here, otherwise next statement will fail! h5_initialized = 1; @@ -785,7 +786,7 @@ h5priv_initialize ( } h5_err_t -h5priv_finalize ( +h5_finalize ( void ) { H5_PRIV_FUNC_ENTER (h5_err_t, "%s", "void"); diff --git a/src/h5core/private/h5_init.h b/src/h5core/private/h5_init.h index 2403431..a58c0ec 100644 --- a/src/h5core/private/h5_init.h +++ b/src/h5core/private/h5_init.h @@ -20,10 +20,10 @@ extern "C" { #endif h5_err_t -h5priv_initialize (void); +h5_initialize (void); h5_err_t -h5priv_finalize (void); +h5_finalize (void); extern int h5_initialized; extern h5_dta_types_t h5_dta_types;