diff --git a/include/sprs.h b/include/sprs.h index f7960b2..12abc27 100644 --- a/include/sprs.h +++ b/include/sprs.h @@ -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. diff --git a/src/sprs.c b/src/sprs.c index ef1271a..e3efca1 100644 --- a/src/sprs.c +++ b/src/sprs.c @@ -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);