third patch.
From 9152cb5d982459ad0f67e848df884252cd309622 Mon Sep 17 00:00:00 2001
From: David Carlier <[email protected]>
Date: Tue, 29 Dec 2015 13:17:38 +0000
Subject: [PATCH 3/5] CLEANUP: stick tables: void pointers arithmetic removal.
third patch which applies in a few place inside stick table's code.
---
include/proto/stick_table.h | 2 +-
src/stick_table.c | 6 +++---
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/include/proto/stick_table.h b/include/proto/stick_table.h
index 8c97f73..2ae045b 100644
--- a/include/proto/stick_table.h
+++ b/include/proto/stick_table.h
@@ -124,7 +124,7 @@ static inline void *stktable_data_ptr(struct stktable *t, struct stksess *ts, in
if (!ts)
return NULL;
- return (void *)ts + t->data_ofs[type];
+ return (char *)ts + t->data_ofs[type];
}
/* kill an entry if it's expired and its ref_cnt is zero */
diff --git a/src/stick_table.c b/src/stick_table.c
index 93fb10c..094ec42 100644
--- a/src/stick_table.c
+++ b/src/stick_table.c
@@ -43,7 +43,7 @@ struct stktable_key *static_table_key;
void stksess_free(struct stktable *t, struct stksess *ts)
{
t->current--;
- pool_free2(t->pool, (void *)ts - t->data_size);
+ pool_free2(t->pool, (char *)ts - t->data_size);
}
/*
@@ -81,7 +81,7 @@ void stksess_setkey(struct stktable *t, struct stksess *ts, struct stktable_key
*/
static struct stksess *stksess_init(struct stktable *t, struct stksess * ts)
{
- memset((void *)ts - t->data_size, 0, t->data_size);
+ memset((char *)ts - t->data_size, 0, t->data_size);
ts->ref_cnt = 0;
ts->key.node.leaf_p = NULL;
ts->exp.node.leaf_p = NULL;
@@ -170,7 +170,7 @@ struct stksess *stksess_new(struct stktable *t, struct stktable_key *key)
return NULL;
}
- ts = pool_alloc2(t->pool) + t->data_size;
+ ts = (struct stksess *)((char *)(pool_alloc2(t->pool)) + t->data_size);
if (ts) {
t->current++;
stksess_init(t, ts);
--
2.5.0