Skip to content

Commit

Permalink
fix: element_size must be usz type (size_t)
Browse files Browse the repository at this point in the history
  • Loading branch information
iWas-Coder committed May 11, 2024
1 parent e68a623 commit a88f8d5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion include/sk_rngbuf.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ typedef struct {
void *data;
} sk_rngbuf;

sk_rngbuf sk_rngbuf_create(u32 capacity, u32 element_size, u8 overwrite);
sk_rngbuf sk_rngbuf_create(u32 capacity, usz element_size, u8 overwrite);

void sk_rngbuf_destroy(sk_rngbuf *rb);

Expand Down
4 changes: 2 additions & 2 deletions src/sk_rngbuf.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@
#include <sk_log.h>
#include <sk_rngbuf.h>

sk_rngbuf sk_rngbuf_create(u32 capacity, u32 element_size, u8 overwrite) {
sk_rngbuf sk_rngbuf_create(u32 capacity, usz element_size, u8 overwrite) {
return (sk_rngbuf) {
.capacity = capacity,
.element_size = element_size,
.overwrite = overwrite ? 1 : 0,
.curr_len = 0,
.head = 0,
.tail = -1,
.data = malloc(capacity * element_size)
.data = malloc((usz) capacity * element_size)
};
}

Expand Down

0 comments on commit a88f8d5

Please sign in to comment.