]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
CLEANUP: hpack: export debug functions and move inlines to .h
authorWilly Tarreau <w@1wt.eu>
Fri, 5 Jun 2020 07:05:31 +0000 (09:05 +0200)
committerWilly Tarreau <w@1wt.eu>
Thu, 11 Jun 2020 08:18:58 +0000 (10:18 +0200)
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.

include/haproxy/hpack-tbl.h
src/hpack-tbl.c

index a75ab068c5380c150f916b9677fe9cda5e126742..02cf7db5432239991e23d2dfc89e526d20bd679f 100644 (file)
 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 @@ static inline struct ist hpack_idx_to_value(const struct hpack_dht *dht, uint32_
        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).
index ac6408c2c0ca28e7d1b134df55c905df686919cc..e7c3d33ec29c94a34a58702c6b14de64775e1d8c 100644 (file)
@@ -101,17 +101,9 @@ const struct http_hdr hpack_sht[HPACK_SHT_SIZE] = {
 
 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 @@ static void hpack_dht_dump(FILE *out, const struct hpack_dht *dht)
 }
 
 /* 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;