diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2001-06-21 16:53:39 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2001-06-21 16:53:39 (GMT) |
commit | 4402923400e705eac6d28f97518bf18c536f6c80 (patch) | |
tree | d6e4254a561072885795c0f7881ccddbbfd79895 /src/H5FLprivate.h | |
parent | 8263f168f703f8a680a49419a0053c384abec4c3 (diff) | |
download | hdf5-4402923400e705eac6d28f97518bf18c536f6c80.zip hdf5-4402923400e705eac6d28f97518bf18c536f6c80.tar.gz hdf5-4402923400e705eac6d28f97518bf18c536f6c80.tar.bz2 |
[svn-r4038] Purpose:
Code clean/bug fix
Description:
H5FL (free-list manager) code currently is taking an hsize_t as the size
of a memory block to allocate. On many machines, the size of an hsize_t
is greater than the size of a size_t, potentially leading to incorrect
memory allocations in rare circumstances.
Solution:
Changed hsize_t parameters and variables to size_t.
Platforms tested:
FreeBSD 4.3 (hawkwind)
Diffstat (limited to 'src/H5FLprivate.h')
-rw-r--r-- | src/H5FLprivate.h | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/H5FLprivate.h b/src/H5FLprivate.h index b8835db..4457682 100644 --- a/src/H5FLprivate.h +++ b/src/H5FLprivate.h @@ -47,7 +47,7 @@ typedef struct H5FL_reg_head_t { uintn onlist; /* Number of blocks on free list */ size_t list_mem; /* Amount of memory on free list */ const char *name; /* Name of the type */ - hsize_t size; /* Size of the blocks in the list */ + size_t size; /* Size of the blocks in the list */ H5FL_reg_node_t *list; /* List of free blocks */ } H5FL_reg_head_t; @@ -75,7 +75,7 @@ typedef struct H5FL_reg_head_t { /* Data structure to store each block in free list */ typedef struct H5FL_blk_list_t { - hsize_t size; /* Size of the page */ + size_t size; /* Size of the page */ struct H5FL_blk_list_t *next; /* Pointer to next block in free list */ union { double unused1; /* Unused normally, just here for aligment */ @@ -85,7 +85,7 @@ typedef struct H5FL_blk_list_t { /* Data structure for priority queue node of block free lists */ typedef struct H5FL_blk_node_t { - hsize_t size; /* Size of the blocks in the list */ + size_t size; /* Size of the blocks in the 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 */ @@ -96,7 +96,7 @@ typedef struct H5FL_blk_head_t { uintn init; /* Whether the free list has been initialized */ uintn allocated; /* Number of blocks allocated */ uintn onlist; /* Number of blocks on free list */ - hsize_t list_mem; /* Amount of memory in block on free list */ + size_t list_mem; /* Amount of memory in block 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; @@ -125,7 +125,7 @@ typedef struct H5FL_blk_head_t { /* Data structure to store each array in free list */ typedef struct H5FL_arr_node_t { struct H5FL_arr_node_t *next; /* Pointer to next block in free list */ - hsize_t nelem; /* Number of elements in this array */ + size_t nelem; /* Number of elements in this array */ union { double unused1; /* Unused normally, just here for aligment */ haddr_t unused2; /* Unused normally, just here for aligment */ @@ -137,10 +137,10 @@ typedef struct H5FL_arr_head_t { uintn init; /* Whether the free list has been initialized */ uintn allocated; /* Number of blocks allocated */ uintn *onlist; /* Number of blocks on free list */ - hsize_t list_mem; /* Amount of memory in block on free list */ + size_t list_mem; /* Amount of memory in block on free list */ const char *name; /* Name of the type */ intn maxelem; /* Maximum number of elements in an array */ - hsize_t size; /* Size of the array elements in the list */ + size_t size; /* Size of the array elements in the list */ union { H5FL_arr_node_t **list_arr; /* Array of lists of free blocks */ H5FL_blk_head_t queue; /* Priority queue of array blocks */ @@ -171,14 +171,14 @@ typedef struct H5FL_arr_head_t { /* * Library prototypes. */ -__DLL__ void * H5FL_blk_alloc(H5FL_blk_head_t *head, hsize_t size, uintn clear); +__DLL__ void * H5FL_blk_alloc(H5FL_blk_head_t *head, size_t size, uintn clear); __DLL__ void * H5FL_blk_free(H5FL_blk_head_t *head, void *block); -__DLL__ void * H5FL_blk_realloc(H5FL_blk_head_t *head, void *block, hsize_t new_size); +__DLL__ void * H5FL_blk_realloc(H5FL_blk_head_t *head, void *block, size_t new_size); __DLL__ void * H5FL_reg_alloc(H5FL_reg_head_t *head, uintn clear); __DLL__ void * H5FL_reg_free(H5FL_reg_head_t *head, void *obj); -__DLL__ void * H5FL_arr_alloc(H5FL_arr_head_t *head, hsize_t elem, uintn clear); +__DLL__ void * H5FL_arr_alloc(H5FL_arr_head_t *head, size_t elem, uintn clear); __DLL__ void * H5FL_arr_free(H5FL_arr_head_t *head, void *obj); -__DLL__ void * H5FL_arr_realloc(H5FL_arr_head_t *head, void *obj, hsize_t new_elem); +__DLL__ void * H5FL_arr_realloc(H5FL_arr_head_t *head, void *obj, size_t new_elem); __DLL__ herr_t H5FL_garbage_coll(void); __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); |