diff options
Diffstat (limited to 'test/tgenprop.c')
-rw-r--r-- | test/tgenprop.c | 82 |
1 files changed, 36 insertions, 46 deletions
diff --git a/test/tgenprop.c b/test/tgenprop.c index 10cae6d..fda4161 100644 --- a/test/tgenprop.c +++ b/test/tgenprop.c @@ -61,6 +61,18 @@ double prop4_def=1.41F; /* Property 4 default value */ #define PROP4_SIZE sizeof(prop4_def) #define PROP4_DEF_VALUE (&prop4_def) +/* Structs used during iteration */ +typedef struct iter_data_t { + int iter_count; + char **names; +} iter_data_t; + +typedef struct count_data_t { + int count; + hid_t id; +} count_data_t; + + /**************************************************************** ** ** test_genprop_basic_class(): Test basic generic property list code. @@ -284,17 +296,12 @@ test_genprop_basic_class_prop(void) ** ****************************************************************/ static int -test_genprop_iter1(hid_t id, const char *name, void *iter_data) +test_genprop_iter1(hid_t H5_ATTR_UNUSED id, const char *name, + void *iter_data) { - struct { /* Struct for iterations */ - int iter_count; - const char **names; - } *iter_struct = iter_data; - - /* Shut compiler up */ - id = id; + iter_data_t *idata = (iter_data_t *)iter_data; - return(HDstrcmp(name,iter_struct->names[iter_struct->iter_count++])); + return HDstrcmp(name,idata->names[idata->iter_count++]); } /**************************************************************** @@ -373,43 +380,34 @@ test_genprop_class_iter(void) static herr_t test_genprop_cls_crt_cb1(hid_t list_id, void *create_data) { - struct { /* Struct for iterations */ - int count; - hid_t id; - } *count_struct=create_data; + count_data_t *cdata = (count_data_t *)create_data; - count_struct->count++; - count_struct->id=list_id; + cdata->count++; + cdata->id = list_id; - return(SUCCEED); + return SUCCEED; } static herr_t test_genprop_cls_cpy_cb1(hid_t new_list_id, hid_t H5_ATTR_UNUSED old_list_id, void *copy_data) { - struct { /* Struct for iterations */ - int count; - hid_t id; - } *count_struct=copy_data; + count_data_t *cdata = (count_data_t *)copy_data; - count_struct->count++; - count_struct->id=new_list_id; + cdata->count++; + cdata->id = new_list_id; - return(SUCCEED); + return SUCCEED; } static herr_t test_genprop_cls_cls_cb1(hid_t list_id, void *create_data) { - struct { /* Struct for iterations */ - int count; - hid_t id; - } *count_struct=create_data; + count_data_t *cdata = (count_data_t *)create_data; - count_struct->count++; - count_struct->id=list_id; + cdata->count++; + cdata->id = list_id; - return(SUCCEED); + return SUCCEED; } /**************************************************************** @@ -843,17 +841,12 @@ test_genprop_basic_list_prop(void) ** ****************************************************************/ static int -test_genprop_iter2(hid_t id, const char *name, void *iter_data) +test_genprop_iter2(hid_t H5_ATTR_UNUSED id, const char *name, + void *iter_data) { - struct { /* Struct for iterations */ - int iter_count; - const char **names; - } *iter_struct=iter_data; - - /* Shut compiler up */ - id=id; + iter_data_t *idata = (iter_data_t *)iter_data; - return(HDstrcmp(name,iter_struct->names[iter_struct->iter_count++])); + return HDstrcmp(name,idata->names[idata->iter_count++]); } /**************************************************************** @@ -995,15 +988,12 @@ prop_cb_info prop3_cb_info; /* Callback statistics for property #3 */ static herr_t test_genprop_cls_cpy_cb2(hid_t new_list_id, hid_t H5_ATTR_UNUSED old_list_id, void *create_data) { - struct { /* Struct for iterations */ - int count; - hid_t id; - } *count_struct=create_data; + count_data_t *cdata = (count_data_t *)create_data; - count_struct->count++; - count_struct->id=new_list_id; + cdata->count++; + cdata->id = new_list_id; - return(SUCCEED); + return SUCCEED; } /**************************************************************** |