commit 3c43d1203c89d091e306160c4bc2301a9d378450
parent 4ad50caa29a8a4d4be3baf1754ca2c78e27afd51
Author: Joris Vink <joris@coders.se>
Date: Tue, 12 Jul 2016 14:01:02 +0200
Move towards size_t in the pool API.
Diffstat:
2 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/includes/kore.h b/includes/kore.h
@@ -344,10 +344,10 @@ struct kore_pool_entry {
};
struct kore_pool {
- u_int32_t elen;
- u_int32_t slen;
- u_int32_t elms;
- u_int32_t inuse;
+ size_t elen;
+ size_t slen;
+ size_t elms;
+ size_t inuse;
char *name;
LIST_HEAD(, kore_pool_region) regions;
@@ -518,7 +518,7 @@ void kore_mem_init(void);
void *kore_pool_get(struct kore_pool *);
void kore_pool_put(struct kore_pool *, void *);
void kore_pool_init(struct kore_pool *, const char *,
- u_int32_t, u_int32_t);
+ size_t, size_t);
void kore_pool_cleanup(struct kore_pool *);
time_t kore_date_to_time(char *);
diff --git a/src/pool.c b/src/pool.c
@@ -24,14 +24,14 @@
#define POOL_ELEMENT_BUSY 0
#define POOL_ELEMENT_FREE 1
-static void pool_region_create(struct kore_pool *, u_int32_t);
+static void pool_region_create(struct kore_pool *, size_t);
static void pool_region_destroy(struct kore_pool *);
void
kore_pool_init(struct kore_pool *pool, const char *name,
- u_int32_t len, u_int32_t elm)
+ size_t len, size_t elm)
{
- kore_debug("kore_pool_init(%p, %s, %d, %d)", pool, name, len, elm);
+ kore_debug("kore_pool_init(%p, %s, %zu, %zu)", pool, name, len, elm);
if ((pool->name = strdup(name)) == NULL)
fatal("kore_pool_init: strdup %s", errno_s);
@@ -107,9 +107,9 @@ kore_pool_put(struct kore_pool *pool, void *ptr)
}
static void
-pool_region_create(struct kore_pool *pool, u_int32_t elms)
+pool_region_create(struct kore_pool *pool, size_t elms)
{
- u_int32_t i;
+ size_t i;
u_int8_t *p;
struct kore_pool_region *reg;
struct kore_pool_entry *entry;