本文整理汇总了C++中FUNC_ENTER_NOAPI函数的典型用法代码示例。如果您正苦于以下问题:C++ FUNC_ENTER_NOAPI函数的具体用法?C++ FUNC_ENTER_NOAPI怎么用?C++ FUNC_ENTER_NOAPI使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了FUNC_ENTER_NOAPI函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: H5I_search
/*-------------------------------------------------------------------------
* Function: H5I_search
*
* Purpose: Apply function FUNC to each member of group GRP and return a
* pointer to the first object for which FUNC returns non-zero.
* The FUNC should take a pointer to the object and the KEY as
* arguments and return non-zero to terminate the search (zero
* to continue).
*
* Limitation: Currently there is no way to start searching from where a
* previous search left off.
*
* Return: Success: The first object in the group for which FUNC
* returns non-zero. NULL if FUNC returned zero
* for every object in the group.
*
* Failure: NULL
*
* Programmer: Robb Matzke
* Friday, February 19, 1999
*
* Modifications:
*
*-------------------------------------------------------------------------
*/
void *
H5I_search(H5I_type_t grp, H5I_search_func_t func, void *key)
{
H5I_id_group_t *grp_ptr = NULL; /*ptr to the group */
H5I_id_info_t *id_ptr = NULL; /*ptr to the new ID */
H5I_id_info_t *next_id = NULL; /*ptr to the next ID */
unsigned i; /*counter */
void *ret_value = NULL; /*return value */
FUNC_ENTER_NOAPI(H5I_search, NULL);
/* Check arguments */
if (grp <= H5I_BADID || grp >= H5I_NGROUPS)
HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, NULL, "invalid group number");
grp_ptr = H5I_id_group_list_g[grp];
if (grp_ptr == NULL || grp_ptr->count <= 0)
HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, NULL, "invalid group");
/* Only iterate through hash table if there are IDs in group */
if(grp_ptr->ids > 0) {
/* Start at the beginning of the array */
for (i=0; i<grp_ptr->hash_size; i++) {
id_ptr = grp_ptr->id_list[i];
while (id_ptr) {
next_id= id_ptr->next; /* Protect against ID being deleted in callback */
if ((*func)(id_ptr->obj_ptr, id_ptr->id, key))
HGOTO_DONE(id_ptr->obj_ptr); /*found the item*/
id_ptr = next_id;
} /* end while */
} /* end for */
} /* end if */
done:
FUNC_LEAVE_NOAPI(ret_value);
} /* end H5I_search() */
示例2: H5I_get_ref
/*-------------------------------------------------------------------------
* Function: H5I_get_ref
*
* Purpose: Retrieve the reference count for an object.
*
* Return: Success: The reference count.
*
* Failure: Negative
*
* Programmer: Quincey Koziol
* Saturday, Decemeber 6, 2003
*
* Modifications:
*
*-------------------------------------------------------------------------
*/
int
H5I_get_ref(hid_t id)
{
H5I_type_t grp; /*group the object is in*/
H5I_id_group_t *grp_ptr; /*ptr to the group */
H5I_id_info_t *id_ptr; /*ptr to the ID */
int ret_value; /* Return value */
FUNC_ENTER_NOAPI(H5I_get_ref, FAIL);
/* Sanity check */
assert(id>=0);
/* Check arguments */
grp = H5I_GROUP(id);
if (grp <= H5I_BADID || grp >= H5I_NGROUPS)
HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid group number");
grp_ptr = H5I_id_group_list_g[grp];
if (!grp_ptr || grp_ptr->count<=0)
HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, FAIL, "invalid group");
/* General lookup of the ID */
if (NULL==(id_ptr=H5I_find_id(id)))
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't locate ID");
/* Set return value */
ret_value=id_ptr->count;
done:
FUNC_LEAVE_NOAPI(ret_value);
} /* end H5I_get_ref() */
示例3: H5MF_realloc
/*-------------------------------------------------------------------------
* Function: H5MF_realloc
*
* Purpose: Changes the size of an allocated chunk, possibly moving it to
* a new address. The chunk to change is at address OLD_ADDR
* and is exactly OLD_SIZE bytes (if these are H5F_ADDR_UNDEF
* and zero then this function acts like H5MF_alloc). The new
* size will be NEW_SIZE and its address is the return value (if
* NEW_SIZE is zero then this function acts like H5MF_free and
* an undefined address is returned).
*
* If the new size is less than the old size then the new
* address will be the same as the old address (except for the
* special case where the new size is zero).
*
* If the new size is more than the old size then most likely a
* new address will be returned. However, under certain
* circumstances the library may return the same address.
*
* Return: Success: The relative file address of the new block.
*
* Failure: HADDR_UNDEF
*
* Programmer: Robb Matzke
* Thursday, April 16, 1998
*
* Modifications:
* Robb Matzke, 1999-07-28
* The ORIG_ADDR is passed by value. The name of NEW_ADDR has
* been changed to NEW_ADDR_P
*
* Robb Matzke, 1999-08-04
* Modified to work with the virtual file layer.
*-------------------------------------------------------------------------
*/
haddr_t
H5MF_realloc(H5F_t *f, H5FD_mem_t type, hid_t dxpl_id, haddr_t old_addr, hsize_t old_size,
hsize_t new_size)
{
haddr_t ret_value;
FUNC_ENTER_NOAPI(H5MF_realloc, HADDR_UNDEF);
/* Convert old relative address to absolute address */
old_addr += f->shared->base_addr;
/* Check that the file can address the new space. */
/* In the worst case, this means adding new_size bytes to the end of the file. */
if( H5MF_alloc_overflow(f, new_size) )
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, HADDR_UNDEF, "not enough address space in file");
/* Reallocate memory from the virtual file layer */
ret_value = H5FD_realloc(f->shared->lf, type, dxpl_id, old_addr, old_size,
new_size);
if (HADDR_UNDEF==ret_value)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, HADDR_UNDEF, "unable to allocate new file memory");
/* Convert return value to relative address */
assert(ret_value>=f->shared->base_addr);
/* Set return value */
ret_value -= f->shared->base_addr;
done:
FUNC_LEAVE_NOAPI(ret_value);
}
示例4: H5HL_dblk_dest
/*-------------------------------------------------------------------------
* Function: H5HL_dblk_dest
*
* Purpose: Destroy a local heap data block object
*
* Return: Success: Non-negative
* Failure: Negative
*
* Programmer: Quincey Koziol
* [email protected]
* Oct 12 2008
*
*-------------------------------------------------------------------------
*/
herr_t
H5HL_dblk_dest(H5HL_dblk_t *dblk)
{
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5HL_dblk_dest, FAIL)
/* check arguments */
HDassert(dblk);
/* Check if data block was initialized */
if(dblk->heap) {
/* Unlink data block from heap */
dblk->heap->dblk = NULL;
/* Unpin the local heap prefix */
if(H5AC_unpin_entry(dblk->heap->prfx) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTUNPIN, FAIL, "can't unpin local heap prefix")
/* Decrement ref. count on heap data structure */
if(H5HL_dec_rc(dblk->heap) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTDEC, FAIL, "can't decrement heap ref. count")
/* Unlink heap from data block */
dblk->heap = NULL;
} /* end if */
示例5: H5D__layout_set_version
/*-------------------------------------------------------------------------
* Function: H5D__layout_set_version
*
* Purpose: Set the version to encode a layout with.
*
* Return: Non-negative on success/Negative on failure
*
* Programmer: Vailin Choi; December 2017
*
*-------------------------------------------------------------------------
*/
herr_t
H5D__layout_set_version(H5F_t *f, H5O_layout_t *layout)
{
unsigned version; /* Message version */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Sanity check */
HDassert(layout);
HDassert(f);
/* Upgrade to the version indicated by the file's low bound if higher */
version = MAX(layout->version, H5O_layout_ver_bounds[H5F_LOW_BOUND(f)]);
/* Version bounds check */
if(version > H5O_layout_ver_bounds[H5F_HIGH_BOUND(f)])
HGOTO_ERROR(H5E_DATASET, H5E_BADRANGE, FAIL, "layout version out of bounds")
/* Set the message version */
layout->version = version;
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__layout_set_version() */
示例6: H5HP_incr
/*--------------------------------------------------------------------------
NAME
H5HP_incr
PURPOSE
Increment the priority of an object on a heap
USAGE
herr_t H5HP_incr(heap, amt, obj)
H5HP_t *heap; IN/OUT: Pointer to heap to modify
unsigned amt; IN: Amount to increase priority by
void *obj; IN: Pointer to object to modify
RETURNS
Returns non-negative on success, negative on failure.
DESCRIPTION
Increments the priority of an object on a heap by one.
GLOBAL VARIABLES
COMMENTS, BUGS, ASSUMPTIONS
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
herr_t
H5HP_incr(H5HP_t *heap, unsigned amt, void *_obj)
{
H5HP_info_t *obj=(H5HP_info_t *)_obj; /* Alias for object */
size_t obj_loc; /* Location of object in heap */
herr_t ret_value=SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Check args */
HDassert(heap);
HDassert(obj);
/* Check internal consistency */
/* (Pre-condition) */
HDassert(heap->nobjs<heap->nalloc);
HDassert(heap->heap);
HDassert((heap->type==H5HP_MAX_HEAP && heap->heap[0].val==INT_MAX) ||
(heap->type==H5HP_MIN_HEAP && heap->heap[0].val==INT_MIN));
HDassert(heap->heap[0].obj==NULL);
/* Get the location of the object in the heap */
obj_loc = obj->heap_loc;
HDassert(obj_loc > 0 && obj_loc <= heap->nobjs);
/* Change the heap object's priority */
heap->heap[obj_loc].val += (int)amt;
/* Restore heap condition */
if(H5HP_MAX_HEAP == heap->type) {
if(H5HP_swim_max(heap, obj_loc) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTRESTORE, FAIL, "unable to restore heap condition")
} /* end if */
else {
if(H5HP_sink_min(heap, obj_loc) < 0)
示例7: H5I_destroy_group
/*-------------------------------------------------------------------------
* Function: H5I_destroy_group
*
* Purpose: Decrements the reference count on an entire group of IDs.
* If the group reference count becomes zero then the group is
* destroyed along with all atoms in that group regardless of
* their reference counts. Destroying IDs involves calling
* the free-func for each ID's object and then adding the ID
* struct to the ID free list.
*
* Return: Non-negative on success/Negative on failure
*
* Programmer: Unknown
*
* Modifications:
*
* Robb Matzke, 25 Feb 1998
* IDs are freed when a group is destroyed.
*
*-------------------------------------------------------------------------
*/
herr_t
H5I_destroy_group(H5I_type_t grp)
{
H5I_id_group_t *grp_ptr = NULL; /* ptr to the atomic group */
int ret_value = SUCCEED;
FUNC_ENTER_NOAPI(H5I_destroy_group, FAIL);
if (grp <= H5I_BADID || grp >= H5I_NGROUPS)
HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid group number");
grp_ptr = H5I_id_group_list_g[grp];
if (grp_ptr == NULL || grp_ptr->count <= 0)
HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, FAIL, "invalid group");
/*
* Decrement the number of users of the atomic group. If this is the
* last user of the group then release all atoms from the group. The
* free function is invoked for each atom being freed.
*/
if (1==grp_ptr->count) {
H5I_clear_group(grp, TRUE);
H5E_clear(); /*don't care about errors*/
H5MM_xfree(grp_ptr->id_list);
HDmemset (grp_ptr, 0, sizeof(*grp_ptr));
} else {
--(grp_ptr->count);
}
done:
FUNC_LEAVE_NOAPI(ret_value);
}
示例8: H5G_link_to_loc
/*-------------------------------------------------------------------------
* Function: H5G_link_to_loc
*
* Purpose: Build group location from group and link object
*
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
* Monday, November 20 2006
*
*-------------------------------------------------------------------------
*/
herr_t
H5G_link_to_loc(const H5G_loc_t *grp_loc, const H5O_link_t *lnk,
H5G_loc_t *obj_loc)
{
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5G_link_to_loc, FAIL)
/* Sanity check */
HDassert(grp_loc);
HDassert(lnk);
HDassert(obj_loc);
/*
* Build location from the link
*/
/* Check for unknown library-internal link */
if(lnk->type > H5L_TYPE_BUILTIN_MAX && lnk->type < H5L_TYPE_UD_MIN)
HGOTO_ERROR(H5E_SYM, H5E_UNSUPPORTED, FAIL, "unknown link type")
/* Build object's group hier. location */
if(H5G_name_set(grp_loc->path, obj_loc->path, lnk->name) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "cannot set name")
/* Set the object location, if it's a hard link set the address also */
obj_loc->oloc->file = grp_loc->oloc->file;
obj_loc->oloc->holding_file = FALSE;
if(lnk->type == H5L_TYPE_HARD)
obj_loc->oloc->addr = lnk->u.hard.addr;
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5G_link_to_loc() */
示例9: H5HP_insert
/*--------------------------------------------------------------------------
NAME
H5HP_insert
PURPOSE
Insert an object into a heap, with an initial value
USAGE
herr_t H5HP_insert(heap, val, obj)
H5HP_t *heap; IN/OUT: Pointer to heap to modify
int val; IN: Initial value for object in heap
void *obj; IN: Pointer to object to insert into heap
RETURNS
Returns non-negative on success, negative on failure.
DESCRIPTION
Inserts a OBJ into a HEAP, with an initial VALue.
GLOBAL VARIABLES
COMMENTS, BUGS, ASSUMPTIONS
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
herr_t
H5HP_insert(H5HP_t *heap, int val, void *obj)
{
herr_t ret_value=SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Check args */
HDassert(heap);
HDassert(obj);
/* Check internal consistency */
/* (Pre-condition) */
HDassert(heap->nobjs<heap->nalloc);
HDassert(heap->heap);
HDassert((heap->type==H5HP_MAX_HEAP && heap->heap[0].val==INT_MAX) ||
(heap->type==H5HP_MIN_HEAP && heap->heap[0].val==INT_MIN));
HDassert(heap->heap[0].obj==NULL);
/* Increment number of objects in heap */
heap->nobjs++;
/* Check if we need to allocate more room for heap array */
if(heap->nobjs>=heap->nalloc) {
size_t n = MAX(H5HP_START_SIZE, 2*(heap->nalloc-1)) + 1;
H5HP_ent_t *new_heap = H5FL_SEQ_REALLOC(H5HP_ent_t,heap->heap, n);
if (!new_heap)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to extend heap array");
heap->heap = new_heap;
heap->nalloc = n;
} /* end if */
/* Insert new object at end of heap */
heap->heap[heap->nobjs].val = val;
heap->heap[heap->nobjs].obj = (H5HP_info_t *)obj;
heap->heap[heap->nobjs].obj->heap_loc = heap->nobjs;
/* Restore heap condition */
if(heap->type==H5HP_MAX_HEAP) {
if(H5HP_swim_max(heap,heap->nobjs)<0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTINSERT, FAIL, "unable to restore heap condition");
} /* end if */
else {
if(H5HP_swim_min(heap,heap->nobjs)<0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTINSERT, FAIL, "unable to restore heap condition");
} /* end else */
done:
/* Check internal consistency */
/* (Post-condition) */
HDassert(heap->nobjs<heap->nalloc);
HDassert(heap->heap);
HDassert((heap->type==H5HP_MAX_HEAP && heap->heap[0].val==INT_MAX) ||
(heap->type==H5HP_MIN_HEAP && heap->heap[0].val==INT_MIN));
HDassert(heap->heap[0].obj==NULL);
FUNC_LEAVE_NOAPI(ret_value);
} /* end H5HP_insert() */
示例10: H5HL_new
/*-------------------------------------------------------------------------
* Function: H5HL_new
*
* Purpose: Create a new local heap object
*
* Return: Success: non-NULL pointer to new local heap
* Failure: NULL
*
* Programmer: Quincey Koziol
* [email protected]
* Jan 5 2010
*
*-------------------------------------------------------------------------
*/
H5HL_t *
H5HL_new(size_t sizeof_size, size_t sizeof_addr, size_t prfx_size)
{
H5HL_t *heap = NULL; /* New local heap */
H5HL_t *ret_value; /* Return value */
FUNC_ENTER_NOAPI(H5HL_new, NULL)
/* check arguments */
HDassert(sizeof_size > 0);
HDassert(sizeof_addr > 0);
HDassert(prfx_size > 0);
/* Allocate new local heap structure */
if(NULL == (heap = H5FL_CALLOC(H5HL_t)))
HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, NULL, "memory allocation failed")
/* Initialize non-zero fields */
heap->sizeof_size = sizeof_size;
heap->sizeof_addr = sizeof_addr;
heap->prfx_size = prfx_size;
/* Set the return value */
ret_value = heap;
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5HL_new() */
示例11: H5C_log_set_up
/*-------------------------------------------------------------------------
* Function: H5C_log_set_up
*
* Purpose: Setup for metadata cache logging.
*
* Return: SUCCEED/FAIL
*
* Programmer: Dana Robinson
* Fall 2018
*
*-------------------------------------------------------------------------
*/
herr_t
H5C_log_set_up(H5C_t *cache, const char log_location[], H5C_log_style_t style, hbool_t start_immediately)
{
int mpi_rank = -1; /* -1 indicates serial (no MPI rank) */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Sanity checks */
HDassert(cache);
HDassert(log_location);
/* Check logging flags */
if(cache->log_info->enabled)
HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "logging already set up")
/* Get the rank when MPI is in use. Logging clients will usually
* use that to create per-process logs.
*/
#ifdef H5_HAVE_PARALLEL
if(NULL != cache->aux_ptr)
mpi_rank = ((H5AC_aux_t *)(cache->aux_ptr))->mpi_rank;
#endif /*H5_HAVE_PARALLEL*/
/* Set up logging */
if(H5C_LOG_STYLE_JSON == style) {
if(H5C_log_json_set_up(cache->log_info, log_location, mpi_rank) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to set up json logging")
}
else if(H5C_LOG_STYLE_TRACE == style) {
示例12: H5B2_size
/*-------------------------------------------------------------------------
* Function: H5B2_size
*
* Purpose: Iterate over all the records in the B-tree, collecting
* storage info.
*
* Return: non-negative on success, negative on error
*
* Programmer: Vailin Choi
* June 19 2007
*
*-------------------------------------------------------------------------
*/
herr_t
H5B2_size(H5B2_t *bt2, hid_t dxpl_id, hsize_t *btree_size)
{
H5B2_hdr_t *hdr; /* Pointer to the B-tree header */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Check arguments. */
HDassert(bt2);
HDassert(btree_size);
/* Set the shared v2 B-tree header's file context for this operation */
bt2->hdr->f = bt2->f;
/* Get the v2 B-tree header */
hdr = bt2->hdr;
/* Add size of header to B-tree metadata total */
*btree_size += hdr->hdr_size;
/* Iterate through records */
if(hdr->root.node_nrec > 0) {
/* Check for root node being a leaf */
if(hdr->depth == 0)
*btree_size += hdr->node_size;
else
/* Iterate through nodes */
if(H5B2_node_size(hdr, dxpl_id, hdr->depth, &hdr->root, btree_size) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTLIST, FAIL, "node iteration failed")
} /* end if */
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5B2_size() */
示例13: H5MF_aggr_vfd_alloc
/*-------------------------------------------------------------------------
* Function: H5MF_aggr_vfd_alloc
*
* Purpose: Allocate SIZE bytes of file memory via H5MF_aggr_alloc()
* and return the relative address where that contiguous chunk
* of file memory exists.
* The TYPE argument describes the purpose for which the storage
* is being requested.
*
* Return: Success: The file address of new chunk.
* Failure: HADDR_UNDEF
*
* Programmer: Vailin Choi; July 1st, 2009
* (The coding is from H5MF_alloc().)
*
*-------------------------------------------------------------------------
*/
haddr_t
H5MF_aggr_vfd_alloc(H5F_t *f, H5FD_mem_t alloc_type, hid_t dxpl_id, hsize_t size)
{
haddr_t ret_value; /* Return value */
FUNC_ENTER_NOAPI(HADDR_UNDEF)
#ifdef H5MF_ALLOC_DEBUG
HDfprintf(stderr, "%s: alloc_type = %u, size = %Hu\n", FUNC, (unsigned)alloc_type, size);
#endif /* H5MF_ALLOC_DEBUG */
/* check arguments */
HDassert(f);
HDassert(f->shared);
HDassert(f->shared->lf);
HDassert(size > 0);
/* Couldn't find anything from the free space manager, go allocate some */
if(alloc_type != H5FD_MEM_DRAW && alloc_type != H5FD_MEM_GHEAP) {
/* Handle metadata differently from "raw" data */
if(HADDR_UNDEF == (ret_value = H5MF_aggr_alloc(f, dxpl_id, &(f->shared->meta_aggr), &(f->shared->sdata_aggr), alloc_type, size)))
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, HADDR_UNDEF, "can't allocate metadata")
} /* end if */
else {
/* Allocate "raw" data: H5FD_MEM_DRAW and H5FD_MEM_GHEAP */
if(HADDR_UNDEF == (ret_value = H5MF_aggr_alloc(f, dxpl_id, &(f->shared->sdata_aggr), &(f->shared->meta_aggr), H5FD_MEM_DRAW, size)))
示例14: H5HL_prfx_dest
/*-------------------------------------------------------------------------
* Function: H5HL_prfx_dest
*
* Purpose: Destroy a local heap prefix object
*
* Return: Success: Non-negative
* Failure: Negative
*
* Programmer: Quincey Koziol
* [email protected]
* Oct 12 2008
*
*-------------------------------------------------------------------------
*/
herr_t
H5HL_prfx_dest(H5HL_prfx_t *prfx)
{
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5HL_prfx_dest, FAIL)
/* check arguments */
HDassert(prfx);
/* Check if prefix was initialized */
if(prfx->heap) {
/* Unlink prefix from heap */
prfx->heap->prfx = NULL;
/* Decrement ref. count on heap data structure */
if(H5HL_dec_rc(prfx->heap) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTDEC, FAIL, "can't decrement heap ref. count")
/* Unlink heap from prefix */
prfx->heap = NULL;
} /* end if */
/* Free local heap prefix */
prfx = H5FL_FREE(H5HL_prfx_t, prfx);
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5HL_prfx_dest() */
示例15: H5HL_dblk_new
/*-------------------------------------------------------------------------
* Function: H5HL_dblk_new
*
* Purpose: Create a new local heap data block object
*
* Return: Success: non-NULL pointer to new local heap data block
* Failure: NULL
*
* Programmer: Quincey Koziol
* [email protected]
* Oct 12 2008
*
*-------------------------------------------------------------------------
*/
H5HL_dblk_t *
H5HL_dblk_new(H5HL_t *heap)
{
H5HL_dblk_t *dblk = NULL; /* New local heap data block */
H5HL_dblk_t *ret_value; /* Return value */
FUNC_ENTER_NOAPI(H5HL_dblk_new, NULL)
/* check arguments */
HDassert(heap);
/* Allocate new local heap data block */
if(NULL == (dblk = H5FL_CALLOC(H5HL_dblk_t)))
HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, NULL, "memory allocation failed")
/* Increment ref. count on heap data structure */
if(H5HL_inc_rc(heap) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTINC, NULL, "can't increment heap ref. count")
/* Link the heap & the data block */
dblk->heap = heap;
heap->dblk = dblk;
/* Set the return value */
ret_value = dblk;
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5HL_dblk_new() */