MAJOR: stick-tables: remove key storage from the key struct

Now, the key struct only points to the storage provided by the
sample as input.
diff --git a/src/haproxy.c b/src/haproxy.c
index 4110893..4ff05ab 100644
--- a/src/haproxy.c
+++ b/src/haproxy.c
@@ -1051,7 +1051,7 @@
 
 	swap_buffer = (char *)calloc(1, global.tune.bufsize);
 	get_http_auth_buff = (char *)calloc(1, global.tune.bufsize);
-	static_table_key = calloc(1, sizeof(*static_table_key) + global.tune.bufsize);
+	static_table_key = calloc(1, sizeof(*static_table_key));
 
 	fdinfo = (struct fdinfo *)calloc(1,
 				       sizeof(struct fdinfo) * (global.maxsock));
diff --git a/src/stick_table.c b/src/stick_table.c
index e9e9304..9c053bc 100644
--- a/src/stick_table.c
+++ b/src/stick_table.c
@@ -521,7 +521,6 @@
 	default: /* impossible case. */
 		return NULL;
 	}
-	static_table_key->data = smp->data.u;
 
 	return static_table_key;
 }
diff --git a/src/stream.c b/src/stream.c
index 5280e37..278bdb8 100644
--- a/src/stream.c
+++ b/src/stream.c
@@ -2597,11 +2597,20 @@
 	else if (num > 9) { /* src_* variant, args[0] = table */
 		struct stktable_key *key;
 		struct connection *conn = objt_conn(sess->origin);
+		struct sample smp;
 
 		if (!conn)
 			return NULL;
 
-		key = addr_to_stktable_key(&conn->addr.from, args->data.prx->table.type);
+		/* Fetch source adress in a sample. */
+		smp.px = NULL;
+		smp.sess = sess;
+		smp.strm = strm;
+		if (!smp_fetch_src(NULL, &smp, NULL, NULL))
+			return NULL;
+
+		/* Converts into key. */
+		key = smp_to_stkey(&smp, &args->data.prx->table);
 		if (!key)
 			return NULL;
 
@@ -2647,6 +2656,7 @@
 	static struct stkctr stkctr;
 	struct stktable_key *key;
 	struct connection *conn = objt_conn(sess->origin);
+	struct sample smp;
 
 	if (strncmp(kw, "src_", 4) != 0)
 		return NULL;
@@ -2654,7 +2664,15 @@
 	if (!conn)
 		return NULL;
 
+	/* Fetch source adress in a sample. */
+	smp.px = NULL;
+	smp.sess = sess;
+	smp.strm = strm;
+	if (!smp_fetch_src(NULL, &smp, NULL, NULL))
+		return NULL;
+
-	key = addr_to_stktable_key(&conn->addr.from, args->data.prx->table.type);
+	/* Converts into key. */
+	key = smp_to_stkey(&smp, &args->data.prx->table);
 	if (!key)
 		return NULL;
 
@@ -2867,7 +2885,12 @@
 	if (!conn)
 		return 0;
 
+	/* Fetch source adress in a sample. */
+	if (!smp_fetch_src(NULL, smp, NULL, NULL))
+		return 0;
+
-	key = addr_to_stktable_key(&conn->addr.from, smp->px->table.type);
+	/* Converts into key. */
+	key = smp_to_stkey(smp, &args->data.prx->table);
 	if (!key)
 		return 0;