Switch all sizing types to size_t.
This commit is contained in:
parent
2bf3f32bed
commit
c97538265d
|
@ -33,7 +33,7 @@ struct sprs_element_s {
|
|||
/**
|
||||
* The index of this element in the dense array.
|
||||
*/
|
||||
int index;
|
||||
size_t index;
|
||||
/**
|
||||
* A piece of data (optional) associated with this index.
|
||||
*/
|
||||
|
@ -47,11 +47,11 @@ struct sprs_s {
|
|||
/**
|
||||
* The maximum size of the set. This is the limit for integer indices.
|
||||
*/
|
||||
int capacity;
|
||||
size_t capacity;
|
||||
/**
|
||||
* The current size of the sparse set, and the next available index in the dense array.
|
||||
*/
|
||||
int size;
|
||||
size_t size;
|
||||
|
||||
/**
|
||||
* The dense array.
|
||||
|
@ -80,7 +80,7 @@ void sprs_init(sprs* sprs);
|
|||
* @param size the maximum capacity of the sparse set to use.
|
||||
* @return LIBDS_SUCCESS if all goes well, or LIBDS_MALLOC if an allocation failed.
|
||||
*/
|
||||
libds_result sprs_setup(sprs* sprs, int size);
|
||||
libds_result sprs_setup(sprs* sprs, size_t size);
|
||||
/**
|
||||
* Frees memory allocated by the sparse set, and resets its capacity and size.
|
||||
* @param sprs the sparse set to free.
|
||||
|
|
|
@ -7,7 +7,7 @@ void sprs_init(sprs* sprs){
|
|||
sprs->dense = NULL;
|
||||
sprs->sparse = NULL;
|
||||
}
|
||||
libds_result sprs_setup(sprs* sprs, int size){
|
||||
libds_result sprs_setup(sprs* sprs, size_t size){
|
||||
libds_result result = LIBDS_SUCCESS;
|
||||
sprs->sparse = malloc(sizeof(*(sprs->sparse)) * size);
|
||||
sprs->dense = malloc(sizeof(*(sprs->dense)) * size);
|
||||
|
|
Loading…
Reference in New Issue
Block a user