From 76cab1f5cb48af8398e1c09c15a974b1f8347da4 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Wed, 18 Apr 2018 22:33:57 -0500 Subject: Fix non-threadsafe API context head pointer handling. --- src/H5CX.c | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/src/H5CX.c b/src/H5CX.c index c81a0f4..deaf1a1 100644 --- a/src/H5CX.c +++ b/src/H5CX.c @@ -61,7 +61,7 @@ /* * The current API context. */ -#define H5CX_get_my_context() (H5CX_head_g) +#define H5CX_get_my_context() (&H5CX_head_g) #endif /* H5_HAVE_THREADSAFE */ /* Common macro for the duplicated code to retrieve properties from a property list */ @@ -358,7 +358,7 @@ hbool_t H5_PKG_INIT_VAR = FALSE; /*******************/ #ifndef H5_HAVE_THREADSAFE -static H5CX_node_t **H5CX_head_g = NULL; /* Pointer to head of context stack */ +static H5CX_node_t *H5CX_head_g = NULL; /* Pointer to head of context stack */ #endif /* H5_HAVE_THREADSAFE */ /* Define a "default" dataset transfer property list cache structure to use for default DXPLs */ @@ -391,13 +391,6 @@ H5CX__init_package(void) FUNC_ENTER_STATIC -#ifndef H5_HAVE_THREADSAFE - /* Allocate the context stack head pointer */ - if(NULL == (H5CX_head_g = (H5CX_node_t **)HDmalloc(sizeof(H5CX_node_t *)))) - HGOTO_ERROR(H5E_CONTEXT, H5E_CANTALLOC, FAIL, "can't allocate pointer to head of context stack") - *H5CX_head_g = NULL; -#endif /* H5_HAVE_THREADSAFE */ - /* Reset the "default DXPL cache" information */ HDmemset(&H5CX_def_dxpl_cache, 0, sizeof(H5CX_dxpl_cache_t)); @@ -546,8 +539,6 @@ H5CX_term_package(void) HDfree(cnode); #ifndef H5_HAVE_THREADSAFE - /* Release pointer to head of API context stack */ - HDfree(H5CX_head_g); H5CX_head_g = NULL; #endif /* H5_HAVE_THREADSAFE */ -- cgit v0.12