diff options
author | Jacob Smith <jake.smith@hdfgroup.org> | 2020-04-07 15:22:21 (GMT) |
---|---|---|
committer | Jacob Smith <jake.smith@hdfgroup.org> | 2020-04-07 15:29:00 (GMT) |
commit | 075e74e9b2e2ad761af44237aa78acc6ff3c3c24 (patch) | |
tree | 8511d081cc709a57790b4e92eb75571352ef40d3 /src | |
parent | d97c00013dd5b13b618d08d9b6d6517176674a4e (diff) | |
parent | b27a20f8c0e286ea7c2836605632ea2ee5522d03 (diff) | |
download | hdf5-075e74e9b2e2ad761af44237aa78acc6ff3c3c24.zip hdf5-075e74e9b2e2ad761af44237aa78acc6ff3c3c24.tar.gz hdf5-075e74e9b2e2ad761af44237aa78acc6ff3c3c24.tar.bz2 |
Merge branch 'develop' of https://bitbucket.hdfgroup.org/scm/~jake.smith/hdf5 into feature/vfd_splitter_mirror_a
Diffstat (limited to 'src')
-rw-r--r-- | src/CMakeLists.txt | 2 | ||||
-rw-r--r-- | src/H5.c | 85 | ||||
-rw-r--r-- | src/H5Dint.c | 19 | ||||
-rw-r--r-- | src/H5FL.c | 484 | ||||
-rw-r--r-- | src/H5FLprivate.h | 16 | ||||
-rw-r--r-- | src/H5MM.c | 49 | ||||
-rw-r--r-- | src/H5MMprivate.h | 1 | ||||
-rw-r--r-- | src/H5Rint.c | 8 | ||||
-rw-r--r-- | src/H5Sall.c | 3 | ||||
-rw-r--r-- | src/H5Snone.c | 3 | ||||
-rw-r--r-- | src/H5Spkg.h | 11 | ||||
-rw-r--r-- | src/H5Spoint.c | 3 | ||||
-rw-r--r-- | src/H5TS.c | 116 | ||||
-rw-r--r-- | src/H5Tconv.c | 2 | ||||
-rw-r--r-- | src/H5VL.c | 2 | ||||
-rw-r--r-- | src/H5VLconnector.h | 2 | ||||
-rw-r--r-- | src/H5VLint.c | 2 | ||||
-rw-r--r-- | src/H5VLpassthru.c | 12 | ||||
-rw-r--r-- | src/H5public.h | 16 | ||||
-rw-r--r-- | src/H5trace.c | 214 | ||||
-rw-r--r-- | src/libhdf5.settings.in | 2 |
21 files changed, 682 insertions, 370 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 6678aaf..c0915c8 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1141,6 +1141,7 @@ if (NOT ONLY_SHARED_LIBS) PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>" INTERFACE "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>" ) + target_compile_options(${HDF5_LIB_TARGET} PRIVATE "${HDF5_CMAKE_C_FLAGS}") target_compile_definitions(${HDF5_LIB_TARGET} PUBLIC ${HDF_EXTRA_C_FLAGS} @@ -1177,6 +1178,7 @@ if (BUILD_SHARED_LIBS) PUBLIC "$<$<BOOL:${HDF5_ENABLE_HDFS}>:${HDFS_INCLUDE_DIR}>" INTERFACE "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>" ) + target_compile_options(${HDF5_LIBSH_TARGET} PRIVATE "${HDF5_CMAKE_C_FLAGS}") target_compile_definitions(${HDF5_LIBSH_TARGET} PUBLIC "H5_BUILT_AS_DYNAMIC_LIB" @@ -355,7 +355,9 @@ H5_term_library(void) pending += DOWN(Z); pending += DOWN(FD); pending += DOWN(VL); - pending += DOWN(PL); + /* Don't shut down the plugin code until all "pluggable" interfaces (Z, FD, PL) are shut down */ + if(pending == 0) + pending += DOWN(PL); /* Don't shut down the error code until other APIs which use it are shut down */ if(pending == 0) pending += DOWN(E); @@ -556,6 +558,87 @@ done: /*------------------------------------------------------------------------- + * Function: H5get_free_list_sizes + * + * Purpose: Gets the current size of the different kinds of free lists that + * the library uses to manage memory. The free list sizes can be set with + * H5set_free_list_limits and garbage collected with H5garbage_collect. + * These lists are global for the entire library. + * + * Parameters: + * size_t *reg_size; OUT: The current size of all "regular" free list memory used + * size_t *arr_size; OUT: The current size of all "array" free list memory used + * size_t *blk_size; OUT: The current size of all "block" free list memory used + * size_t *fac_size; OUT: The current size of all "factory" free list memory used + * + * Return: Success: non-negative + * Failure: negative + * + * Programmer: Quincey Koziol + * Friday, March 6, 2020 + * + *------------------------------------------------------------------------- + */ +herr_t +H5get_free_list_sizes(size_t *reg_size, size_t *arr_size, size_t *blk_size, + size_t *fac_size) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE4("e", "*z*z*z*z", reg_size, arr_size, blk_size, fac_size); + + /* Call the free list function to actually get the sizes */ + if(H5FL_get_free_list_sizes(reg_size, arr_size, blk_size, fac_size) < 0) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "can't get garbage collection sizes") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5get_free_list_sizes() */ + + +/*------------------------------------------------------------------------- + * Function: H5get_alloc_stats + * + * Purpose: Gets the memory allocation statistics for the library, if the + * --enable-memory-alloc-sanity-check option was given when building the + * library. Applications can check whether this option was enabled by + * detecting if the 'H5_MEMORY_ALLOC_SANITY_CHECK' macro is defined. This + * option is enabled by default for debug builds of the library and + * disabled by default for non-debug builds. If the option is not enabled, + * all the values returned with be 0. These statistics are global for the + * entire library, but don't include allocations from chunked dataset I/O + * filters or non-native VOL connectors. + * + * Parameters: + * H5_alloc_stats_t *stats; OUT: Memory allocation statistics + * + * Return: Success: non-negative + * Failure: negative + * + * Programmer: Quincey Koziol + * Saturday, March 7, 2020 + * + *------------------------------------------------------------------------- + */ +herr_t +H5get_alloc_stats(H5_alloc_stats_t *stats) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE1("e", "*x", stats); + + /* Call the internal allocation stat routine to get the values */ + if(H5MM_get_alloc_stats(stats) < 0) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "can't get allocation stats") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5get_alloc_stats() */ + + +/*------------------------------------------------------------------------- * Function: H5_debug_mask * * Purpose: Set runtime debugging flags according to the string S. The diff --git a/src/H5Dint.c b/src/H5Dint.c index 1624f7b..954b619 100644 --- a/src/H5Dint.c +++ b/src/H5Dint.c @@ -207,6 +207,9 @@ H5D__init_package(void) /* Reset the "default dataset" information */ HDmemset(&H5D_def_dset, 0, sizeof(H5D_shared_t)); + H5D_def_dset.type_id = H5I_INVALID_HID; + H5D_def_dset.dapl_id = H5I_INVALID_HID; + H5D_def_dset.dcpl_id = H5I_INVALID_HID; /* Get the default dataset creation property list values and initialize the * default dataset with them. @@ -1418,8 +1421,18 @@ done: HDONE_ERROR(H5E_DATASET, H5E_CANTRESET, NULL, "unable to reset external file list info") if(new_dset->shared->space && H5S_close(new_dset->shared->space) < 0) HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, NULL, "unable to release dataspace") - if(new_dset->shared->type && H5I_dec_ref(new_dset->shared->type_id) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, NULL, "unable to release datatype") + + if(new_dset->shared->type) { + if(new_dset->shared->type_id > 0) { + if(H5I_dec_ref(new_dset->shared->type_id) < 0) + HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release datatype") + } /* end if */ + else { + if(H5T_close_real(new_dset->shared->type) < 0) + HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release datatype") + } /* end else */ + } /* end if */ + if(H5F_addr_defined(new_dset->oloc.addr)) { if(H5O_dec_rc_by_loc(&(new_dset->oloc)) < 0) HDONE_ERROR(H5E_DATASET, H5E_CANTDEC, NULL, "unable to decrement refcount on newly created object") @@ -2550,7 +2563,7 @@ done: /*------------------------------------------------------------------------- * Function: H5D__get_offset * - * Purpose: Private function for H5D__get_offset. Returns the address + * Purpose: Private function for H5Dget_offset(). Returns the address * of dataset in file. * * Return: Success: The address of dataset @@ -130,17 +130,23 @@ static H5FL_track_t *H5FL_out_head_g = NULL; #endif /* H5FL_TRACK */ /* Forward declarations of local static functions */ +static void * H5FL__malloc(size_t mem_size); +static herr_t H5FL__reg_init(H5FL_reg_head_t *head); static herr_t H5FL__reg_gc(void); static herr_t H5FL__reg_gc_list(H5FL_reg_head_t *head); static int H5FL__reg_term(void); -static herr_t H5FL__arr_gc(void); -static herr_t H5FL__arr_gc_list(H5FL_arr_head_t *head); -static int H5FL__arr_term(void); -static herr_t H5FL__blk_gc(void); +static H5FL_blk_node_t *H5FL__blk_find_list(H5FL_blk_node_t **head, size_t size); +static H5FL_blk_node_t *H5FL__blk_create_list(H5FL_blk_node_t **head, size_t size); +static herr_t H5FL__blk_init(H5FL_blk_head_t *head); static herr_t H5FL__blk_gc_list(H5FL_blk_head_t *head); +static herr_t H5FL__blk_gc(void); static int H5FL__blk_term(void); -static herr_t H5FL__fac_gc(void); +static herr_t H5FL__arr_init(H5FL_arr_head_t *head); +static herr_t H5FL__arr_gc_list(H5FL_arr_head_t *head); +static herr_t H5FL__arr_gc(void); +static int H5FL__arr_term(void); static herr_t H5FL__fac_gc_list(H5FL_fac_head_t *head); +static herr_t H5FL__fac_gc(void); static int H5FL__fac_term_all(void); /* Declare a free list to manage the H5FL_blk_node_t struct */ @@ -217,7 +223,7 @@ H5FL_term_package(void) /*------------------------------------------------------------------------- - * Function: H5FL_malloc + * Function: H5FL__malloc * * Purpose: Attempt to allocate space using malloc. If malloc fails, garbage * collect and try again. If malloc fails again, then return NULL. @@ -228,16 +234,14 @@ H5FL_term_package(void) * Programmer: Quincey Koziol * Tuesday, August 1, 2000 * - * Modifications: - * *------------------------------------------------------------------------- */ static void * -H5FL_malloc(size_t mem_size) +H5FL__malloc(size_t mem_size) { void *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Attempt to allocate the memory requested */ if(NULL==(ret_value=H5MM_malloc(mem_size))) { @@ -252,11 +256,11 @@ H5FL_malloc(size_t mem_size) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FL_malloc() */ +} /* end H5FL__malloc() */ /*------------------------------------------------------------------------- - * Function: H5FL_reg_init + * Function: H5FL__reg_init * * Purpose: Initialize a free list for a certain type. Right now, this just * adds the free list to the list of things to garbage collect. @@ -267,17 +271,15 @@ done: * Programmer: Quincey Koziol * Friday, March 24, 2000 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t -H5FL_reg_init(H5FL_reg_head_t *head) +H5FL__reg_init(H5FL_reg_head_t *head) { H5FL_reg_gc_node_t *new_node; /* Pointer to the node for the new list to garbage collect */ herr_t ret_value=SUCCEED; /* return value*/ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Allocate a new garbage collection node */ if(NULL == (new_node = (H5FL_reg_gc_node_t *)H5MM_malloc(sizeof(H5FL_reg_gc_node_t)))) @@ -304,7 +306,7 @@ H5FL_reg_init(H5FL_reg_head_t *head) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FL_reg_init() */ +} /* end H5FL__reg_init() */ /*------------------------------------------------------------------------- @@ -317,8 +319,6 @@ done: * Programmer: Quincey Koziol * Friday, March 24, 2000 * - * Modifications: - * *------------------------------------------------------------------------- */ void * @@ -403,8 +403,6 @@ done: * Programmer: Quincey Koziol * Friday, March 24, 2000 * - * Modifications: - * *------------------------------------------------------------------------- */ void * @@ -419,7 +417,7 @@ H5FL_reg_malloc(H5FL_reg_head_t *head H5FL_TRACK_PARAMS) /* Make certain the list is initialized first */ if(!head->init) - if(H5FL_reg_init(head)<0) + if(H5FL__reg_init(head) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, NULL, "can't initialize 'regular' blocks") /* Check for nodes available on the free list first */ @@ -438,7 +436,7 @@ H5FL_reg_malloc(H5FL_reg_head_t *head H5FL_TRACK_PARAMS) } /* end if */ /* Otherwise allocate a node */ else { - if (NULL==(ret_value = H5FL_malloc(head->size))) + if(NULL == (ret_value = H5FL__malloc(head->size))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") /* Increment the number of blocks allocated in list */ @@ -480,8 +478,6 @@ done: * Programmer: Quincey Koziol * Monday, December 23, 2002 * - * Modifications: - * *------------------------------------------------------------------------- */ void * @@ -524,35 +520,34 @@ static herr_t H5FL__reg_gc_list(H5FL_reg_head_t *head) { H5FL_reg_node_t *free_list; /* Pointer to nodes in free list being garbage collected */ - size_t total_mem; /* Total memory used on list */ FUNC_ENTER_STATIC_NOERR - /* Calculate the total memory used on this list */ - total_mem = head->onlist * head->size; - /* For each free list being garbage collected, walk through the nodes and free them */ free_list = head->list; while(free_list != NULL) { - void *tmp; /* Temporary node pointer */ + H5FL_reg_node_t *tmp; /* Temporary node pointer */ + /* Get the pointer to the next node */ tmp = free_list->next; - /* Decrement the count of nodes allocated and free the node */ - head->allocated--; - + /* Free the block */ H5MM_free(free_list); - free_list = (H5FL_reg_node_t *)tmp; + /* Advance to the next node */ + free_list = tmp; } /* end while */ + /* Decrement the count of nodes allocated and free the node */ + head->allocated -= head->onlist; + + /* Decrement global count of free memory on "regular" lists */ + H5FL_reg_gc_head.mem_freed -= (head->onlist * head->size); + /* Indicate no free nodes on the free list */ head->list = NULL; head->onlist = 0; - /* Decrement global count of free memory on "regular" lists */ - H5FL_reg_gc_head.mem_freed -= total_mem; - FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5FL__reg_gc_list() */ @@ -568,10 +563,6 @@ H5FL__reg_gc_list(H5FL_reg_head_t *head) * Programmer: Quincey Koziol * Friday, March 24, 2000 * - * Modifications: - * Broke into two parts, one for looping over all the free lists and - * another for freeing each list - QAK 7/25/00 - * *------------------------------------------------------------------------- */ static herr_t @@ -670,7 +661,7 @@ HDprintf("%s: head->name = %s, head->allocated = %d\n", FUNC, H5FL_reg_gc_head.f /*------------------------------------------------------------------------- - * Function: H5FL_blk_find_list + * Function: H5FL__blk_find_list * * Purpose: Finds the free list for blocks of a given size. Also moves that * free list node to the head of the priority queue (if it isn't there @@ -684,16 +675,14 @@ HDprintf("%s: head->name = %s, head->allocated = %d\n", FUNC, H5FL_reg_gc_head.f * Programmer: Quincey Koziol * Thursday, March 23, 2000 * - * Modifications: - * *------------------------------------------------------------------------- */ static H5FL_blk_node_t * -H5FL_blk_find_list(H5FL_blk_node_t **head, size_t size) +H5FL__blk_find_list(H5FL_blk_node_t **head, size_t size) { H5FL_blk_node_t *temp = NULL; /* Temp. pointer to node in the native list */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Find the correct free list */ temp=*head; @@ -729,11 +718,11 @@ H5FL_blk_find_list(H5FL_blk_node_t **head, size_t size) } /* end if */ FUNC_LEAVE_NOAPI(temp) -} /* end H5FL_blk_find_list() */ +} /* end H5FL__blk_find_list() */ /*------------------------------------------------------------------------- - * Function: H5FL_blk_create_list + * Function: H5FL__blk_create_list * * Purpose: Creates a new free list for blocks of the given size at the * head of the priority queue. @@ -745,47 +734,38 @@ H5FL_blk_find_list(H5FL_blk_node_t **head, size_t size) * Programmer: Quincey Koziol * Thursday, March 23, 2000 * - * Modifications: - * *------------------------------------------------------------------------- */ static H5FL_blk_node_t * -H5FL_blk_create_list(H5FL_blk_node_t **head, size_t size) +H5FL__blk_create_list(H5FL_blk_node_t **head, size_t size) { - H5FL_blk_node_t *temp; /* Temp. pointer to node in the list */ H5FL_blk_node_t *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Allocate room for the new free list node */ - if(NULL==(temp=H5FL_MALLOC(H5FL_blk_node_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for chunk info") + if(NULL == (ret_value = H5FL_CALLOC(H5FL_blk_node_t))) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, NULL, "memory allocation failed for chunk info") /* Set the correct values for the new free list */ - temp->size=size; - temp->list=NULL; + ret_value->size = size; /* Attach to head of priority queue */ - if(*head==NULL) { - *head=temp; - temp->next=temp->prev=NULL; - } /* end if */ + if(NULL == *head) + *head = ret_value; else { - temp->next=*head; - (*head)->prev=temp; - temp->prev=NULL; - *head=temp; + ret_value->next = *head; + (*head)->prev = ret_value; + *head = ret_value; } /* end else */ - ret_value=temp; - done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FL_blk_create_list() */ +} /* end H5FL__blk_create_list() */ /*------------------------------------------------------------------------- - * Function: H5FL_blk_init + * Function: H5FL__blk_init * * Purpose: Initialize a priority queue of a certain type. Right now, this just * adds the PQ to the list of things to garbage collect. @@ -796,17 +776,15 @@ done: * Programmer: Quincey Koziol * Saturday, March 25, 2000 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t -H5FL_blk_init(H5FL_blk_head_t *head) +H5FL__blk_init(H5FL_blk_head_t *head) { H5FL_blk_gc_node_t *new_node; /* Pointer to the node for the new list to garbage collect */ herr_t ret_value=SUCCEED; /* return value*/ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Allocate a new garbage collection node */ if(NULL == (new_node = (H5FL_blk_gc_node_t *)H5MM_malloc(sizeof(H5FL_blk_gc_node_t)))) @@ -824,7 +802,7 @@ H5FL_blk_init(H5FL_blk_head_t *head) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FL_blk_init() */ +} /* end H5FL__blk_init() */ /*------------------------------------------------------------------------- @@ -839,8 +817,6 @@ done: * Programmer: Quincey Koziol * Monday, December 16, 2002 * - * Modifications: - * *------------------------------------------------------------------------- */ htri_t @@ -856,10 +832,11 @@ H5FL_blk_free_block_avail(H5FL_blk_head_t *head, size_t size) /* check if there is a free list for blocks of this size */ /* and if there are any blocks available on the list */ - if((free_list = H5FL_blk_find_list(&(head->head), size)) != NULL && free_list->list != NULL) + if((free_list = H5FL__blk_find_list(&(head->head), size)) != NULL && free_list->list != NULL) ret_value = TRUE; else ret_value = FALSE; + FUNC_LEAVE_NOAPI(ret_value) } /* end H5FL_blk_free_block_avail() */ @@ -878,8 +855,6 @@ H5FL_blk_free_block_avail(H5FL_blk_head_t *head, size_t size) * Programmer: Quincey Koziol * Thursday, March 23, 2000 * - * Modifications: - * *------------------------------------------------------------------------- */ void * @@ -897,31 +872,40 @@ H5FL_blk_malloc(H5FL_blk_head_t *head, size_t size H5FL_TRACK_PARAMS) /* Make certain the list is initialized first */ if(!head->init) - if(H5FL_blk_init(head)<0) + if(H5FL__blk_init(head) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, NULL, "can't initialize 'block' list") /* check if there is a free list for blocks of this size */ /* and if there are any blocks available on the list */ - if((free_list=H5FL_blk_find_list(&(head->head),size))!=NULL && free_list->list!=NULL) { + if(NULL != (free_list = H5FL__blk_find_list(&(head->head), size)) && NULL != free_list->list) { /* Remove the first node from the free list */ temp=free_list->list; free_list->list=free_list->list->next; /* Decrement the number of blocks & memory used on free list */ + free_list->onlist--; head->onlist--; head->list_mem-=size; /* Decrement the amount of global "block" free list memory in use */ H5FL_blk_gc_head.mem_freed-=size; - } /* end if */ /* No free list available, or there are no nodes on the list, allocate a new node to give to the user */ else { + /* Check if there was no free list for native blocks of this size */ + if(NULL == free_list) + /* Create a new list node and insert it to the queue */ + free_list = H5FL__blk_create_list(&(head->head), size); + HDassert(free_list); + /* Allocate new node, with room for the page info header and the actual page data */ - if(NULL == (temp = (H5FL_blk_list_t *)H5FL_malloc(sizeof(H5FL_blk_list_t) + H5FL_TRACK_SIZE + size))) + if(NULL == (temp = (H5FL_blk_list_t *)H5FL__malloc(sizeof(H5FL_blk_list_t) + H5FL_TRACK_SIZE + size))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for chunk") - /* Increment the number of blocks allocated */ + /* Increment the number of blocks of this size */ + free_list->allocated++; + + /* Increment the total number of blocks allocated */ head->allocated++; } /* end else */ @@ -970,8 +954,6 @@ done: * Programmer: Quincey Koziol * Monday, December 23, 2002 * - * Modifications: - * *------------------------------------------------------------------------- */ void * @@ -1011,8 +993,6 @@ done: * Programmer: Quincey Koziol * Thursday, March 23, 2000 * - * Modifications: - * *------------------------------------------------------------------------- */ void * @@ -1055,7 +1035,7 @@ H5FL_blk_free(H5FL_blk_head_t *head, void *block) #endif /* H5FL_TRACK */ /* Get the pointer to the native block info header in front of the native block to free */ - temp = (H5FL_blk_list_t *)((void *)((unsigned char *)block - sizeof(H5FL_blk_list_t))); /*lint !e826 Pointer-to-pointer cast is appropriate here */ + temp = (H5FL_blk_list_t *)((void *)((unsigned char *)block - (sizeof(H5FL_blk_list_t) + H5FL_TRACK_SIZE))); /*lint !e826 Pointer-to-pointer cast is appropriate here */ /* Save the block's size for later */ free_size=temp->size; @@ -1064,20 +1044,18 @@ H5FL_blk_free(H5FL_blk_head_t *head, void *block) HDmemset(temp,255,free_size + sizeof(H5FL_blk_list_t) + H5FL_TRACK_SIZE); #endif /* H5FL_DEBUG */ - /* check if there is a free list for native blocks of this size */ - if((free_list=H5FL_blk_find_list(&(head->head),free_size))==NULL) { + /* Check if there is a free list for native blocks of this size */ + if(NULL == (free_list = H5FL__blk_find_list(&(head->head), free_size))) /* No free list available, create a new list node and insert it to the queue */ - free_list=H5FL_blk_create_list(&(head->head),free_size); - HDassert(free_list); - } /* end if */ + free_list = H5FL__blk_create_list(&(head->head), free_size); + HDassert(free_list); /* Prepend the free'd native block to the front of the free list */ - if(free_list!=NULL) { - temp->next=free_list->list; /* Overwrites the size field in union */ - free_list->list=temp; - } /* end if */ + temp->next = free_list->list; /* Note: Overwrites the size field in union */ + free_list->list = temp; /* Increment the number of blocks on free list */ + free_list->onlist++; head->onlist++; head->list_mem += free_size; @@ -1113,8 +1091,6 @@ done: * Programmer: Quincey Koziol * Thursday, March 23, 2000 * - * Modifications: - * *------------------------------------------------------------------------- */ void * @@ -1191,44 +1167,70 @@ done: static herr_t H5FL__blk_gc_list(H5FL_blk_head_t *head) { + H5FL_blk_node_t *blk_head; /* Temp. ptr to the free list page node */ + FUNC_ENTER_STATIC_NOERR /* Loop through all the nodes in the block free list queue */ - while(head->head != NULL) { - H5FL_blk_list_t *list; /* The free list of native nodes of a particular size */ - void *temp; /* Temp. ptr to the free list page node */ + blk_head = head->head; + while(blk_head != NULL) { + H5FL_blk_node_t *blk_next; /* Temp. ptr to the next free list node */ + H5FL_blk_list_t *list; /* The free list of native nodes of a particular size */ - temp = head->head->next; + /* Sanity check */ + HDassert((blk_head->onlist && blk_head->list) || (0 == blk_head->onlist && NULL == blk_head->list)); /* Loop through all the blocks in the free list, freeing them */ - list = head->head->list; + list = blk_head->list; while(list != NULL) { - void *next; /* Temp. ptr to the free list list node */ + H5FL_blk_list_t *next; /* Temp. ptr to the free list list node */ + /* Get the pointer to the next node */ next = list->next; - /* Decrement the number of blocks & memory allocated from this PQ */ - head->allocated--; - head->list_mem -= head->head->size; - - /* Decrement global count of free memory on "block" lists */ - H5FL_blk_gc_head.mem_freed -= head->head->size; - /* Free the block */ H5MM_free(list); - list = (H5FL_blk_list_t *)next; + /* Advance to the next node */ + list = next; } /* end while */ - /* Free the free list node */ - head->head = H5FL_FREE(H5FL_blk_node_t, head->head); + /* Decrement the number of blocks allocated from this list */ + blk_head->allocated -= blk_head->onlist; + head->allocated -= blk_head->onlist; + + /* Decrement count of free memory on this "block" list */ + head->list_mem -= (blk_head->onlist * blk_head->size); + + /* Decrement global count of free memory on "block" lists */ + H5FL_blk_gc_head.mem_freed -= (blk_head->onlist * blk_head->size); + + /* Indicate no free nodes on the free list */ + blk_head->list = NULL; + blk_head->onlist = 0; - /* Advance to the next free list */ - head->head = (H5FL_blk_node_t *)temp; + /* Get pointer to next node */ + blk_next = blk_head->next; + + /* Check for list completely unused now */ + if(0 == blk_head->allocated) { + /* Patch this node out of the PQ */ + if(head->head == blk_head) + head->head = blk_head->next; + if(blk_head->prev) + blk_head->prev->next = blk_head->next; + if(blk_head->next) + blk_head->next->prev = blk_head->prev; + + /* Free the free list node */ + H5FL_FREE(H5FL_blk_node_t, blk_head); + } /* end if */ + + /* Advance to the next node */ + blk_head = blk_next; } /* end while */ /* Indicate no free nodes on the free list */ - head->head = NULL; head->onlist = 0; /* Double check that all the memory on this list is recycled */ @@ -1257,7 +1259,7 @@ H5FL__blk_gc(void) H5FL_blk_gc_node_t *gc_node; /* Pointer into the list of things to garbage collect */ herr_t ret_value = SUCCEED; /* return value*/ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Walk through all the free lists, free()'ing the nodes */ gc_node = H5FL_blk_gc_head.first; @@ -1341,7 +1343,7 @@ HDprintf("%s: head->name = %s, head->allocated = %d\n", FUNC, H5FL_blk_gc_head.f /*------------------------------------------------------------------------- - * Function: H5FL_arr_init + * Function: H5FL__arr_init * * Purpose: Initialize a free list for a arrays of certain type. Right now, * this just adds the free list to the list of things to garbage collect. @@ -1352,18 +1354,16 @@ HDprintf("%s: head->name = %s, head->allocated = %d\n", FUNC, H5FL_blk_gc_head.f * Programmer: Quincey Koziol * Saturday, March 25, 2000 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t -H5FL_arr_init(H5FL_arr_head_t *head) +H5FL__arr_init(H5FL_arr_head_t *head) { H5FL_gc_arr_node_t *new_node; /* Pointer to the node for the new list to garbage collect */ size_t u; /* Local index variable */ herr_t ret_value=SUCCEED; /* return value*/ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Allocate a new garbage collection node */ if(NULL == (new_node = (H5FL_gc_arr_node_t *)H5MM_malloc(sizeof(H5FL_gc_arr_node_t)))) @@ -1389,7 +1389,7 @@ H5FL_arr_init(H5FL_arr_head_t *head) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FL_arr_init() */ +} /* end H5FL__arr_init() */ /*------------------------------------------------------------------------- @@ -1403,8 +1403,6 @@ done: * Programmer: Quincey Koziol * Friday, March 24, 2000 * - * Modifications: - * *------------------------------------------------------------------------- */ void * @@ -1481,8 +1479,6 @@ done: * Programmer: Quincey Koziol * Saturday, March 25, 2000 * - * Modifications: - * *------------------------------------------------------------------------- */ void * @@ -1500,7 +1496,7 @@ H5FL_arr_malloc(H5FL_arr_head_t *head, size_t elem) /* Make certain the list is initialized first */ if(!head->init) - if(H5FL_arr_init(head)<0) + if(H5FL__arr_init(head) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, NULL, "can't initialize 'array' blocks") /* Sanity check that the number of elements is supported */ @@ -1527,10 +1523,13 @@ H5FL_arr_malloc(H5FL_arr_head_t *head, size_t elem) } /* end if */ /* Otherwise allocate a node */ else { - if(NULL == (new_obj = (H5FL_arr_list_t *)H5FL_malloc(sizeof(H5FL_arr_list_t)+mem_size))) + if(NULL == (new_obj = (H5FL_arr_list_t *)H5FL__malloc(sizeof(H5FL_arr_list_t)+mem_size))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") - /* Increment the number of blocks allocated in list */ + /* Increment the number of blocks of this size */ + head->list_arr[elem].allocated++; + + /* Increment the number of blocks allocated in list, of all sizes */ head->allocated++; } /* end else */ @@ -1556,8 +1555,6 @@ done: * Programmer: Quincey Koziol * Monday, December 23, 2002 * - * Modifications: - * *------------------------------------------------------------------------- */ void * @@ -1594,8 +1591,6 @@ done: * Programmer: Quincey Koziol * Saturday, March 25, 2000 * - * Modifications: - * *------------------------------------------------------------------------- */ void * @@ -1667,34 +1662,35 @@ H5FL__arr_gc_list(H5FL_arr_head_t *head) for(u = 0; u < (unsigned)head->maxelem; u++) { if(head->list_arr[u].onlist > 0) { H5FL_arr_list_t *arr_free_list; /* Pointer to nodes in free list being garbage collected */ - size_t total_mem; /* Total memory used on list */ - - /* Calculate the total memory used on this list */ - total_mem = head->list_arr[u].onlist * head->list_arr[u].size; /* For each free list being garbage collected, walk through the nodes and free them */ arr_free_list = head->list_arr[u].list; while(arr_free_list != NULL) { - void *tmp; /* Temporary node pointer */ + H5FL_arr_list_t *tmp; /* Temporary node pointer */ + /* Get the pointer to the next node */ tmp = arr_free_list->next; - /* Decrement the count of nodes allocated and free the node */ - head->allocated--; + /* Free the node */ H5MM_free(arr_free_list); - arr_free_list = (H5FL_arr_list_t *)tmp; + /* Advance to the next node */ + arr_free_list = tmp; } /* end while */ - /* Indicate no free nodes on the free list */ - head->list_arr[u].list = NULL; - head->list_arr[u].onlist = 0; + /* Decrement the count of nodes allocated */ + head->list_arr[u].allocated -= head->list_arr[u].onlist; + head->allocated -= head->list_arr[u].onlist; /* Decrement count of free memory on this "array" list */ - head->list_mem -= total_mem; + head->list_mem -= (head->list_arr[u].onlist * head->list_arr[u].size); /* Decrement global count of free memory on "array" lists */ - H5FL_arr_gc_head.mem_freed -= total_mem; + H5FL_arr_gc_head.mem_freed -= (head->list_arr[u].onlist * head->list_arr[u].size); + + /* Indicate no free nodes on the free list */ + head->list_arr[u].list = NULL; + head->list_arr[u].onlist = 0; } /* end if */ } /* end for */ @@ -1820,8 +1816,6 @@ HDprintf("%s: head->name = %s, head->allocated = %d\n", FUNC, H5FL_arr_gc_head.f * Programmer: Quincey Koziol * Saturday, April 3, 2004 * - * Modifications: - * *------------------------------------------------------------------------- */ void * @@ -1856,8 +1850,6 @@ H5FL_seq_free(H5FL_seq_head_t *head, void *obj) * Programmer: Quincey Koziol * Saturday, April 3, 2004 * - * Modifications: - * *------------------------------------------------------------------------- */ void * @@ -1889,8 +1881,6 @@ H5FL_seq_malloc(H5FL_seq_head_t *head, size_t elem H5FL_TRACK_PARAMS) * Programmer: Quincey Koziol * Saturday, April 3, 2004 * - * Modifications: - * *------------------------------------------------------------------------- */ void * @@ -1922,8 +1912,6 @@ H5FL_seq_calloc(H5FL_seq_head_t *head, size_t elem H5FL_TRACK_PARAMS) * Programmer: Quincey Koziol * Saturday, April 3, 2004 * - * Modifications: - * *------------------------------------------------------------------------- */ void * @@ -1955,11 +1943,6 @@ H5FL_seq_realloc(H5FL_seq_head_t *head, void * obj, size_t new_elem H5FL_TRACK_P * Programmer: Quincey Koziol * Wednesday, February 2, 2005 * - * Modifications: - * Neil Fortner - * Friday, December 19, 2008 - * Totally rewritten to support new factory implementation - * *------------------------------------------------------------------------- */ H5FL_fac_head_t * @@ -2032,11 +2015,6 @@ done: * Programmer: Quincey Koziol * Wednesday, February 2, 2005 * - * Modifications: - * Neil Fortner - * Friday, December 19, 2008 - * Totally rewritten to support new factory implementation - * *------------------------------------------------------------------------- */ void * @@ -2120,11 +2098,6 @@ done: * Programmer: Quincey Koziol * Wednesday, February 2, 2005 * - * Modifications: - * Neil Fortner - * Friday, December 19, 2008 - * Totally rewritten to support new factory implementation - * *------------------------------------------------------------------------- */ void * @@ -2155,7 +2128,7 @@ H5FL_fac_malloc(H5FL_fac_head_t *head H5FL_TRACK_PARAMS) } /* end if */ /* Otherwise allocate a node */ else { - if (NULL==(ret_value = H5FL_malloc(head->size))) + if(NULL == (ret_value = H5FL__malloc(head->size))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") /* Increment the number of blocks allocated in list */ @@ -2197,11 +2170,6 @@ done: * Programmer: Quincey Koziol * Wednesday, February 2, 2005 * - * Modifications: - * Neil Fortner - * Friday, December 19, 2008 - * Totally rewritten to support new factory implementation - * *------------------------------------------------------------------------- */ void * @@ -2245,35 +2213,34 @@ static herr_t H5FL__fac_gc_list(H5FL_fac_head_t *head) { H5FL_fac_node_t *free_list; /* Pointer to nodes in free list being garbage collected */ - size_t total_mem; /* Total memory used on list */ FUNC_ENTER_STATIC_NOERR - /* Calculate the total memory used on this list */ - total_mem = head->onlist * head->size; - /* For each free list being garbage collected, walk through the nodes and free them */ free_list = head->list; while(free_list != NULL) { - void *tmp; /* Temporary node pointer */ + H5FL_fac_node_t *tmp; /* Temporary node pointer */ + /* Get the pointer to the next node */ tmp = free_list->next; - /* Decrement the count of nodes allocated and free the node */ - head->allocated--; - + /* Free the block */ H5MM_free(free_list); - free_list = (H5FL_fac_node_t *)tmp; + /* Advance to the next node */ + free_list = tmp; } /* end while */ + /* Decrement the count of nodes allocated and free the node */ + head->allocated -= head->onlist; + + /* Decrement global count of free memory on "factory" lists */ + H5FL_fac_gc_head.mem_freed -= (head->onlist * head->size); + /* Indicate no free nodes on the free list */ head->list = NULL; head->onlist = 0; - /* Decrement global count of free memory on "factory" lists */ - H5FL_fac_gc_head.mem_freed -= total_mem; - FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5FL__fac_gc_list() */ @@ -2329,11 +2296,6 @@ done: * Programmer: Quincey Koziol * Wednesday, February 2, 2005 * - * Modifications: - * Neil Fortner - * Friday, December 19, 2008 - * Totally rewritten to support new factory implementation - * *------------------------------------------------------------------------- */ herr_t @@ -2438,8 +2400,6 @@ HDprintf("%s: head->size = %d, head->allocated = %d\n", FUNC, (int)H5FL_fac_gc_h * Programmer: Quincey Koziol * Friday, March 24, 2000 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -2495,10 +2455,6 @@ done: * Programmer: Quincey Koziol * Wednesday, August 2, 2000 * - * Modifications: Neil Fortner - * Wednesday, April 8, 2009 - * Added support for factory free lists - * *------------------------------------------------------------------------- */ herr_t @@ -2531,3 +2487,127 @@ H5FL_set_free_list_limits(int reg_global_lim, int reg_list_lim, int arr_global_l FUNC_LEAVE_NOAPI(ret_value) } /* end H5FL_set_free_list_limits() */ + +/*------------------------------------------------------------------------- + * Function: H5FL_get_free_list_sizes + * + * Purpose: Gets the current size of the different kinds of free lists. + * These lists are global for the entire library. The size returned + * included nodes that are freed and awaiting garbage collection / + * reallocation. + * + * Parameters: + * size_t *reg_size; OUT: The current size of all "regular" free list memory used + * size_t *arr_size; OUT: The current size of all "array" free list memory used + * size_t *blk_size; OUT: The current size of all "block" free list memory used + * size_t *fac_size; OUT: The current size of all "factory" free list memory used + * + * Return: Success: non-negative + * Failure: negative + * + * Programmer: Quincey Koziol + * Friday, March 6, 2020 + * + *------------------------------------------------------------------------- + */ +herr_t +H5FL_get_free_list_sizes(size_t *reg_size, size_t *arr_size, size_t *blk_size, + size_t *fac_size) +{ + FUNC_ENTER_NOAPI_NOERR + + /* Retrieve the amount of "regular" memory used */ + if(reg_size) { + H5FL_reg_gc_node_t *gc_node; /* Pointer into the list of lists */ + + /* Walk through all the free lists, counting the amount of memory */ + *reg_size = 0; + gc_node = H5FL_reg_gc_head.first; + while(gc_node != NULL) { + H5FL_reg_head_t *reg_list = gc_node->list; /* Head of list */ + + /* Sanity check */ + HDassert(reg_list->init); + + /* Add the amount of memory for this list */ + *reg_size += (reg_list->size * reg_list->allocated); + + /* Go on to the next free list */ + gc_node = gc_node->next; + } /* end while */ + } /* end if */ + + /* Retrieve the amount of "array" memory used */ + if(arr_size) { + H5FL_gc_arr_node_t *gc_arr_node; /* Pointer into the list of things to garbage collect */ + + /* Walk through all the free lists, counting the amount of memory */ + *arr_size = 0; + gc_arr_node = H5FL_arr_gc_head.first; + while(gc_arr_node != NULL) { + H5FL_arr_head_t *head = gc_arr_node->list; /* Head of array list elements */ + + /* Sanity check */ + HDassert(head->init); + + /* Check for any allocated elements in this list */ + if(head->allocated > 0) { + unsigned u; + + /* Walk through the free lists for array sizes */ + for(u = 0; u < (unsigned)head->maxelem; u++) + /* Add the amount of memory for this size */ + *arr_size += head->list_arr[u].allocated * head->list_arr[u].size; + } /* end if */ + + /* Go on to the next free list */ + gc_arr_node = gc_arr_node->next; + } /* end while */ + } /* end if */ + + /* Retrieve the amount of "block" memory used */ + if(blk_size) { + H5FL_blk_gc_node_t *gc_blk_node; /* Pointer into the list of things */ + + /* Walk through all the free lists */ + gc_blk_node = H5FL_blk_gc_head.first; + *blk_size = 0; + while(gc_blk_node != NULL) { + H5FL_blk_node_t *blk_head; /* Temp. ptr to the free list block node */ + + /* Loop through all the nodes in the block free list queue */ + blk_head = gc_blk_node->pq->head; + while(blk_head != NULL) { + /* Add size of blocks on this list */ + *blk_size += (blk_head->allocated * blk_head->size); + + /* Get pointer to next node */ + blk_head = blk_head->next; + } /* end while */ + + /* Go on to the next free list */ + gc_blk_node = gc_blk_node->next; + } /* end while */ + } /* end if */ + + /* Retrieve the amount of "factory" memory used */ + if(fac_size) { + H5FL_fac_gc_node_t *gc_fac_node; /* Pointer into the list of things to garbage collect */ + + /* Walk through all the free lists */ + gc_fac_node = H5FL_fac_gc_head.first; + *fac_size = 0; + while(gc_fac_node != NULL) { + H5FL_fac_head_t *fac_head = gc_fac_node->list; /* Head node for factory list */ + + /* Add size of blocks on this list */ + *fac_size += (fac_head->allocated * fac_head->size); + + /* Go on to the next free list to garbage collect */ + gc_fac_node = gc_fac_node->next; + } /* end while */ + } /* end if */ + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5FL_get_free_list_sizes() */ + diff --git a/src/H5FLprivate.h b/src/H5FLprivate.h index d5a68d7..94a51e5 100644 --- a/src/H5FLprivate.h +++ b/src/H5FLprivate.h @@ -157,6 +157,8 @@ typedef union H5FL_blk_list_t { /* Data structure for priority queue node of block free lists */ typedef struct H5FL_blk_node_t { size_t size; /* Size of the blocks in the list */ + unsigned allocated; /* Number of blocks of this size allocated */ + unsigned onlist; /* Number of blocks on free list */ H5FL_blk_list_t *list; /* List of free blocks */ struct H5FL_blk_node_t *next; /* Pointer to next free list in queue */ struct H5FL_blk_node_t *prev; /* Pointer to previous free list in queue */ @@ -165,9 +167,9 @@ typedef struct H5FL_blk_node_t { /* Data structure for priority queue of native block free lists */ typedef struct H5FL_blk_head_t { hbool_t init; /* Whether the free list has been initialized */ - unsigned allocated; /* Number of blocks allocated */ - unsigned onlist; /* Number of blocks on free list */ - size_t list_mem; /* Amount of memory in block on free list */ + unsigned allocated; /* Total number of blocks allocated */ + unsigned onlist; /* Total number of blocks on free list */ + size_t list_mem; /* Total amount of memory in blocks on free list */ const char *name; /* Name of the type */ H5FL_blk_node_t *head; /* Pointer to first free list in queue */ } H5FL_blk_head_t; @@ -228,7 +230,9 @@ typedef union H5FL_arr_list_t { /* Data structure for each size of array element */ typedef struct H5FL_arr_node_t { - size_t size; /* Size of the blocks in the list */ + size_t size; /* Size of the blocks in the list (in bytes) */ + /* (Note: base_size + <# of elem> * elem_size) */ + unsigned allocated; /* Number of blocks allocated of this element size */ unsigned onlist; /* Number of blocks on free list */ H5FL_arr_list_t *list; /* List of free blocks */ } H5FL_arr_node_t; @@ -236,7 +240,7 @@ typedef struct H5FL_arr_node_t { /* Data structure for free list of array blocks */ typedef struct H5FL_arr_head_t { hbool_t init; /* Whether the free list has been initialized */ - unsigned allocated; /* Number of blocks allocated */ + unsigned allocated; /* Total number of blocks allocated */ size_t list_mem; /* Amount of memory in block on free list */ const char *name; /* Name of the type */ int maxelem; /* Maximum number of elements in an array */ @@ -423,6 +427,8 @@ H5_DLL herr_t H5FL_garbage_coll(void); H5_DLL herr_t H5FL_set_free_list_limits(int reg_global_lim, int reg_list_lim, int arr_global_lim, int arr_list_lim, int blk_global_lim, int blk_list_lim, int fac_global_lim, int fac_list_lim); +H5_DLL herr_t H5FL_get_free_list_sizes(size_t *reg_size, size_t *arr_size, + size_t *blk_size, size_t *fac_size); H5_DLL int H5FL_term_interface(void); #endif @@ -108,8 +108,8 @@ static H5MM_block_t H5MM_block_head_s; /* Statistics about block allocations */ static unsigned long long H5MM_total_alloc_bytes_s = 0; -static unsigned long long H5MM_curr_alloc_bytes_s = 0; -static unsigned long long H5MM_peak_alloc_bytes_s = 0; +static size_t H5MM_curr_alloc_bytes_s = 0; +static size_t H5MM_peak_alloc_bytes_s = 0; static size_t H5MM_max_block_size_s = 0; static size_t H5MM_total_alloc_blocks_count_s = 0; static size_t H5MM_curr_alloc_blocks_count_s = 0; @@ -235,7 +235,7 @@ H5MM_final_sanity_check(void) HDassert(H5MM_block_head_s.prev == &H5MM_block_head_s); #ifdef H5MM_PRINT_MEMORY_STATS HDfprintf(stderr, "%s: H5MM_total_alloc_bytes_s = %llu\n", __func__, H5MM_total_alloc_bytes_s); - HDfprintf(stderr, "%s: H5MM_peak_alloc_bytes_s = %llu\n", __func__, H5MM_peak_alloc_bytes_s); + HDfprintf(stderr, "%s: H5MM_peak_alloc_bytes_s = %zu\n", __func__, H5MM_peak_alloc_bytes_s); HDfprintf(stderr, "%s: H5MM_max_block_size_s = %zu\n", __func__, H5MM_max_block_size_s); HDfprintf(stderr, "%s: H5MM_total_alloc_blocks_count_s = %zu\n", __func__, H5MM_total_alloc_blocks_count_s); HDfprintf(stderr, "%s: H5MM_peak_alloc_blocks_count_s = %zu\n", __func__, H5MM_peak_alloc_blocks_count_s); @@ -625,3 +625,46 @@ H5MM_memcpy(void *dest, const void *src, size_t n) } /* end H5MM_memcpy() */ + +/*------------------------------------------------------------------------- + * Function: H5MM_get_alloc_stats + * + * Purpose: Gets the memory allocation statistics for the library, if the + * H5_MEMORY_ALLOC_SANITY_CHECK macro is defined. If the macro is not + * defined, zeros are returned. These statistics are global for the + * entire library. + * + * Parameters: + * H5_alloc_stats_t *stats; OUT: Memory allocation statistics + * + * Return: Success: non-negative + * Failure: negative + * + * Programmer: Quincey Koziol + * Saturday, March 7, 2020 + * + *------------------------------------------------------------------------- + */ +herr_t +H5MM_get_alloc_stats(H5_alloc_stats_t *stats) +{ + FUNC_ENTER_NOAPI_NOERR + +#if defined H5_MEMORY_ALLOC_SANITY_CHECK + if(stats) { + stats->total_alloc_bytes = H5MM_total_alloc_bytes_s; + stats->curr_alloc_bytes = H5MM_curr_alloc_bytes_s; + stats->peak_alloc_bytes = H5MM_peak_alloc_bytes_s; + stats->max_block_size = H5MM_max_block_size_s; + stats->total_alloc_blocks_count = H5MM_total_alloc_blocks_count_s; + stats->curr_alloc_blocks_count = H5MM_curr_alloc_blocks_count_s; + stats->peak_alloc_blocks_count = H5MM_peak_alloc_blocks_count_s; + } /* end if */ +#else /* H5_MEMORY_ALLOC_SANITY_CHECK */ + if(stats) + HDmemset(stats, 0, sizeof(H5_alloc_stats_t)); +#endif /* H5_MEMORY_ALLOC_SANITY_CHECK */ + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5MM_get_alloc_stats() */ + diff --git a/src/H5MMprivate.h b/src/H5MMprivate.h index 240b931..0787eb2 100644 --- a/src/H5MMprivate.h +++ b/src/H5MMprivate.h @@ -47,6 +47,7 @@ H5_DLL char *H5MM_strdup(const char *s); H5_DLL void *H5MM_xfree(void *mem); H5_DLL void *H5MM_xfree_const(const void *mem); H5_DLL void *H5MM_memcpy(void *dest, const void *src, size_t n); +H5_DLL herr_t H5MM_get_alloc_stats(H5_alloc_stats_t *stats); #if defined H5_MEMORY_ALLOC_SANITY_CHECK H5_DLL void H5MM_sanity_check_all(void); H5_DLL void H5MM_final_sanity_check(void); diff --git a/src/H5Rint.c b/src/H5Rint.c index 1df8a20..30f3dbb 100644 --- a/src/H5Rint.c +++ b/src/H5Rint.c @@ -1768,6 +1768,7 @@ H5R__decode_token_region_compat(H5F_t *f, const unsigned char *buf, H5O_token_t token = { 0 }; size_t data_size; const uint8_t *p; + H5S_t *space = NULL; herr_t ret_value = SUCCEED; FUNC_ENTER_PACKAGE @@ -1788,7 +1789,6 @@ H5R__decode_token_region_compat(H5F_t *f, const unsigned char *buf, if(space_ptr) { H5O_loc_t oloc; /* Object location */ - H5S_t *space = NULL; /* Initialize the object location */ H5O_loc_reset(&oloc); @@ -1812,6 +1812,12 @@ H5R__decode_token_region_compat(H5F_t *f, const unsigned char *buf, done: H5MM_free(data); + + if(ret_value < 0) { + if(space && H5S_close(space) < 0) + HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release dataspace") + } + FUNC_LEAVE_NOAPI(ret_value) } /* end H5R__decode_token_region_compat() */ diff --git a/src/H5Sall.c b/src/H5Sall.c index 4a4245d..77fb582 100644 --- a/src/H5Sall.c +++ b/src/H5Sall.c @@ -690,6 +690,9 @@ H5S__all_deserialize(H5S_t **space, const uint8_t **p) /* Decode version */ UINT32DECODE(*p, version); + if(version < H5S_ALL_VERSION_1 || version > H5S_ALL_VERSION_LATEST) + HGOTO_ERROR(H5E_DATASPACE, H5E_BADVALUE, FAIL, "bad version number for all selection") + /* Skip over the remainder of the header */ *p += 8; diff --git a/src/H5Snone.c b/src/H5Snone.c index 0949b2a..630d1d5 100644 --- a/src/H5Snone.c +++ b/src/H5Snone.c @@ -648,6 +648,9 @@ H5S__none_deserialize(H5S_t **space, const uint8_t **p) /* Decode version */ UINT32DECODE(*p, version); + if(version < H5S_NONE_VERSION_1 || version > H5S_NONE_VERSION_LATEST) + HGOTO_ERROR(H5E_DATASPACE, H5E_BADVALUE, FAIL, "bad version number for none selection") + /* Skip over the remainder of the header */ *p += 8; diff --git a/src/H5Spkg.h b/src/H5Spkg.h index e139bce..da2dd4a 100644 --- a/src/H5Spkg.h +++ b/src/H5Spkg.h @@ -47,14 +47,17 @@ #define H5S_HYPER_VERSION_LATEST H5S_HYPER_VERSION_3 /* Versions for H5S_SEL_POINTS selection info */ -#define H5S_POINT_VERSION_1 1 -#define H5S_POINT_VERSION_2 2 +#define H5S_POINT_VERSION_1 1 +#define H5S_POINT_VERSION_2 2 +#define H5S_POINT_VERSION_LATEST H5S_POINT_VERSION_2 /* Versions for H5S_SEL_NONE selection info */ -#define H5S_NONE_VERSION_1 1 +#define H5S_NONE_VERSION_1 1 +#define H5S_NONE_VERSION_LATEST H5S_NONE_VERSION_1 /* Versions for H5S_SEL_ALL selection info */ -#define H5S_ALL_VERSION_1 1 +#define H5S_ALL_VERSION_1 1 +#define H5S_ALL_VERSION_LATEST H5S_ALL_VERSION_1 /* Encoded size of selection info for H5S_SEL_POINTS/H5S_SEL_HYPER */ #define H5S_SELECT_INFO_ENC_SIZE_2 0x02 /* 2 bytes: 16 bits */ diff --git a/src/H5Spoint.c b/src/H5Spoint.c index 721211e..6948125 100644 --- a/src/H5Spoint.c +++ b/src/H5Spoint.c @@ -1413,6 +1413,9 @@ H5S__point_deserialize(H5S_t **space, const uint8_t **p) /* Decode version */ UINT32DECODE(pp, version); + if(version < H5S_POINT_VERSION_1 || version > H5S_POINT_VERSION_LATEST) + HGOTO_ERROR(H5E_DATASPACE, H5E_BADVALUE, FAIL, "bad version number for point selection") + if(version >= (uint32_t)H5S_POINT_VERSION_2) /* Decode size of point info */ enc_size = *(pp)++; @@ -39,26 +39,26 @@ H5TS_key_t H5TS_cancel_key_g; #ifndef H5_HAVE_WIN_THREADS -/* An h5_tid_t is a record of a thread identifier that is +/* An H5TS_tid_t is a record of a thread identifier that is * available for reuse. */ struct _tid; -typedef struct _tid h5_tid_t; +typedef struct _tid H5TS_tid_t; struct _tid { - h5_tid_t *next; + H5TS_tid_t *next; uint64_t id; }; /* Pointer to first free thread ID record or NULL. */ -static h5_tid_t *tid_next_free = NULL; -static uint64_t tid_next_id = 0; +static H5TS_tid_t *H5TS_tid_next_free = NULL; +static uint64_t H5TS_tid_next_id = 0; -/* Mutual exclusion for access to tid_next_free and tid_next_id. */ -static pthread_mutex_t tid_mtx; +/* Mutual exclusion for access to H5TS_tid_next_free and H5TS_tid_next_id. */ +static pthread_mutex_t H5TS_tid_mtx; /* Key for thread-local storage of the thread ID. */ -static H5TS_key_t tid_key; +static H5TS_key_t H5TS_tid_key; #endif /* H5_HAVE_WIN_THREADS */ @@ -93,47 +93,85 @@ H5TS_key_destructor(void *key_val) #ifndef H5_HAVE_WIN_THREADS -/* When a thread shuts down, put its ID record on the free list. */ +/*-------------------------------------------------------------------------- + * NAME + * H5TS_tid_destructor + * + * USAGE + * H5TS_tid_destructor() + * + * RETURNS + * + * DESCRIPTION + * When a thread shuts down, put its ID record on the free list. + * + *-------------------------------------------------------------------------- + */ static void -tid_destructor(void *_v) +H5TS_tid_destructor(void *_v) { - h5_tid_t *tid = _v; + H5TS_tid_t *tid = _v; if (tid == NULL) return; - /* XXX I can use mutexes in destructors, right? */ /* TBD use an atomic CAS */ - pthread_mutex_lock(&tid_mtx); - tid->next = tid_next_free; - tid_next_free = tid; - pthread_mutex_unlock(&tid_mtx); + pthread_mutex_lock(&H5TS_tid_mtx); + tid->next = H5TS_tid_next_free; + H5TS_tid_next_free = tid; + pthread_mutex_unlock(&H5TS_tid_mtx); } -/* Initialize for integer thread identifiers. */ +/*-------------------------------------------------------------------------- + * NAME + * H5TS_tid_init + * + * USAGE + * H5TS_tid_init() + * + * RETURNS + * + * DESCRIPTION + * Initialize for integer thread identifiers. + * + *-------------------------------------------------------------------------- + */ static void -tid_init(void) +H5TS_tid_init(void) { - pthread_mutex_init(&tid_mtx, NULL); - pthread_key_create(&tid_key, tid_destructor); + pthread_mutex_init(&H5TS_tid_mtx, NULL); + pthread_key_create(&H5TS_tid_key, H5TS_tid_destructor); } -/* Return an integer identifier, ID, for the current thread satisfying the - * following properties: +/*-------------------------------------------------------------------------- + * NAME + * H5TS_thread_id * - * 1 1 <= ID <= UINT64_MAX - * 2 ID is constant over the thread's lifetime. - * 3 No two threads share an ID during their lifetimes. - * 4 A thread's ID is available for reuse as soon as it is joined. + * USAGE + * uint64_t id = H5TS_thread_id() + * + * RETURNS + * Return an integer identifier, ID, for the current thread. + * + * DESCRIPTION + * The ID satisfies the following properties: + * + * 1 1 <= ID <= UINT64_MAX + * 2 ID is constant over the thread's lifetime. + * 3 No two threads share an ID during their lifetimes. + * 4 A thread's ID is available for reuse as soon as it is joined. * - * ID 0 is reserved. H5TS_thread_id() returns 0 if the library was not built - * with thread safety or if an error prevents it from assigning an ID. + * ID 0 is reserved. H5TS_thread_id() returns 0 if the library was not + * built with thread safety or if an error prevents it from assigning an + * ID. + * + *-------------------------------------------------------------------------- */ uint64_t H5TS_thread_id(void) { - h5_tid_t *tid = pthread_getspecific(tid_key); - h5_tid_t proto_tid; + H5TS_tid_t *tid = pthread_getspecific(H5TS_tid_key); + H5TS_tid_t proto_tid; /* An ID is already assigned. */ if (tid != NULL) @@ -146,14 +184,14 @@ H5TS_thread_id(void) * point `tid` at `proto_tid` if we need to allocate some * memory. */ - pthread_mutex_lock(&tid_mtx); - if ((tid = tid_next_free) != NULL) - tid_next_free = tid->next; - else if (tid_next_id != UINT64_MAX) { + pthread_mutex_lock(&H5TS_tid_mtx); + if ((tid = H5TS_tid_next_free) != NULL) + H5TS_tid_next_free = tid->next; + else if (H5TS_tid_next_id != UINT64_MAX) { tid = &proto_tid; - tid->id = ++tid_next_id; + tid->id = ++H5TS_tid_next_id; } - pthread_mutex_unlock(&tid_mtx); + pthread_mutex_unlock(&H5TS_tid_mtx); /* If a prototype ID record was established, copy it to the heap. */ if (tid == &proto_tid) { @@ -168,8 +206,8 @@ H5TS_thread_id(void) * to it. */ tid->next = NULL; - if (pthread_setspecific(tid_key, tid) != 0) { - tid_destructor(tid); + if (pthread_setspecific(H5TS_tid_key, tid) != 0) { + H5TS_tid_destructor(tid); return 0; } @@ -213,7 +251,7 @@ H5TS_pthread_first_thread_init(void) H5_g.init_lock.lock_count = 0; /* Initialize integer thread identifiers. */ - tid_init(); + H5TS_tid_init(); /* initialize key for thread-specific error stacks */ pthread_key_create(&H5TS_errstk_key_g, H5TS_key_destructor); diff --git a/src/H5Tconv.c b/src/H5Tconv.c index 29fd582..2b1283e 100644 --- a/src/H5Tconv.c +++ b/src/H5Tconv.c @@ -3213,7 +3213,7 @@ H5T__conv_vlen(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, * necessary. If the SEQ_LEN is 0, allocate a minimal size buffer. */ if(!seq_len && !conv_buf) { - conv_buf_size = ((1 / H5T_VLEN_MIN_CONF_BUF_SIZE) + 1) * H5T_VLEN_MIN_CONF_BUF_SIZE; + conv_buf_size = H5T_VLEN_MIN_CONF_BUF_SIZE; if(NULL == (conv_buf = H5FL_BLK_CALLOC(vlen_seq, conv_buf_size))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for type conversion") } /* end if */ @@ -663,7 +663,7 @@ done: /*--------------------------------------------------------------------------- * Function: H5VLobject * - * Purpose: Retrieve the object pointer associated with an hid_t for a. + * Purpose: Retrieve the object pointer associated with an hid_t for a * VOL object. * * Note: This routine is mainly targeted toward unwrapping objects for diff --git a/src/H5VLconnector.h b/src/H5VLconnector.h index 39d9b14..7951a32 100644 --- a/src/H5VLconnector.h +++ b/src/H5VLconnector.h @@ -194,7 +194,7 @@ typedef enum H5VL_object_get_t { H5VL_OBJECT_GET_FILE, /* object file */ H5VL_OBJECT_GET_NAME, /* object name */ H5VL_OBJECT_GET_TYPE, /* object type */ - H5VL_OBJECT_GET_INFO /* H5Oget_info(_by_idx|name)3 */ + H5VL_OBJECT_GET_INFO /* H5Oget_info(_by_idx|name) */ } H5VL_object_get_t; /* types for object SPECIFIC callback */ diff --git a/src/H5VLint.c b/src/H5VLint.c index 6572faa..861629f 100644 --- a/src/H5VLint.c +++ b/src/H5VLint.c @@ -273,7 +273,7 @@ H5VL_term_package(void) else { if(H5I_nmembers(H5I_VOL) > 0) { /* Unregister all VOL connectors */ - (void)H5I_clear_type(H5I_VOL, FALSE, FALSE); + (void)H5I_clear_type(H5I_VOL, TRUE, FALSE); n++; } /* end if */ else { diff --git a/src/H5VLpassthru.c b/src/H5VLpassthru.c index 8b3dc62..2cf470e 100644 --- a/src/H5VLpassthru.c +++ b/src/H5VLpassthru.c @@ -1591,6 +1591,10 @@ H5VL_pass_through_file_create(const char *name, unsigned flags, hid_t fcpl_id, /* Get copy of our VOL info from FAPL */ H5Pget_vol_info(fapl_id, (void **)&info); + /* Make sure we have info about the underlying VOL to be used */ + if (!info) + return NULL; + /* Copy the FAPL */ under_fapl_id = H5Pcopy(fapl_id); @@ -1645,6 +1649,10 @@ H5VL_pass_through_file_open(const char *name, unsigned flags, hid_t fapl_id, /* Get copy of our VOL info from FAPL */ H5Pget_vol_info(fapl_id, (void **)&info); + /* Make sure we have info about the underlying VOL to be used */ + if (!info) + return NULL; + /* Copy the FAPL */ under_fapl_id = H5Pcopy(fapl_id); @@ -1785,6 +1793,10 @@ H5VL_pass_through_file_specific(void *file, H5VL_file_specific_t specific_type, /* Get copy of our VOL info from FAPL */ H5Pget_vol_info(fapl_id, (void **)&info); + /* Make sure we have info about the underlying VOL to be used */ + if (!info) + return (-1); + /* Copy the FAPL */ under_fapl_id = H5Pcopy(fapl_id); diff --git a/src/H5public.h b/src/H5public.h index 3312cf4..f592ab9 100644 --- a/src/H5public.h +++ b/src/H5public.h @@ -378,6 +378,19 @@ typedef struct H5O_token_t { uint8_t __data[H5O_MAX_TOKEN_SIZE]; } H5O_token_t; +/* + * Allocation statistics info struct + */ +typedef struct H5_alloc_stats_t { + unsigned long long total_alloc_bytes; /* Running count of total # of bytes allocated */ + size_t curr_alloc_bytes; /* Current # of bytes allocated */ + size_t peak_alloc_bytes; /* Peak # of bytes allocated */ + size_t max_block_size; /* Largest block allocated */ + size_t total_alloc_blocks_count; /* Running count of total # of blocks allocated */ + size_t curr_alloc_blocks_count; /* Current # of blocks allocated */ + size_t peak_alloc_blocks_count; /* Peak # of blocks allocated */ +} H5_alloc_stats_t; + /* Functions in H5.c */ H5_DLL herr_t H5open(void); H5_DLL herr_t H5close(void); @@ -386,6 +399,9 @@ H5_DLL herr_t H5garbage_collect(void); H5_DLL herr_t H5set_free_list_limits (int reg_global_lim, int reg_list_lim, int arr_global_lim, int arr_list_lim, int blk_global_lim, int blk_list_lim); +H5_DLL herr_t H5get_free_list_sizes(size_t *reg_size, size_t *arr_size, + size_t *blk_size, size_t *fac_size); +H5_DLL herr_t H5get_alloc_stats(H5_alloc_stats_t *stats); H5_DLL herr_t H5get_libversion(unsigned *majnum, unsigned *minnum, unsigned *relnum); H5_DLL herr_t H5check_version(unsigned majnum, unsigned minnum, diff --git a/src/H5trace.c b/src/H5trace.c index 7168d5d..f9f96e2 100644 --- a/src/H5trace.c +++ b/src/H5trace.c @@ -155,7 +155,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) } /* end if */ /* Get time for event */ - if(H5_DBL_ABS_EQUAL(first_time.etime, 0.0)) + if(H5_DBL_ABS_EQUAL(first_time.etime, (double)0.0f)) H5_timer_begin(&first_time); if(H5_debug_g.ttimes) H5_timer_begin(&event_time); @@ -249,7 +249,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 'a': if(ptr) { if(vp) - HDfprintf(out, "0x%lx", (unsigned long)vp); + HDfprintf(out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ @@ -263,7 +263,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 'b': if(ptr) { if(vp) - HDfprintf(out, "0x%lx", (unsigned long)vp); + HDfprintf(out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ @@ -282,7 +282,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 'd': if(ptr) { if(vp) - HDfprintf(out, "0x%lx", (unsigned long)vp); + HDfprintf(out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ @@ -298,7 +298,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 'a': if(ptr) { if(vp) - HDfprintf (out, "0x%lx", (unsigned long)vp); + HDfprintf (out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ @@ -336,7 +336,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 'c': if(ptr) { if(vp) - HDfprintf(out, "0x%lx", (unsigned long)vp); + HDfprintf(out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ @@ -362,7 +362,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 'f': if(ptr) { if(vp) - HDfprintf(out, "0x%lx", (unsigned long)vp); + HDfprintf(out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ @@ -396,7 +396,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 'F': if(ptr) { if(vp) - HDfprintf(out, "0x%lx", (unsigned long)vp); + HDfprintf(out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ @@ -430,7 +430,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 'h': if(ptr) { if(vp) - HDfprintf(out, "0x%lx", (unsigned long)vp); + HDfprintf(out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ @@ -460,7 +460,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 'i': if(ptr) { if(vp) - HDfprintf(out, "0x%lx", (unsigned long)vp); + HDfprintf(out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ @@ -498,7 +498,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 'k': if(ptr) { if(vp) - HDfprintf(out, "0x%lx", (unsigned long)vp); + HDfprintf(out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ @@ -544,7 +544,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 'l': if(ptr) { if(vp) - HDfprintf(out, "0x%lx", (unsigned long)vp); + HDfprintf(out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ @@ -586,7 +586,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 'n': if(ptr) { if(vp) - HDfprintf(out, "0x%lx", (unsigned long)vp); + HDfprintf(out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ @@ -633,7 +633,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 'o': if(ptr) { if(vp) - HDfprintf(out, "0x%lx", (unsigned long)vp); + HDfprintf(out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ @@ -663,7 +663,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 's': if(ptr) { if(vp) - HDfprintf(out, "0x%lx", (unsigned long)vp); + HDfprintf(out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ @@ -697,7 +697,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 't': if(ptr) { if(vp) - HDfprintf(out, "0x%lx", (unsigned long)vp); + HDfprintf(out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ @@ -723,7 +723,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 'v': if(ptr) { if(vp) - HDfprintf(out, "0x%lx", (unsigned long)vp); + HDfprintf(out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ @@ -759,7 +759,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 'e': if(ptr) { if(vp) - HDfprintf(out, "0x%lx", (unsigned long)vp); + HDfprintf(out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ @@ -778,7 +778,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 'd': if(ptr) { if(vp) - HDfprintf(out, "0x%lx", (unsigned long)vp); + HDfprintf(out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ @@ -804,21 +804,21 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 'e': if(ptr) { if(vp) - HDfprintf(out, "0x%lx", (unsigned long)vp); + HDfprintf(out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ else { H5E_error2_t *error = HDva_arg(ap, H5E_error2_t *); - HDfprintf(out, "0x%lx", (unsigned long)error); + HDfprintf(out, "0x%p", error); } /* end else */ break; case 's': if(ptr) { if(vp) - HDfprintf(out, "0x%lx", (unsigned long)vp); + HDfprintf(out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ @@ -849,7 +849,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 't': if(ptr) { if(vp) - HDfprintf(out, "0x%lx", (unsigned long)vp); + HDfprintf(out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ @@ -883,7 +883,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 'd': if(ptr) { if(vp) - HDfprintf(out, "0x%lx", (unsigned long)vp); + HDfprintf(out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ @@ -917,7 +917,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 'f': if(ptr) { if(vp) - HDfprintf(out, "0x%lx", (unsigned long)vp); + HDfprintf(out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ @@ -952,7 +952,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 'm': if(ptr) { if(vp) - HDfprintf(out, "0x%lx", (unsigned long)vp); + HDfprintf(out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ @@ -1003,7 +1003,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 's': if(ptr) { if(vp) - HDfprintf(out, "0x%lx", (unsigned long)vp); + HDfprintf(out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ @@ -1029,7 +1029,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 't': if(ptr) { if(vp) - HDfprintf(out, "0x%lx", (unsigned long)vp); + HDfprintf(out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ @@ -1038,7 +1038,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 'v': if(ptr) { if(vp) - HDfprintf(out, "0x%lx", (unsigned long)vp); + HDfprintf(out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ @@ -1088,7 +1088,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 'o': if(ptr) { if(vp) - HDfprintf(out, "0x%lx", (unsigned long)vp); + HDfprintf(out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ @@ -1136,14 +1136,14 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 's': if(ptr) { if(vp) - HDfprintf (out, "0x%lx", (unsigned long)vp); + HDfprintf (out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ else { H5G_stat_t *statbuf = HDva_arg(ap, H5G_stat_t*); - HDfprintf(out, "0x%lx", (unsigned long)statbuf); + HDfprintf(out, "0x%p", statbuf); } break; #endif /* H5_NO_DEPRECATED_SYMBOLS */ @@ -1157,7 +1157,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 'h': if(ptr) { if(vp) { - HDfprintf(out, "0x%lx", (unsigned long)vp); + HDfprintf(out, "0x%p", vp); if(asize_idx >= 0 && asize[asize_idx] >= 0) { hsize_t *p = (hsize_t *)vp; @@ -1191,7 +1191,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 's': if(ptr) { if(vp) { - HDfprintf(out, "0x%lx", (unsigned long)vp); + HDfprintf(out, "0x%p", vp); if(asize_idx >= 0 && asize[asize_idx] >= 0) { hssize_t *p = (hssize_t *)vp; @@ -1221,7 +1221,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 'i': if(ptr) { if(vp) - HDfprintf(out, "0x%lx", (unsigned long)vp); + HDfprintf(out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ @@ -1417,7 +1417,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 'i': if(ptr) { if(vp) - HDfprintf(out, "0x%lx", (unsigned long)vp); + HDfprintf(out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ @@ -1451,7 +1451,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 'o': if(ptr) { if(vp) - HDfprintf(out, "0x%lx", (unsigned long)vp); + HDfprintf(out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ @@ -1489,7 +1489,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 's': if(ptr) { if(vp) { - HDfprintf(out, "0x%lx", (unsigned long)vp); + HDfprintf(out, "0x%p", vp); if(asize_idx >= 0 && asize[asize_idx] >= 0) { int *p = (int*)vp; @@ -1513,7 +1513,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 't': if(ptr) { if(vp) - HDfprintf(out, "0x%lx", (unsigned long)vp); + HDfprintf(out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ @@ -1603,7 +1603,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 'u': if(ptr) { if(vp) { - HDfprintf(out, "0x%lx", (unsigned long)vp); + HDfprintf(out, "0x%p", vp); if(asize_idx >= 0 && asize[asize_idx] >= 0) { unsigned *p = (unsigned*)vp; @@ -1633,7 +1633,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 'k': if(ptr) { if(vp) - HDfprintf(out, "0x%lx", (unsigned long)vp); + HDfprintf(out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ @@ -1651,7 +1651,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 'l': if(ptr) { if(vp) - HDfprintf (out, "0x%lx", (unsigned long)vp); + HDfprintf (out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ @@ -1697,7 +1697,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 'c': if(ptr) { if(vp) - HDfprintf(out, "0x%lx", (unsigned long)vp); + HDfprintf(out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ @@ -1713,7 +1713,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 'i': if(ptr) { if(vp) - HDfprintf(out, "0x%lx", (unsigned long)vp); + HDfprintf(out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ @@ -1729,7 +1729,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 't': if(ptr) { if(vp) - HDfprintf(out, "0x%lx", (unsigned long)vp); + HDfprintf(out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ @@ -1788,7 +1788,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 'o': if(ptr) { if(vp) - HDfprintf(out, "0x%lx", (unsigned long)vp); + HDfprintf(out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ @@ -1804,7 +1804,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 't': if(ptr) { if(vp) - HDfprintf(out, "0x%lx", (unsigned long)vp); + HDfprintf(out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ @@ -1852,7 +1852,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 'p': if(ptr) { if(vp) - HDfprintf(out, "0x%lx", (unsigned long)vp); + HDfprintf(out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ @@ -1879,7 +1879,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 'o': if(ptr) { if(vp) - HDfprintf(out, "0x%lx", (unsigned long)vp); + HDfprintf(out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ @@ -1893,7 +1893,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 'd': if(ptr) { if(vp) - HDfprintf(out, "0x%lx", (unsigned long)vp); + HDfprintf(out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ @@ -1907,7 +1907,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 'r': if(ptr) { if(vp) - HDfprintf(out, "0x%lx", (unsigned long)vp); + HDfprintf(out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ @@ -1921,7 +1921,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 't': if(ptr) { if(vp) - HDfprintf(out, "0x%lx", (unsigned long)vp); + HDfprintf(out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ @@ -1975,7 +1975,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 'c': if(ptr) { if(vp) - HDfprintf(out, "0x%lx", (unsigned long)vp); + HDfprintf(out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ @@ -2009,7 +2009,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 's': if(ptr) { if(vp) - HDfprintf(out, "0x%lx", (unsigned long)vp); + HDfprintf(out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ @@ -2067,7 +2067,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 't': if(ptr) { if(vp) - HDfprintf(out, "0x%lx", (unsigned long)vp); + HDfprintf(out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ @@ -2115,7 +2115,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 's': if(ptr) { if(vp) - HDfprintf(out, "0x%lx", (unsigned long)vp); + HDfprintf(out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ @@ -2131,7 +2131,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 'c': if(ptr) { if(vp) - HDfprintf(out, "0x%lx", (unsigned long)vp); + HDfprintf(out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ @@ -2178,7 +2178,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 'd': if(ptr) { if(vp) - HDfprintf(out, "0x%lx", (unsigned long)vp); + HDfprintf(out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ @@ -2208,7 +2208,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 'e': if(ptr) { if(vp) - HDfprintf(out, "0x%lx", (unsigned long)vp); + HDfprintf(out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ @@ -2238,7 +2238,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 'n': if(ptr) { if(vp) - HDfprintf(out, "0x%lx", (unsigned long)vp); + HDfprintf(out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ @@ -2272,7 +2272,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 'o': if(ptr) { if(vp) - HDfprintf(out, "0x%lx", (unsigned long)vp); + HDfprintf(out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ @@ -2314,7 +2314,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 'p': if(ptr) { if(vp) - HDfprintf(out, "0x%lx", (unsigned long)vp); + HDfprintf(out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ @@ -2352,7 +2352,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 's': if(ptr) { if(vp) - HDfprintf(out, "0x%lx", (unsigned long)vp); + HDfprintf(out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ @@ -2386,7 +2386,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 't': if(ptr) { if(vp) - HDfprintf(out, "0x%lx", (unsigned long)vp); + HDfprintf(out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ @@ -2456,7 +2456,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 'z': if(ptr) { if(vp) - HDfprintf(out, "0x%lx", (unsigned long)vp); + HDfprintf(out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ @@ -2512,7 +2512,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 't': if(ptr) { if(vp) - HDfprintf(out, "0x%lx", (unsigned long)vp); + HDfprintf(out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ @@ -2533,7 +2533,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 'l': if(ptr) { if(vp) { - HDfprintf(out, "0x%lx", (unsigned long)vp); + HDfprintf(out, "0x%p", vp); if(asize_idx >= 0 && asize[asize_idx] >= 0) { unsigned long *p = (unsigned long *)vp; @@ -2557,7 +2557,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 'L': if(ptr) { if(vp) { - HDfprintf(out, "0x%lx", (unsigned long)vp); + HDfprintf(out, "0x%p", vp); if(asize_idx >= 0 && asize[asize_idx] >= 0) { unsigned long long *p = (unsigned long long *)vp; @@ -2589,7 +2589,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 'a': if(ptr) { if(vp) - HDfprintf (out, "0x%lx", (unsigned long)vp); + HDfprintf (out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ @@ -2625,7 +2625,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 'A': if(ptr) { if(vp) - HDfprintf (out, "0x%lx", (unsigned long)vp); + HDfprintf (out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ @@ -2643,7 +2643,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 'b': if(ptr) { if(vp) - HDfprintf (out, "0x%lx", (unsigned long)vp); + HDfprintf (out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ @@ -2673,7 +2673,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 'B': if(ptr) { if(vp) - HDfprintf (out, "0x%lx", (unsigned long)vp); + HDfprintf (out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ @@ -2703,7 +2703,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 'C': if(ptr) { if(vp) - HDfprintf (out, "0x%lx", (unsigned long)vp); + HDfprintf (out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ @@ -2720,7 +2720,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 'c': if(ptr) { if(vp) - HDfprintf (out, "0x%lx", (unsigned long)vp); + HDfprintf (out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ @@ -2756,7 +2756,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 'd': if(ptr) { if(vp) - HDfprintf (out, "0x%lx", (unsigned long)vp); + HDfprintf (out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ @@ -2783,7 +2783,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 'e': if(ptr) { if(vp) - HDfprintf (out, "0x%lx", (unsigned long)vp); + HDfprintf (out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ @@ -2807,7 +2807,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 'f': if(ptr) { if(vp) - HDfprintf (out, "0x%lx", (unsigned long)vp); + HDfprintf (out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ @@ -2831,7 +2831,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 'g': if(ptr) { if(vp) - HDfprintf (out, "0x%lx", (unsigned long)vp); + HDfprintf (out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ @@ -2873,7 +2873,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 'h': if(ptr) { if(vp) - HDfprintf (out, "0x%lx", (unsigned long)vp); + HDfprintf (out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ @@ -2912,7 +2912,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 'i': if(ptr) { if(vp) - HDfprintf (out, "0x%lx", (unsigned long)vp); + HDfprintf (out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ @@ -2936,7 +2936,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 'j': if(ptr) { if(vp) - HDfprintf (out, "0x%lx", (unsigned long)vp); + HDfprintf (out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ @@ -2960,7 +2960,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 'k': if(ptr) { if(vp) - HDfprintf (out, "0x%lx", (unsigned long)vp); + HDfprintf (out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ @@ -2987,7 +2987,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 'l': if(ptr) { if(vp) - HDfprintf (out, "0x%lx", (unsigned long)vp); + HDfprintf (out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ @@ -3014,7 +3014,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 'L': if(ptr) { if(vp) - HDfprintf (out, "0x%lx", (unsigned long)vp); + HDfprintf (out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ @@ -3038,7 +3038,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 'm': if(ptr) { if(vp) - HDfprintf (out, "0x%lx", (unsigned long)vp); + HDfprintf (out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ @@ -3065,7 +3065,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 'n': if(ptr) { if(vp) - HDfprintf (out, "0x%lx", (unsigned long)vp); + HDfprintf (out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ @@ -3095,7 +3095,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 'o': if(ptr) { if(vp) - HDfprintf (out, "0x%lx", (unsigned long)vp); + HDfprintf (out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ @@ -3131,7 +3131,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 'r': if(ptr) { if(vp) - HDfprintf (out, "0x%lx", (unsigned long)vp); + HDfprintf (out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ @@ -3158,7 +3158,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 's': if(ptr) { if(vp) - HDfprintf (out, "0x%lx", (unsigned long)vp); + HDfprintf (out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ @@ -3181,7 +3181,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 'S': if(ptr) { if(vp) - HDfprintf (out, "0x%lx", (unsigned long)vp); + HDfprintf (out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ @@ -3238,7 +3238,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 't': if(ptr) { if(vp) - HDfprintf (out, "0x%lx", (unsigned long)vp); + HDfprintf (out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ @@ -3286,7 +3286,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 'u': if(ptr) { if(vp) - HDfprintf (out, "0x%lx", (unsigned long)vp); + HDfprintf (out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ @@ -3304,7 +3304,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 'v': if(ptr) { if(vp) - HDfprintf (out, "0x%lx", (unsigned long)vp); + HDfprintf (out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ @@ -3409,7 +3409,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 'w': if(ptr) { if(vp) - HDfprintf (out, "0x%lx", (unsigned long)vp); + HDfprintf (out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ @@ -3435,7 +3435,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 'x': if(ptr) { if(vp) - HDfprintf (out, "0x%lx", (unsigned long)vp); + HDfprintf (out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ @@ -3453,7 +3453,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 'y': if(ptr) { if(vp) - HDfprintf (out, "0x%lx", (unsigned long)vp); + HDfprintf (out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ @@ -3489,7 +3489,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 'z': if(ptr) { if(vp) - HDfprintf (out, "0x%lx", (unsigned long)vp); + HDfprintf (out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ @@ -3513,14 +3513,14 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 'x': if(ptr) { if(vp) { - HDfprintf(out, "0x%lx", (unsigned long)vp); + HDfprintf(out, "0x%p", vp); if(asize_idx >= 0 && asize[asize_idx] >= 0) { void **p = (void**)vp; HDfprintf(out, " {"); for(i = 0; i < asize[asize_idx]; i++) { if(p[i]) - HDfprintf(out, "%s0x%lx", (i ? ", " : ""), (unsigned long)(p[i])); + HDfprintf(out, "%s0x%p", (i ? ", " : ""), p[i]); else HDfprintf(out, "%sNULL", (i ? ", " : "")); } /* end for */ @@ -3534,7 +3534,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) vp = HDva_arg (ap, void *); if(vp) - HDfprintf(out, "0x%lx", (unsigned long)vp); + HDfprintf(out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end else */ @@ -3543,7 +3543,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 'z': if(ptr) { if(vp) { - HDfprintf(out, "0x%lx", (unsigned long)vp); + HDfprintf(out, "0x%p", vp); if(asize_idx >= 0 && asize[asize_idx] >= 0) { size_t *p = (size_t *)vp; @@ -3569,7 +3569,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 'a': if(ptr) { if(vp) - HDfprintf(out, "0x%lx", (unsigned long)vp); + HDfprintf(out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ @@ -3599,21 +3599,21 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 'c': if(ptr) { if(vp) - HDfprintf(out, "0x%lx", (unsigned long)vp); + HDfprintf(out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ else { H5Z_class2_t *filter = HDva_arg(ap, H5Z_class2_t*); - HDfprintf(out, "0x%lx", (unsigned long)filter); + HDfprintf(out, "0x%p", filter); } /* end else */ break; case 'e': if(ptr) { if(vp) - HDfprintf(out, "0x%lx", (unsigned long)vp); + HDfprintf(out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ @@ -3632,7 +3632,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 'f': if(ptr) { if(vp) - HDfprintf(out, "0x%lx", (unsigned long)vp); + HDfprintf(out, "0x%p", vp); else HDfprintf(out, "NULL"); } /* end if */ @@ -3649,7 +3649,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case 's': if(ptr) { if(vp) { - HDfprintf(out, "0x%lx", (unsigned long)vp); + HDfprintf(out, "0x%p", vp); if(asize_idx >= 0 && asize[asize_idx] >= 0) { ssize_t *p = (ssize_t *)vp; diff --git a/src/libhdf5.settings.in b/src/libhdf5.settings.in index df7ddf2..192fc6f 100644 --- a/src/libhdf5.settings.in +++ b/src/libhdf5.settings.in @@ -39,7 +39,7 @@ Languages: H5_CPPFLAGS: @H5_CPPFLAGS@ AM_CPPFLAGS: @AM_CPPFLAGS@ C Flags: @CFLAGS@ - H5 C Flags: @H5_CFLAGS@ + H5 C Flags: @H5_CFLAGS@ @H5_ECFLAGS@ AM C Flags: @AM_CFLAGS@ Shared C Library: @enable_shared@ Static C Library: @enable_static@ |