Skip to content

Commit

Permalink
ecgpool: eliminate cross-signedness comparisons
Browse files Browse the repository at this point in the history
  • Loading branch information
dankamongmen committed Dec 25, 2024
1 parent 054e31c commit 4dad3a9
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/lib/egcpool.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,16 @@ typedef struct egcpool {
} egcpool;

#define POOL_MINIMUM_ALLOC BUFSIZ
#define POOL_MAXIMUM_BYTES (1u << 24u) // max 16MiB
#define POOL_MAXIMUM_BYTES (1 << 24) // max 16MiB (assumes 32 bits)

static inline void
egcpool_init(egcpool* p){
memset(p, 0, sizeof(*p));
}

static inline int
egcpool_grow(egcpool* pool, size_t len){
size_t newsize = pool->poolsize * 2;
egcpool_grow(egcpool* pool, int len){
int newsize = pool->poolsize * 2;
if(newsize < pool->poolsize){
return -1; // pernicious overflow (see also POOL_MAXIMUM_BYTES check below)
}
Expand Down

0 comments on commit 4dad3a9

Please sign in to comment.