diff options
author | Dana Robinson <derobins@hdfgroup.org> | 2021-03-25 00:39:37 (GMT) |
---|---|---|
committer | Dana Robinson <derobins@hdfgroup.org> | 2021-03-25 00:39:37 (GMT) |
commit | feb20aac304b39e18c70f88cae2f7cf7d5c82db2 (patch) | |
tree | e15d7e751af4e3c42e77ea955d91db4cf27a71cf /src/H5Gcache.c | |
parent | bdac2ecdbff2c389a222b3d93ff1eb1d23ec6b23 (diff) | |
download | hdf5-feb20aac304b39e18c70f88cae2f7cf7d5c82db2.zip hdf5-feb20aac304b39e18c70f88cae2f7cf7d5c82db2.tar.gz hdf5-feb20aac304b39e18c70f88cae2f7cf7d5c82db2.tar.bz2 |
Formats the source and updates the gcc warning pragmas
Diffstat (limited to 'src/H5Gcache.c')
-rw-r--r-- | src/H5Gcache.c | 113 |
1 files changed, 47 insertions, 66 deletions
diff --git a/src/H5Gcache.c b/src/H5Gcache.c index ca67d56..23ca7ca 100644 --- a/src/H5Gcache.c +++ b/src/H5Gcache.c @@ -26,92 +26,80 @@ /* Module Setup */ /****************/ -#include "H5Gmodule.h" /* This source code file is part of the H5G module */ - +#include "H5Gmodule.h" /* This source code file is part of the H5G module */ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Gpkg.h" /* Groups */ -#include "H5MFprivate.h" /* File memory management */ -#include "H5MMprivate.h" /* Memory management */ -#include "H5WBprivate.h" /* Wrapped Buffers */ - +#include "H5private.h" /* Generic Functions */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Gpkg.h" /* Groups */ +#include "H5MFprivate.h" /* File memory management */ +#include "H5MMprivate.h" /* Memory management */ +#include "H5WBprivate.h" /* Wrapped Buffers */ /****************/ /* Local Macros */ /****************/ -#define H5G_NODE_VERS 1 /* Symbol table node version number */ - +#define H5G_NODE_VERS 1 /* Symbol table node version number */ /******************/ /* Local Typedefs */ /******************/ - /********************/ /* Package Typedefs */ /********************/ - /********************/ /* Local Prototypes */ /********************/ /* Metadata cache (H5AC) callbacks */ static herr_t H5G__cache_node_get_initial_load_size(void *udata, size_t *image_len); -static void *H5G__cache_node_deserialize(const void *image, size_t len, - void *udata, hbool_t *dirty); +static void * H5G__cache_node_deserialize(const void *image, size_t len, void *udata, hbool_t *dirty); static herr_t H5G__cache_node_image_len(const void *thing, size_t *image_len); -static herr_t H5G__cache_node_serialize(const H5F_t *f, void *image, - size_t len, void *thing); +static herr_t H5G__cache_node_serialize(const H5F_t *f, void *image, size_t len, void *thing); static herr_t H5G__cache_node_free_icr(void *thing); - /*********************/ /* Package Variables */ /*********************/ - /*****************************/ /* Library Private Variables */ /*****************************/ - /*******************/ /* Local Variables */ /*******************/ /* Symbol table nodes inherit cache-like properties from H5AC */ const H5AC_class_t H5AC_SNODE[1] = {{ - H5AC_SNODE_ID, /* Metadata client ID */ - "Symbol table node", /* Metadata client name (for debugging) */ - H5FD_MEM_BTREE, /* File space memory type for client */ - H5AC__CLASS_NO_FLAGS_SET, /* Client class behavior flags */ - H5G__cache_node_get_initial_load_size, /* 'get_initial_load_size' callback */ - NULL, /* 'get_final_load_size' callback */ - NULL, /* 'verify_chksum' callback */ - H5G__cache_node_deserialize, /* 'deserialize' callback */ - H5G__cache_node_image_len, /* 'image_len' callback */ - NULL, /* 'pre_serialize' callback */ - H5G__cache_node_serialize, /* 'serialize' callback */ - NULL, /* 'notify' callback */ - H5G__cache_node_free_icr, /* 'free_icr' callback */ - NULL, /* 'fsf_size' callback */ - NULL, /* VFD SWMR 'refresh' callback */ + H5AC_SNODE_ID, /* Metadata client ID */ + "Symbol table node", /* Metadata client name (for debugging) */ + H5FD_MEM_BTREE, /* File space memory type for client */ + H5AC__CLASS_NO_FLAGS_SET, /* Client class behavior flags */ + H5G__cache_node_get_initial_load_size, /* 'get_initial_load_size' callback */ + NULL, /* 'get_final_load_size' callback */ + NULL, /* 'verify_chksum' callback */ + H5G__cache_node_deserialize, /* 'deserialize' callback */ + H5G__cache_node_image_len, /* 'image_len' callback */ + NULL, /* 'pre_serialize' callback */ + H5G__cache_node_serialize, /* 'serialize' callback */ + NULL, /* 'notify' callback */ + H5G__cache_node_free_icr, /* 'free_icr' callback */ + NULL, /* 'fsf_size' callback */ + NULL, /* VFD SWMR 'refresh' callback */ }}; - /* Declare extern the free list to manage the H5G_node_t struct */ H5FL_EXTERN(H5G_node_t); /* Declare extern the free list to manage sequences of H5G_entry_t's */ H5FL_SEQ_EXTERN(H5G_entry_t); - /*------------------------------------------------------------------------- * Function: H5G__cache_node_get_initial_load_size() * @@ -129,7 +117,7 @@ H5FL_SEQ_EXTERN(H5G_entry_t); static herr_t H5G__cache_node_get_initial_load_size(void *_udata, size_t *image_len) { - H5F_t *f = (H5F_t *)_udata; /* User data for callback */ + H5F_t *f = (H5F_t *)_udata; /* User data for callback */ FUNC_ENTER_STATIC_NOERR @@ -143,7 +131,6 @@ H5G__cache_node_get_initial_load_size(void *_udata, size_t *image_len) FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5G__cache_node_get_initial_load_size() */ - /*------------------------------------------------------------------------- * Function: H5G__cache_node_deserialize * @@ -166,14 +153,13 @@ H5G__cache_node_get_initial_load_size(void *_udata, size_t *image_len) *------------------------------------------------------------------------- */ static void * -H5G__cache_node_deserialize(const void *_image, size_t len, void *_udata, - hbool_t H5_ATTR_UNUSED *dirty) +H5G__cache_node_deserialize(const void *_image, size_t len, void *_udata, hbool_t H5_ATTR_UNUSED *dirty) { - H5F_t *f = (H5F_t *)_udata; /* User data for callback */ - H5G_node_t *sym = NULL; /* Symbol table node created */ - const uint8_t *image = (const uint8_t *)_image; /* Pointer to image to deserialize */ - const uint8_t *image_end = image + len - 1; /* Pointer to end of image buffer */ - void *ret_value = NULL; /* Return value */ + H5F_t * f = (H5F_t *)_udata; /* User data for callback */ + H5G_node_t * sym = NULL; /* Symbol table node created */ + const uint8_t *image = (const uint8_t *)_image; /* Pointer to image to deserialize */ + const uint8_t *image_end = image + len - 1; /* Pointer to end of image buffer */ + void * ret_value = NULL; /* Return value */ FUNC_ENTER_STATIC @@ -184,19 +170,19 @@ H5G__cache_node_deserialize(const void *_image, size_t len, void *_udata, HDassert(dirty); /* Allocate symbol table data structures */ - if(NULL == (sym = H5FL_CALLOC(H5G_node_t))) + if (NULL == (sym = H5FL_CALLOC(H5G_node_t))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") sym->node_size = (size_t)(H5G_NODE_SIZE(f)); - if(NULL == (sym->entry = H5FL_SEQ_CALLOC(H5G_entry_t, (size_t)(2 * H5F_SYM_LEAF_K(f))))) + if (NULL == (sym->entry = H5FL_SEQ_CALLOC(H5G_entry_t, (size_t)(2 * H5F_SYM_LEAF_K(f))))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") /* magic */ - if(HDmemcmp(image, H5G_NODE_MAGIC, (size_t)H5_SIZEOF_MAGIC)) + if (HDmemcmp(image, H5G_NODE_MAGIC, (size_t)H5_SIZEOF_MAGIC)) HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, NULL, "bad symbol table node signature") image += H5_SIZEOF_MAGIC; /* version */ - if(H5G_NODE_VERS != *image++) + if (H5G_NODE_VERS != *image++) HGOTO_ERROR(H5E_SYM, H5E_VERSION, NULL, "bad symbol table node version") /* reserved */ @@ -206,21 +192,20 @@ H5G__cache_node_deserialize(const void *_image, size_t len, void *_udata, UINT16DECODE(image, sym->nsyms); /* entries */ - if(H5G__ent_decode_vec(f, &image, image_end, sym->entry, sym->nsyms) < 0) + if (H5G__ent_decode_vec(f, &image, image_end, sym->entry, sym->nsyms) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, NULL, "unable to decode symbol table entries") /* Set return value */ ret_value = sym; done: - if(!ret_value) - if(sym && H5G__node_free(sym) < 0) + if (!ret_value) + if (sym && H5G__node_free(sym) < 0) HDONE_ERROR(H5E_SYM, H5E_CANTFREE, NULL, "unable to destroy symbol table node") FUNC_LEAVE_NOAPI(ret_value) } /* end H5G__cache_node_deserialize() */ - /*------------------------------------------------------------------------- * Function: H5G__cache_node_image_len * @@ -253,7 +238,6 @@ H5G__cache_node_image_len(const void *_thing, size_t *image_len) FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5G__cache_node_image_len() */ - /*------------------------------------------------------------------------- * Function: H5G__cache_node_serialize * @@ -271,12 +255,11 @@ H5G__cache_node_image_len(const void *_thing, size_t *image_len) *------------------------------------------------------------------------- */ static herr_t -H5G__cache_node_serialize(const H5F_t *f, void *_image, size_t len, - void *_thing) +H5G__cache_node_serialize(const H5F_t *f, void *_image, size_t len, void *_thing) { - H5G_node_t *sym = (H5G_node_t *)_thing; /* Pointer to object */ - uint8_t *image = (uint8_t *)_image; /* Pointer into raw data buffer */ - herr_t ret_value = SUCCEED; /* Return value */ + H5G_node_t *sym = (H5G_node_t *)_thing; /* Pointer to object */ + uint8_t * image = (uint8_t *)_image; /* Pointer into raw data buffer */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC @@ -302,7 +285,7 @@ H5G__cache_node_serialize(const H5F_t *f, void *_image, size_t len, UINT16ENCODE(image, sym->nsyms); /* entries */ - if(H5G__ent_encode_vec(f, &image, sym->entry, sym->nsyms) < 0) + if (H5G__ent_encode_vec(f, &image, sym->entry, sym->nsyms) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTENCODE, FAIL, "can't serialize") /* Clear rest of symbol table node */ @@ -312,7 +295,6 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5G__cache_node_serialize() */ - /*------------------------------------------------------------------------- * Function: H5G__cache_node_free_icr * @@ -333,8 +315,8 @@ done: static herr_t H5G__cache_node_free_icr(void *_thing) { - H5G_node_t *sym = (H5G_node_t *)_thing; /* Pointer to the object */ - herr_t ret_value = SUCCEED; /* Return value */ + H5G_node_t *sym = (H5G_node_t *)_thing; /* Pointer to the object */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC @@ -344,10 +326,9 @@ H5G__cache_node_free_icr(void *_thing) HDassert(sym->cache_info.type == H5AC_SNODE); /* Destroy symbol table node */ - if(H5G__node_free(sym) < 0) + if (H5G__node_free(sym) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTFREE, FAIL, "unable to destroy symbol table node") done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5G__cache_node_free_icr() */ - |