CLEANUP: hpack: export debug functions and move inlines to .h
When building contrib/hpack there is a warning about an unused static
function. Actually it makes no sense to make it static, instead it must
be regularly exported. Similarly there is hpack_dht_get_tail() which is
inlined in the C file and which would make more sense with all other ones
in the H file.
diff --git a/include/haproxy/hpack-tbl.h b/include/haproxy/hpack-tbl.h
index a75ab06..02cf7db 100644
--- a/include/haproxy/hpack-tbl.h
+++ b/include/haproxy/hpack-tbl.h
@@ -49,8 +49,13 @@
extern const struct http_hdr hpack_sht[HPACK_SHT_SIZE];
extern struct pool_head *pool_head_hpack_tbl;
-extern int __hpack_dht_make_room(struct hpack_dht *dht, unsigned int needed);
-extern int hpack_dht_insert(struct hpack_dht *dht, struct ist name, struct ist value);
+int __hpack_dht_make_room(struct hpack_dht *dht, unsigned int needed);
+int hpack_dht_insert(struct hpack_dht *dht, struct ist name, struct ist value);
+
+#ifdef DEBUG_HPACK
+void hpack_dht_dump(FILE *out, const struct hpack_dht *dht);
+void hpack_dht_check_consistency(const struct hpack_dht *dht);
+#endif
/* return a pointer to the entry designated by index <idx> (starting at 1) or
* NULL if this index is not there.
@@ -126,6 +131,14 @@
return hpack_get_value(dht, dte);
}
+/* returns the slot number of the oldest entry (tail). Must not be used on an
+ * empty table.
+ */
+static inline unsigned int hpack_dht_get_tail(const struct hpack_dht *dht)
+{
+ return ((dht->head + 1U < dht->used) ? dht->wrap : 0) + dht->head + 1U - dht->used;
+}
+
/* Purges table dht until a header field of <needed> bytes fits according to
* the protocol (adding 32 bytes overhead). Returns non-zero on success, zero
* on failure (ie: table empty but still not sufficient).
diff --git a/src/hpack-tbl.c b/src/hpack-tbl.c
index ac6408c..e7c3d33 100644
--- a/src/hpack-tbl.c
+++ b/src/hpack-tbl.c
@@ -101,17 +101,9 @@
struct pool_head *pool_head_hpack_tbl = NULL;
-/* returns the slot number of the oldest entry (tail). Must not be used on an
- * empty table.
- */
-static inline unsigned int hpack_dht_get_tail(const struct hpack_dht *dht)
-{
- return ((dht->head + 1U < dht->used) ? dht->wrap : 0) + dht->head + 1U - dht->used;
-}
-
#ifdef DEBUG_HPACK
/* dump the whole dynamic header table */
-static void hpack_dht_dump(FILE *out, const struct hpack_dht *dht)
+void hpack_dht_dump(FILE *out, const struct hpack_dht *dht)
{
unsigned int i;
unsigned int slot;
@@ -128,7 +120,7 @@
}
/* check for the whole dynamic header table consistency, abort on failures */
-static void hpack_dht_check_consistency(const struct hpack_dht *dht)
+void hpack_dht_check_consistency(const struct hpack_dht *dht)
{
unsigned slot = hpack_dht_get_tail(dht);
unsigned used2 = dht->used;