From d05f87ceb80be708fc086821ae5517e764b66793 Mon Sep 17 00:00:00 2001 From: Jerome Soumagne Date: Sun, 3 Apr 2016 00:51:50 -0500 Subject: Use struct href instead of struct href_t in H5Rpkg --- src/H5R.c | 70 ++++++++++++++++++++++++++++----------------------------- src/H5Rpkg.h | 2 +- src/H5Rpublic.h | 2 +- src/H5Tref.c | 14 ++++++------ 4 files changed, 44 insertions(+), 44 deletions(-) diff --git a/src/H5R.c b/src/H5R.c index 2c386d9..eef2ea4 100644 --- a/src/H5R.c +++ b/src/H5R.c @@ -213,7 +213,7 @@ H5R_create_object(H5G_loc_t *loc, const char *name, hid_t dxpl_id) H5G_name_t path; /* Object group hier. path */ H5O_loc_t oloc; /* Object object location */ hbool_t obj_found = FALSE; /* Object location found */ - struct href_t *ret_value = NULL; /* Return value */ + struct href *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -230,7 +230,7 @@ H5R_create_object(H5G_loc_t *loc, const char *name, hid_t dxpl_id) HGOTO_ERROR(H5E_REFERENCE, H5E_NOTFOUND, NULL, "object not found") obj_found = TRUE; - if(NULL == (ret_value = (struct href_t *)H5MM_malloc(sizeof(struct href_t)))) + if(NULL == (ret_value = (struct href *)H5MM_malloc(sizeof(struct href)))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "Cannot allocate memory for reference") ret_value->ref_type = H5R_OBJECT; @@ -263,8 +263,8 @@ H5R_create_region(H5G_loc_t *loc, const char *name, hid_t dxpl_id, H5S_t *space) hbool_t obj_found = FALSE; /* Object location found */ hssize_t buf_size; /* Size of buffer needed to serialize selection */ uint8_t *p; /* Pointer to OID to store */ - struct href_t *ref = NULL; /* Reference to be returned */ - struct href_t *ret_value = NULL; /* Return value */ + struct href *ref = NULL; /* Reference to be returned */ + struct href *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -291,7 +291,7 @@ H5R_create_region(H5G_loc_t *loc, const char *name, hid_t dxpl_id, H5S_t *space) /* Allocate the space to store the serialized information */ H5_CHECK_OVERFLOW(buf_size, hssize_t, size_t); - if(NULL == (ref = (struct href_t *)H5MM_malloc(sizeof(struct href_t)))) + if(NULL == (ref = (struct href *)H5MM_malloc(sizeof(struct href)))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "Cannot allocate memory for reference") if(NULL == (ref->ref.serial.buf = H5MM_malloc((size_t) buf_size))) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTALLOC, NULL, "Cannot allocate buffer to serialize selection") @@ -340,8 +340,8 @@ H5R_create_attr(H5G_loc_t *loc, const char *name, hid_t dxpl_id, const char *att size_t buf_size; /* Size of buffer needed to serialize attribute */ size_t attr_name_len; /* Length of the attribute name */ uint8_t *p; /* Pointer to OID to store */ - struct href_t *ref = NULL; /* Reference to be returned */ - struct href_t *ret_value = NULL; /* Return value */ + struct href *ref = NULL; /* Reference to be returned */ + struct href *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -368,7 +368,7 @@ H5R_create_attr(H5G_loc_t *loc, const char *name, hid_t dxpl_id, const char *att buf_size = attr_name_len + sizeof(uint16_t) + sizeof(haddr_t); /* Allocate the space to store the serialized information */ - if(NULL == (ref = (struct href_t *)H5MM_malloc(sizeof(struct href_t)))) + if(NULL == (ref = (struct href *)H5MM_malloc(sizeof(struct href)))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "Cannot allocate memory for reference") if (NULL == (ref->ref.serial.buf = H5MM_malloc(buf_size))) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTALLOC, NULL, "Cannot allocate buffer to serialize selection") @@ -419,8 +419,8 @@ H5R_create_ext_object(const char *filename, const char *pathname) size_t pathname_len; /* Length of the obj path name */ size_t buf_size; /* Size of buffer needed to serialize reference */ uint8_t *p; /* Pointer to OID to store */ - struct href_t *ref = NULL; /* Reference to be returned */ - struct href_t *ret_value = NULL; /* Return value */ + struct href *ref = NULL; /* Reference to be returned */ + struct href *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -436,7 +436,7 @@ H5R_create_ext_object(const char *filename, const char *pathname) /* Compute buffer size, allow for the file name and object path name lengths */ buf_size = filename_len + pathname_len + 2 * sizeof(uint16_t); - if(NULL == (ref = (struct href_t *)H5MM_malloc(sizeof(struct href_t)))) + if(NULL == (ref = (struct href *)H5MM_malloc(sizeof(struct href)))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "Cannot allocate memory for reference") if (NULL == (ref->ref.serial.buf = H5MM_malloc(buf_size))) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTALLOC, NULL, "Cannot allocate buffer to serialize selection") @@ -491,8 +491,8 @@ H5R_create_ext_region(const char *filename, const char *pathname, H5S_t *space) size_t buf_size; /* Size of buffer needed to serialize selection */ size_t space_buf_size; /* Size of buffer needed to serialize selection */ uint8_t *p = NULL; /* Pointer to OID to store */ - struct href_t *ref = NULL; /* Reference to be returned */ - struct href_t *ret_value = NULL; /* Return value */ + struct href *ref = NULL; /* Reference to be returned */ + struct href *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -514,7 +514,7 @@ H5R_create_ext_region(const char *filename, const char *pathname, H5S_t *space) buf_size = space_buf_size + filename_len + pathname_len + 2 * sizeof(uint16_t); /* Allocate the space to store the serialized information */ - if(NULL == (ref = (struct href_t *)H5MM_malloc(sizeof(struct href_t)))) + if(NULL == (ref = (struct href *)H5MM_malloc(sizeof(struct href)))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "Cannot allocate memory for reference") if (NULL == (ref->ref.serial.buf = H5MM_malloc((size_t) buf_size))) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTALLOC, NULL, "Cannot allocate buffer to serialize selection") @@ -573,8 +573,8 @@ H5R_create_ext_attr(const char *filename, const char *pathname, const char *attr size_t attr_name_len; /* Length of the attribute name */ size_t buf_size; /* Size of buffer needed to serialize reference */ uint8_t *p; /* Pointer to OID to store */ - struct href_t *ref = NULL; /* Reference to be returned */ - struct href_t *ret_value = NULL; /* Return value */ + struct href *ref = NULL; /* Reference to be returned */ + struct href *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -597,7 +597,7 @@ H5R_create_ext_attr(const char *filename, const char *pathname, const char *attr buf_size = filename_len + pathname_len + attr_name_len + 3 * sizeof(uint16_t); /* Allocate the space to store the serialized information */ - if(NULL == (ref = (struct href_t *)H5MM_malloc(sizeof(struct href_t)))) + if(NULL == (ref = (struct href *)H5MM_malloc(sizeof(struct href)))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "Cannot allocate memory for reference") if (NULL == (ref->ref.serial.buf = H5MM_malloc(buf_size))) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTALLOC, NULL, "Cannot allocate buffer to serialize selection") @@ -862,7 +862,7 @@ done: herr_t H5R_destroy(href_t _ref) { - struct href_t *ref = (struct href_t *) _ref; /* Reference */ + struct href *ref = (struct href *) _ref; /* Reference */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -916,7 +916,7 @@ done: H5R_type_t H5R_get_type(href_t _ref) { - struct href_t *ref = (struct href_t *) _ref; /* Reference */ + struct href *ref = (struct href *) _ref; /* Reference */ H5R_type_t ret_value = H5R_BADTYPE; FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -969,8 +969,8 @@ done: static htri_t H5R__equal(href_t _ref1, href_t _ref2) { - struct href_t *ref1 = (struct href_t *) _ref1; /* Reference */ - struct href_t *ref2 = (struct href_t *) _ref2; /* Reference */ + struct href *ref1 = (struct href *) _ref1; /* Reference */ + struct href *ref2 = (struct href *) _ref2; /* Reference */ htri_t ret_value = FAIL; FUNC_ENTER_NOAPI_NOINIT @@ -1057,7 +1057,7 @@ H5R__get_object(H5F_t *file, hid_t oapl_id, hid_t dxpl_id, href_t _ref, hbool_t H5O_type_t obj_type; /* Type of object */ hbool_t ext_ref = FALSE; /* External reference */ const uint8_t *p = NULL; /* Pointer to OID to store */ - struct href_t *ref = (struct href_t *) _ref; /* Reference */ + struct href *ref = (struct href *) _ref; /* Reference */ hid_t ret_value = H5I_BADID; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -1234,7 +1234,7 @@ done: hid_t H5Rget_object(hid_t obj_id, hid_t oapl_id, href_t _ref) { - struct href_t *ref = (struct href_t *) _ref; /* Reference */ + struct href *ref = (struct href *) _ref; /* Reference */ H5G_loc_t loc; /* Group location */ hid_t ret_value; @@ -1274,7 +1274,7 @@ H5S_t * H5R__get_region(H5F_t *file, hid_t dxpl_id, href_t _ref) { const uint8_t *p = NULL; /* Pointer to OID to store */ - struct href_t *ref = (struct href_t *) _ref; /* Reference */ + struct href *ref = (struct href *) _ref; /* Reference */ H5S_t *ret_value = NULL; FUNC_ENTER_NOAPI_NOINIT @@ -1346,7 +1346,7 @@ H5Rget_region2(hid_t loc_id, href_t _ref) { H5G_loc_t loc; /* Object's group location */ H5S_t *space = NULL; /* Dataspace object */ - struct href_t *ref = (struct href_t *) _ref; /* Reference */ + struct href *ref = (struct href *) _ref; /* Reference */ hid_t ret_value; FUNC_ENTER_API(FAIL) @@ -1392,7 +1392,7 @@ H5R__get_attr(H5F_t *file, hid_t dxpl_id, href_t _ref) size_t attr_name_len; /* Length of the attribute name */ char *attr_name = NULL; /* Attribute name */ const uint8_t *p = NULL; /* Pointer to OID to store */ - struct href_t *ref = (struct href_t *) _ref; /* Reference */ + struct href *ref = (struct href *) _ref; /* Reference */ H5A_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -1486,7 +1486,7 @@ done: hid_t H5Rget_attr(hid_t loc_id, href_t _ref) { - struct href_t *ref = (struct href_t *) _ref; /* Reference */ + struct href *ref = (struct href *) _ref; /* Reference */ H5G_loc_t loc; /* Group location */ H5A_t *attr; /* Attribute */ hid_t ret_value; @@ -1534,7 +1534,7 @@ H5R__get_obj_type(H5F_t *file, hid_t dxpl_id, href_t _ref, H5O_type_t *obj_type) unsigned rc; /* Reference count of object */ hbool_t ext_ref = FALSE; /* External reference */ const uint8_t *p = NULL; /* Pointer to OID to store */ - struct href_t *ref = (struct href_t *) _ref; /* Reference */ + struct href *ref = (struct href *) _ref; /* Reference */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -1649,7 +1649,7 @@ herr_t H5Rget_obj_type3(hid_t loc_id, href_t _ref, H5O_type_t *obj_type) { H5G_loc_t loc; /* Object location */ - struct href_t *ref = (struct href_t *) _ref; /* Reference */ + struct href *ref = (struct href *) _ref; /* Reference */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1690,7 +1690,7 @@ H5R__get_obj_name(H5F_t *f, hid_t lapl_id, hid_t dxpl_id, href_t _ref, ssize_t ret_value = -1; /* Return value */ hbool_t ext_ref = FALSE; /* External reference */ const uint8_t *p = NULL; /* Pointer to reference to decode */ - struct href_t *ref = (struct href_t *) _ref; /* Reference */ + struct href *ref = (struct href *) _ref; /* Reference */ FUNC_ENTER_NOAPI_NOINIT @@ -1801,7 +1801,7 @@ H5Rget_obj_name(hid_t loc_id, href_t _ref, char *name, size_t size) { H5G_loc_t loc; /* Group location */ H5F_t *file; /* File object */ - struct href_t *ref = (struct href_t *) _ref; /* Reference */ + struct href *ref = (struct href *) _ref; /* Reference */ ssize_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1842,7 +1842,7 @@ H5R__get_attr_name(H5F_t *f, href_t _ref, char *name, size_t size) const uint8_t *p = NULL; /* Pointer to reference to decode */ size_t attr_name_len; /* Length of the attribute name */ size_t copy_len; - struct href_t *ref = (struct href_t *) _ref; /* Reference */ + struct href *ref = (struct href *) _ref; /* Reference */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -1913,7 +1913,7 @@ H5Rget_attr_name(hid_t loc_id, href_t _ref, char *name, size_t size) { H5G_loc_t loc; /* Group location */ H5F_t *file; /* File object */ - struct href_t *ref = (struct href_t *) _ref; /* Reference */ + struct href *ref = (struct href *) _ref; /* Reference */ ssize_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1951,7 +1951,7 @@ done: static ssize_t H5R__get_file_name(href_t _ref, char *name, size_t size) { - struct href_t *ref = (struct href_t *) _ref; /* Reference */ + struct href *ref = (struct href *) _ref; /* Reference */ ssize_t ret_value = -1; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -2009,7 +2009,7 @@ done: ssize_t H5Rget_file_name(href_t _ref, char *name, size_t size) { - struct href_t *ref = (struct href_t *) _ref; /* Reference */ + struct href *ref = (struct href *) _ref; /* Reference */ ssize_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) diff --git a/src/H5Rpkg.h b/src/H5Rpkg.h index ff9acc2..dc13907 100644 --- a/src/H5Rpkg.h +++ b/src/H5Rpkg.h @@ -46,7 +46,7 @@ /****************************/ /* Internal data structures */ -struct href_t { +struct href { H5R_type_t ref_type; union { struct { diff --git a/src/H5Rpublic.h b/src/H5Rpublic.h index 32eeaba..5bcf5ef 100644 --- a/src/H5Rpublic.h +++ b/src/H5Rpublic.h @@ -40,7 +40,7 @@ typedef enum { } H5R_type_t; /* Opaque reference type */ -typedef struct href_t *href_t; +typedef struct href *href_t; /* NULL reference */ #define HREF_NULL ((href_t)0) diff --git a/src/H5Tref.c b/src/H5Tref.c index 68a9996..40b2cc9 100644 --- a/src/H5Tref.c +++ b/src/H5Tref.c @@ -170,7 +170,7 @@ static size_t H5T__ref_mem_getsize(const void *_ref) { const href_t *ref_ptr = (const href_t *)_ref; - const struct href_t *ref; + const struct href *ref; FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -196,7 +196,7 @@ H5T__ref_mem_read(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, void *_ref, void *buf, size_t buf_size) { const href_t *ref_ptr = (const href_t *)_ref; - const struct href_t *ref; + const struct href *ref; FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -227,7 +227,7 @@ H5T__ref_mem_write(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, { herr_t ret_value = SUCCEED; /* Return value */ href_t *ref_ptr = (href_t *)_ref; - struct href_t *ref; + struct href *ref; FUNC_ENTER_NOAPI_NOINIT @@ -236,7 +236,7 @@ H5T__ref_mem_write(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, HDassert(buf); HDassert(buf_size); - if (NULL == (ref = (struct href_t *)H5MM_malloc(sizeof(struct href_t)))) + if (NULL == (ref = (struct href *)H5MM_malloc(sizeof(struct href)))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for reference data") if (NULL == (ref->ref.serial.buf = H5MM_malloc(buf_size))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for reference data") @@ -288,7 +288,7 @@ H5T__obj_ref_mem_read(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, void *_ref, void *buf, size_t H5_ATTR_UNUSED buf_size) { const href_t *ref_ptr = (const href_t *)_ref; - const struct href_t *ref; + const struct href *ref; FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -319,7 +319,7 @@ H5T__obj_ref_mem_write(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, { herr_t ret_value = SUCCEED; /* Return value */ href_t *ref_ptr = (href_t *)_ref; - struct href_t *ref; + struct href *ref; FUNC_ENTER_NOAPI_NOINIT @@ -328,7 +328,7 @@ H5T__obj_ref_mem_write(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, HDassert(buf); HDassert(buf_size); - if (NULL == (ref = (struct href_t *)H5MM_malloc(sizeof(struct href_t)))) + if (NULL == (ref = (struct href *)H5MM_malloc(sizeof(struct href)))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for reference data") /* Copy the data into the newly allocated buffer */ -- cgit v0.12