CLEANUP: pools: rename all pool functions and pointers to remove this "2"
During the migration to the second version of the pools, the new
functions and pool pointers were all called "pool_something2()" and
"pool2_something". Now there's no more pool v1 code and it's a real
pain to still have to deal with this. Let's clean this up now by
removing the "2" everywhere, and by renaming the pool heads
"pool_head_something".
diff --git a/src/mux_h2.c b/src/mux_h2.c
index 90bd36e..6857c8d 100644
--- a/src/mux_h2.c
+++ b/src/mux_h2.c
@@ -30,9 +30,9 @@
static const struct h2s *h2_idle_stream;
/* the h2c connection pool */
-static struct pool_head *pool2_h2c;
+static struct pool_head *pool_head_h2c;
/* the h2s stream pool */
-static struct pool_head *pool2_h2s;
+static struct pool_head *pool_head_h2s;
/* Connection flags (32 bit), in h2c->flags */
#define H2_CF_NONE 0x00000000
@@ -328,7 +328,7 @@
struct task *t = NULL;
struct session *sess = conn->owner;
- h2c = pool_alloc2(pool2_h2c);
+ h2c = pool_alloc(pool_head_h2c);
if (!h2c)
goto fail;
@@ -387,7 +387,7 @@
fail:
if (t)
task_free(t);
- pool_free2(pool2_h2c, h2c);
+ pool_free(pool_head_h2c, h2c);
return -1;
}
@@ -448,7 +448,7 @@
h2c->task = NULL;
}
- pool_free2(pool2_h2c, h2c);
+ pool_free(pool_head_h2c, h2c);
}
conn->mux = NULL;
@@ -597,7 +597,7 @@
struct conn_stream *cs;
struct h2s *h2s;
- h2s = pool_alloc2(pool2_h2s);
+ h2s = pool_alloc(pool_head_h2s);
if (!h2s)
goto out;
@@ -631,7 +631,7 @@
cs_free(cs);
out_close:
eb32_delete(&h2s->by_id);
- pool_free2(pool2_h2s, h2s);
+ pool_free(pool_head_h2s, h2s);
h2s = NULL;
out:
return h2s;
@@ -992,7 +992,7 @@
if (!h2s->cs) {
/* this stream was already orphaned */
eb32_delete(&h2s->by_id);
- pool_free2(pool2_h2s, h2s);
+ pool_free(pool_head_h2s, h2s);
continue;
}
@@ -1905,7 +1905,7 @@
else {
/* just sent the last frame for this orphaned stream */
eb32_delete(&h2s->by_id);
- pool_free2(pool2_h2s, h2s);
+ pool_free(pool_head_h2s, h2s);
}
}
}
@@ -1947,7 +1947,7 @@
else {
/* just sent the last frame for this orphaned stream */
eb32_delete(&h2s->by_id);
- pool_free2(pool2_h2s, h2s);
+ pool_free(pool_head_h2s, h2s);
}
}
}
@@ -2322,7 +2322,7 @@
h2c->task->expire = TICK_ETERNITY;
}
}
- pool_free2(pool2_h2s, h2s);
+ pool_free(pool_head_h2s, h2s);
}
static void h2_shutr(struct conn_stream *cs, enum cs_shr_mode mode)
@@ -3202,8 +3202,8 @@
static void __h2_deinit(void)
{
- pool_destroy2(pool2_h2s);
- pool_destroy2(pool2_h2c);
+ pool_destroy(pool_head_h2s);
+ pool_destroy(pool_head_h2c);
}
__attribute__((constructor))
@@ -3212,6 +3212,6 @@
alpn_register_mux(&alpn_mux_h2);
cfg_register_keywords(&cfg_kws);
hap_register_post_deinit(__h2_deinit);
- pool2_h2c = create_pool("h2c", sizeof(struct h2c), MEM_F_SHARED);
- pool2_h2s = create_pool("h2s", sizeof(struct h2s), MEM_F_SHARED);
+ pool_head_h2c = create_pool("h2c", sizeof(struct h2c), MEM_F_SHARED);
+ pool_head_h2s = create_pool("h2s", sizeof(struct h2s), MEM_F_SHARED);
}