diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2012-09-13 17:44:44 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2012-09-13 17:44:44 (GMT) |
commit | fc65a4e66ee8f01419b5699f367ab7d79eb2f268 (patch) | |
tree | 3a2fdbd6e986ed9b0f5d5bdba915381ad0d71c54 /src/H5Pocpypl.c | |
parent | d36cd7cba56a3a70859ab7ca4f5120195b1a4d34 (diff) | |
download | hdf5-fc65a4e66ee8f01419b5699f367ab7d79eb2f268.zip hdf5-fc65a4e66ee8f01419b5699f367ab7d79eb2f268.tar.gz hdf5-fc65a4e66ee8f01419b5699f367ab7d79eb2f268.tar.bz2 |
[svn-r22759] Description:
Bring r22758 from trunk to 1.8 branch:
Bring generic improvements from encode/decode property list branch to
the trunk. This includes a better version of the property list comparison
routine, cleaned up compiler warnings, and some cleaned up property list
callbacks. Also, started on changes to clean up parallel test output, so that
it doesn't report successful tests from each process.
Tested on:
Mac OSX/64 10.7.4 (amazon) w/debug, GCC 4.7.x, FORTRAN, C++, threadsafe and parallel
(h5committested on trunk)
Diffstat (limited to 'src/H5Pocpypl.c')
-rw-r--r-- | src/H5Pocpypl.c | 201 |
1 files changed, 89 insertions, 112 deletions
diff --git a/src/H5Pocpypl.c b/src/H5Pocpypl.c index adea906..0ba5625 100644 --- a/src/H5Pocpypl.c +++ b/src/H5Pocpypl.c @@ -52,11 +52,14 @@ /* Definitions for merge committed dtype list */ #define H5O_CPY_MERGE_COMM_DT_LIST_SIZE sizeof(char *) #define H5O_CPY_MERGE_COMM_DT_LIST_DEF NULL -#define H5O_CPY_MERGE_COMM_DT_LIST_CMP H5P_ocpy_merge_comm_dt_list_cmp +#define H5O_CPY_MERGE_COMM_DT_LIST_COPY H5P__ocpy_merge_comm_dt_list_copy +#define H5O_CPY_MERGE_COMM_DT_LIST_CMP H5P__ocpy_merge_comm_dt_list_cmp +#define H5O_CPY_MERGE_COMM_DT_LIST_CLOSE H5P__ocpy_merge_comm_dt_list_close /* Definitions for callback function when completing the search for a matching committed datatype from the committed dtype list */ #define H5O_CPY_MCDT_SEARCH_CB_SIZE sizeof(H5O_mcdt_cb_info_t) #define H5O_CPY_MCDT_SEARCH_CB_DEF {NULL,NULL} + /******************/ /* Local Typedefs */ /******************/ @@ -72,16 +75,15 @@ /********************/ /* General routines */ -static H5O_copy_dtype_merge_list_t *H5P_free_merge_comm_dtype_list(H5O_copy_dtype_merge_list_t *dt_list); +static H5O_copy_dtype_merge_list_t *H5P__free_merge_comm_dtype_list(H5O_copy_dtype_merge_list_t *dt_list); /* Property class callbacks */ -static herr_t H5P_ocpy_reg_prop(H5P_genclass_t *pclass); -static herr_t H5P_ocpy_copy(hid_t dst_plist_id, hid_t src_plist_id, - void *copy_data); -static herr_t H5P_ocpy_close(hid_t ocpypl_id, void *close_data); +static herr_t H5P__ocpy_reg_prop(H5P_genclass_t *pclass); /* Property callbacks */ -static int H5P_ocpy_merge_comm_dt_list_cmp(const void *value1, const void *value2, size_t size); +static herr_t H5P__ocpy_merge_comm_dt_list_copy(const char* name, size_t size, void* value); +static int H5P__ocpy_merge_comm_dt_list_cmp(const void *value1, const void *value2, size_t size); +static herr_t H5P__ocpy_merge_comm_dt_list_close(const char* name, size_t size, void* value); /*********************/ @@ -95,12 +97,12 @@ const H5P_libclass_t H5P_CLS_OCPY[1] = {{ &H5P_CLS_ROOT_g, /* Parent class ID */ &H5P_CLS_OBJECT_COPY_g, /* Pointer to class ID */ &H5P_LST_OBJECT_COPY_g, /* Pointer to default property list ID */ - H5P_ocpy_reg_prop, /* Default property registration routine */ + H5P__ocpy_reg_prop, /* Default property registration routine */ NULL, /* Class creation callback */ NULL, /* Class creation callback info */ - H5P_ocpy_copy, /* Class copy callback */ + NULL, /* Class copy callback */ NULL, /* Class copy callback info */ - H5P_ocpy_close, /* Class close callback */ + NULL, /* Class close callback */ NULL /* Class close callback info */ }}; @@ -120,7 +122,7 @@ H5FL_DEFINE(H5O_copy_dtype_merge_list_t); /*------------------------------------------------------------------------- - * Function: H5P_ocpy_reg_prop + * Function: H5P__ocpy_reg_prop * * Purpose: Initialize the object copy property list class * @@ -131,21 +133,21 @@ H5FL_DEFINE(H5O_copy_dtype_merge_list_t); *------------------------------------------------------------------------- */ static herr_t -H5P_ocpy_reg_prop(H5P_genclass_t *pclass) +H5P__ocpy_reg_prop(H5P_genclass_t *pclass) { unsigned ocpy_option = H5O_CPY_OPTION_DEF; /* Default object copy flags */ H5O_copy_dtype_merge_list_t *merge_comm_dtype_list = H5O_CPY_MERGE_COMM_DT_LIST_DEF; /* Default merge committed dtype list */ H5O_mcdt_cb_info_t mcdt_cb = H5O_CPY_MCDT_SEARCH_CB_DEF; /* Default callback before searching the global list of committed datatypes at destination */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_STATIC /* Register copy options property */ if(H5P_register_real(pclass, H5O_CPY_OPTION_NAME, H5O_CPY_OPTION_SIZE, &ocpy_option, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register merge named dtype list property */ - if(H5P_register_real(pclass, H5O_CPY_MERGE_COMM_DT_LIST_NAME, H5O_CPY_MERGE_COMM_DT_LIST_SIZE, &merge_comm_dtype_list, NULL, NULL, NULL, NULL, NULL, H5O_CPY_MERGE_COMM_DT_LIST_CMP, NULL) < 0) + if(H5P_register_real(pclass, H5O_CPY_MERGE_COMM_DT_LIST_NAME, H5O_CPY_MERGE_COMM_DT_LIST_SIZE, &merge_comm_dtype_list, NULL, NULL, NULL, NULL, H5O_CPY_MERGE_COMM_DT_LIST_COPY, H5O_CPY_MERGE_COMM_DT_LIST_CMP, H5O_CPY_MERGE_COMM_DT_LIST_CLOSE) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register property for callback when completing the search for a matching named datatype from the named dtype list */ @@ -154,47 +156,68 @@ H5P_ocpy_reg_prop(H5P_genclass_t *pclass) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5P_ocpy_reg_prop() */ +} /* end H5P__ocpy_reg_prop() */ /*------------------------------------------------------------------------- - * Function: H5P_ocpy_copy - * - * Purpose: Callback routine which is called whenever any object - * copy property list is copied. This routine copies - * the properties from the old list to the new list. + * Function: H5P__free_merge_comm_dtype_list * - * Return: Success: Non-negative - * Failure: Negative + * Purpose: Frees the provided merge named dtype list * - * Programmer: Neil Fortner - * Friday, October 28, 2011 + * Return: NULL * + * Programmer: Neil Fortner + * October 27, 2011 *------------------------------------------------------------------------- */ +static H5O_copy_dtype_merge_list_t * +H5P__free_merge_comm_dtype_list(H5O_copy_dtype_merge_list_t *dt_list) +{ + H5O_copy_dtype_merge_list_t *tmp_node; + + FUNC_ENTER_STATIC_NOERR + + /* Free the list */ + while(dt_list) { + tmp_node = dt_list->next; + (void)H5MM_xfree(dt_list->path); + (void)H5FL_FREE(H5O_copy_dtype_merge_list_t, dt_list); + dt_list = tmp_node; + } /* end while */ + + FUNC_LEAVE_NOAPI(NULL); +} /* H5P__free_merge_comm_dtype_list */ + + +/*-------------------------------------------------------------------------- + * Function: H5P__ocpy_merge_comm_dt_list_copy + * + * Purpose: Copy the merge committed datatype list + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Quincey Koziol + * Friday, August 31, 2012 + * + *-------------------------------------------------------------------------- + */ /* ARGSUSED */ static herr_t -H5P_ocpy_copy(hid_t dst_plist_id, hid_t src_plist_id, void UNUSED *copy_data) +H5P__ocpy_merge_comm_dt_list_copy(const char UNUSED *name, size_t UNUSED size, + void *value) { - H5O_copy_dtype_merge_list_t *src_dt_list, *dst_dt_list = NULL; /* Source & destination merge named datatype lists */ + const H5O_copy_dtype_merge_list_t *src_dt_list; /* Source merge named datatype lists */ + H5O_copy_dtype_merge_list_t *dst_dt_list = NULL; /* Destination merge named datatype lists */ H5O_copy_dtype_merge_list_t *dst_dt_list_tail = NULL, *tmp_dt_list = NULL; /* temporary merge named datatype lists */ - H5P_genplist_t *src_plist; /* Pointer to source property list */ - H5P_genplist_t *dst_plist; /* Pointer to destination property list */ - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC - /* Verify property list IDs */ - if(NULL == (dst_plist = (H5P_genplist_t *)H5I_object(dst_plist_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an object copy property list") - if(NULL == (src_plist = (H5P_genplist_t *)H5I_object(src_plist_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an object copy property list") - - /* Get the merge committed dtype list property from the old property list */ - if(H5P_get(src_plist, H5O_CPY_MERGE_COMM_DT_LIST_NAME, &src_dt_list) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get merge named dtype list") + HDassert(value); /* Make copy of merge committed dtype list */ + src_dt_list = *(const H5O_copy_dtype_merge_list_t **)value; while(src_dt_list) { /* Copy src_dt_list */ if(NULL == (tmp_dt_list = H5FL_CALLOC(H5O_copy_dtype_merge_list_t))) @@ -217,14 +240,12 @@ H5P_ocpy_copy(hid_t dst_plist_id, hid_t src_plist_id, void UNUSED *copy_data) src_dt_list = src_dt_list->next; } /* end while */ - /* Set the merge named dtype list property for the destination property list - */ - if(H5P_set(dst_plist, H5O_CPY_MERGE_COMM_DT_LIST_NAME, &dst_dt_list) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set merge committed dtype list") + /* Set the merge named dtype list property for the destination property list */ + *(H5O_copy_dtype_merge_list_t **)value = dst_dt_list; done: if(ret_value < 0) { - dst_dt_list = H5P_free_merge_comm_dtype_list(dst_dt_list); + dst_dt_list = H5P__free_merge_comm_dtype_list(dst_dt_list); if(tmp_dt_list) { tmp_dt_list->path = (char *)H5MM_xfree(tmp_dt_list->path); tmp_dt_list = H5FL_FREE(H5O_copy_dtype_merge_list_t, tmp_dt_list); @@ -232,53 +253,11 @@ done: } /* end if */ FUNC_LEAVE_NOAPI(ret_value) -} /* end H5P_ocpy_copy() */ - - -/*------------------------------------------------------------------------- - * Function: H5P_ocpy_close - * - * Purpose: Callback routine which is called whenever any object copy - * property list is closed. This routine performs any generic - * cleanup needed on the properties the library put into the - * list. - * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Neil Fortner - * Friday, October 28, 2011 - * - *------------------------------------------------------------------------- - */ -/* ARGSUSED */ -static herr_t -H5P_ocpy_close(hid_t ocpypl_id, void UNUSED *close_data) -{ - H5O_copy_dtype_merge_list_t *dt_list; /* Merge named datatype list */ - H5P_genplist_t *plist; /* Property list */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI_NOINIT - - /* Check arguments */ - if(NULL == (plist = (H5P_genplist_t *)H5I_object(ocpypl_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an object copy property list") - - /* Get the merge named dtype list property from the old property list */ - if(H5P_get(plist, H5O_CPY_MERGE_COMM_DT_LIST_NAME, &dt_list) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get merge named dtype list") - - /* Free the merge named dtype list */ - dt_list = H5P_free_merge_comm_dtype_list(dt_list); - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5P_ocpy_close() */ +} /* end H5P__ocpy_merge_comm_dt_list_copy() */ /*------------------------------------------------------------------------- - * Function: H5P_ocpy_merge_comm_dt_list_cmp + * Function: H5P__ocpy_merge_comm_dt_list_cmp * * Purpose: Callback routine which is called whenever the merge * named dtype property in the object copy property list @@ -294,14 +273,14 @@ done: *------------------------------------------------------------------------- */ static int -H5P_ocpy_merge_comm_dt_list_cmp(const void *_dt_list1, const void *_dt_list2, +H5P__ocpy_merge_comm_dt_list_cmp(const void *_dt_list1, const void *_dt_list2, size_t UNUSED size) { const H5O_copy_dtype_merge_list_t *dt_list1 = *(H5O_copy_dtype_merge_list_t * const *)_dt_list1, /* Create local aliases for values */ *dt_list2 = *(H5O_copy_dtype_merge_list_t * const *)_dt_list2; herr_t ret_value = 0; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC_NOERR /* Sanity check */ HDassert(_dt_list1); @@ -326,37 +305,35 @@ H5P_ocpy_merge_comm_dt_list_cmp(const void *_dt_list1, const void *_dt_list2, done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5P_ocpy_merge_comm_dt_list_cmp() */ +} /* end H5P__ocpy_merge_comm_dt_list_cmp() */ -/*------------------------------------------------------------------------- - * Function: H5P_free_merge_comm_dtype_list +/*-------------------------------------------------------------------------- + * Function: H5P__ocpy_merge_comm_dt_list_close * - * Purpose: Frees the provided merge named dtype list + * Purpose: Close the merge common datatype list property * - * Return: NULL + * Return: Success: Non-negative + * Failure: Negative * - * Programmer: Neil Fortner - * October 27, 2011 - *------------------------------------------------------------------------- + * Programmer: Quincey Koziol + * Friday, August 31, 2012 + * + *--------------------------------------------------------------------------- */ -static H5O_copy_dtype_merge_list_t * -H5P_free_merge_comm_dtype_list(H5O_copy_dtype_merge_list_t *dt_list) +/* ARGSUSED */ +static herr_t +H5P__ocpy_merge_comm_dt_list_close(const char UNUSED *name, size_t UNUSED size, void *value) { - H5O_copy_dtype_merge_list_t *tmp_node; + FUNC_ENTER_STATIC_NOERR - FUNC_ENTER_NOAPI_NOINIT + HDassert(value); - /* Free the list */ - while(dt_list) { - tmp_node = dt_list->next; - (void)H5MM_xfree(dt_list->path); - (void)H5FL_FREE(H5O_copy_dtype_merge_list_t, dt_list); - dt_list = tmp_node; - } /* end while */ + /* Free the merge named dtype list */ + H5P__free_merge_comm_dtype_list(*(H5O_copy_dtype_merge_list_t **)value); - FUNC_LEAVE_NOAPI(NULL); -} /* H5P_free_merge_comm_dtype_list */ + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5P__ocpy_merge_comm_dt_list_close() */ /*------------------------------------------------------------------------- @@ -541,7 +518,7 @@ H5Pfree_merge_committed_dtype_paths(hid_t plist_id) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get merge committed dtype list") /* Free dtype list */ - dt_list = H5P_free_merge_comm_dtype_list(dt_list); + dt_list = H5P__free_merge_comm_dtype_list(dt_list); /* Update the list stored in the property list (to NULL) */ if(H5P_set(plist, H5O_CPY_MERGE_COMM_DT_LIST_NAME, &dt_list) < 0) |