summaryrefslogtreecommitdiffstats
path: root/src/H5PL.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/H5PL.c')
-rw-r--r--src/H5PL.c58
1 files changed, 9 insertions, 49 deletions
diff --git a/src/H5PL.c b/src/H5PL.c
index 5580e51..bc0b90e 100644
--- a/src/H5PL.c
+++ b/src/H5PL.c
@@ -74,6 +74,8 @@ get_filter_info = (get_filter_info_t)H5PL_GET_LIB_FUNC(H, "H5PL_get_plugin_info"
ret_val = get_filter_info(); \
}
+typedef const H5Z_class2_t *(__cdecl *get_filter_info_t)();
+
#else /* H5_HAVE_WIN32_API */
/* Handle for dynamic library */
#define H5PL_HANDLE void *
@@ -104,6 +106,7 @@ get_filter_info_t get_filter_info; \
ret_val = get_filter_info(); \
}
+typedef const H5Z_class2_t *(*get_filter_info_t)();
#endif /* H5_HAVE_WIN32_API */
@@ -488,7 +491,7 @@ static htri_t
H5PL__open(H5PL_type_t pl_type, char *libname, int pl_id, void **pl_info)
{
H5PL_HANDLE handle = NULL;
- H5Z_class2_t *plugin_info = NULL;
+ get_filter_info_t H5PL_get_plugin_info = NULL;
htri_t ret_value = FALSE;
FUNC_ENTER_STATIC
@@ -500,13 +503,10 @@ H5PL__open(H5PL_type_t pl_type, char *libname, int pl_id, void **pl_info)
H5PL_CLR_ERROR; /* clear error */
} /* end if */
else {
-#ifdef TMP
- H5Z_class2_t * (*H5PL_get_plugin_info)(void);
-
/* Return a handle for the function H5PL_get_plugin_info in the dynamic library.
* The plugin library is suppose to define this function.
*/
- if(NULL == (H5PL_get_plugin_info = (H5Z_class2_t *(*)(void))H5PL_GET_LIB_FUNC(handle, "H5PL_get_plugin_info"))) {
+ if(NULL == (H5PL_get_plugin_info = (get_filter_info_t)H5PL_GET_LIB_FUNC(handle, "H5PL_get_plugin_info"))) {
if(H5PL__close(handle) < 0)
HGOTO_ERROR(H5E_PLUGIN, H5E_CLOSEERROR, FAIL, "can't close dynamic library")
} /* end if */
@@ -551,42 +551,6 @@ H5PL__open(H5PL_type_t pl_type, char *libname, int pl_id, void **pl_info)
if(H5PL__close(handle) < 0)
HGOTO_ERROR(H5E_PLUGIN, H5E_CLOSEERROR, FAIL, "can't close dynamic library")
} /* end if */
-#else
- H5PL_GET_PLUGIN_INFO(handle, plugin_info);
- if(NULL == plugin_info) {
- if(H5PL__close(handle) < 0)
- HGOTO_ERROR(H5E_PLUGIN, H5E_CLOSEERROR, FAIL, "can't close dynamic library")
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "can't get plugin info")
- }
-
- if(plugin_info->id == pl_id) {
- /* Expand the table if it is too small */
- if(H5PL_table_used_g >= H5PL_table_alloc_g) {
- size_t n = MAX(H5Z_MAX_NFILTERS, 2 * H5PL_table_alloc_g);
- H5PL_table_t *table = (H5PL_table_t *)H5MM_realloc(H5PL_table_g, n * sizeof(H5PL_table_t));
-
- if(!table)
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to extend dynamic library table")
-
- H5PL_table_g = table;
- H5PL_table_alloc_g = n;
- } /* end if */
-
- (H5PL_table_g[H5PL_table_used_g]).handle = handle;
- (H5PL_table_g[H5PL_table_used_g]).pl_type = pl_type;
- (H5PL_table_g[H5PL_table_used_g]).pl_id = plugin_info->id;
-/*fprintf(stderr, "%s: H5PL_table_used_g=%d, id=%d, id 2=%d\n", FUNC, H5PL_table_used_g, (H5PL_table_g[H5PL_table_used_g]).pl_id, plugin_info->id);*/
- H5PL_table_used_g++;
-
- *pl_info = (void *)plugin_info;
- ret_value = TRUE;
-
- HGOTO_DONE(ret_value)
- } else
- if(H5PL__close(handle) < 0)
- HGOTO_ERROR(H5E_PLUGIN, H5E_CLOSEERROR, FAIL, "can't close dynamic library")
-
-#endif
} /* end else */
done:
@@ -614,6 +578,7 @@ H5PL__search_table(H5PL_type_t plugin_type, int type_id, void **info)
{
size_t i;
H5Z_class2_t *plugin_info;
+ get_filter_info_t H5PL_get_plugin_info = NULL;
htri_t ret_value = FALSE;
FUNC_ENTER_STATIC
@@ -622,17 +587,12 @@ H5PL__search_table(H5PL_type_t plugin_type, int type_id, void **info)
if(H5PL_table_used_g > 0) {
for(i = 0; i < H5PL_table_used_g; i++) {
if((plugin_type == (H5PL_table_g[i]).pl_type) && (type_id == (H5PL_table_g[i]).pl_id)) {
-#ifdef TMP
- H5Z_class2_t *(*H5PL_get_plugin_info)(void);
- H5Z_class2_t *plugin_info;
-
- if(NULL == (H5PL_get_plugin_info = (H5Z_class2_t *(*)(void))H5PL_GET_LIB_FUNC((H5PL_table_g[i]).handle, "H5PL_get_plugin_info")))
+ if(NULL == (H5PL_get_plugin_info = (get_filter_info_t)H5PL_GET_LIB_FUNC((H5PL_table_g[i]).handle, "H5PL_get_plugin_info")))
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "can't get function for H5PL_get_plugin_info")
+
if(NULL == (plugin_info = (*H5PL_get_plugin_info)()))
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "can't get plugin info")
-#else
- H5PL_GET_PLUGIN_INFO((H5PL_table_g[i]).handle, plugin_info);
-#endif
+
*info = (void *)plugin_info;
ret_value = TRUE;
break;