diff --git a/src/liblsquic/lsquic_hpack_dec.c b/src/liblsquic/lsquic_hpack_dec.c index 43e56a3..af1ee9a 100644 --- a/src/liblsquic/lsquic_hpack_dec.c +++ b/src/liblsquic/lsquic_hpack_dec.c @@ -65,7 +65,10 @@ lsquic_hdec_cleanup (struct lsquic_hdec *dec) //https://tools.ietf.org/html/draft-ietf-httpbis-header-compression-12#section-5.1 -int +#ifdef NDEBUG +static +#endif + int lsquic_hdec_dec_int (const unsigned char **src, const unsigned char *src_end, uint8_t prefix_bits, uint32_t *value) { @@ -185,7 +188,10 @@ hdec_huff_decode (const unsigned char *src, int src_len, //reutrn the length in the dst, also update the src -static int +#ifdef NDEBUG +static +#endif + int hdec_dec_str (unsigned char *dst, size_t dst_len, const unsigned char **src, const unsigned char *src_end) { @@ -244,7 +250,10 @@ hdec_get_table_entry (struct lsquic_hdec *dec, uint32_t index) } -int +#ifdef NDEBUG +static +#endif + int lsquic_hdec_push_entry (struct lsquic_hdec *dec, const char *name, uint16_t name_len, const char *val, uint16_t val_len) { diff --git a/src/liblsquic/lsquic_hpack_dec.h b/src/liblsquic/lsquic_hpack_dec.h index d95b1da..43596a8 100644 --- a/src/liblsquic/lsquic_hpack_dec.h +++ b/src/liblsquic/lsquic_hpack_dec.h @@ -45,13 +45,14 @@ lsquic_hdec_set_max_capacity (struct lsquic_hdec *, unsigned); size_t lsquic_hdec_mem_used (const struct lsquic_hdec *); +#ifndef NDEBUG int lsquic_hdec_dec_int (const unsigned char **src, const unsigned char *src_end, uint8_t prefix_bits, uint32_t *value); - int lsquic_hdec_push_entry (struct lsquic_hdec *dec, const char *name, hpack_strlen_t name_len, const char *val, hpack_strlen_t val_len); +#endif #endif diff --git a/src/liblsquic/lsquic_hpack_enc.c b/src/liblsquic/lsquic_hpack_enc.c index 39c003b..bc7ad58 100644 --- a/src/liblsquic/lsquic_hpack_enc.c +++ b/src/liblsquic/lsquic_hpack_enc.c @@ -92,7 +92,10 @@ lsquic_henc_cleanup (struct lsquic_henc *enc) //not find return 0, otherwise return the index -unsigned +#ifdef NDEBUG +static +#endif + unsigned lsquic_henc_get_stx_tab_id (const char *name, hpack_strlen_t name_len, const char *val, hpack_strlen_t val_len, int *val_matched) { @@ -516,7 +519,10 @@ henc_enc_int (unsigned char *dst, unsigned char *const end, uint32_t value, } -static int +#ifdef NDEBUG +static +#endif + int henc_huffman_enc (const unsigned char *src, const unsigned char *const src_end, unsigned char *dst, int dst_len) { @@ -556,7 +562,10 @@ henc_huffman_enc (const unsigned char *src, const unsigned char *const src_end, } -int +#ifdef NDEBUG +static +#endif + int lsquic_henc_enc_str (unsigned char *const dst, size_t dst_len, const unsigned char *str, hpack_strlen_t str_len) { @@ -702,7 +711,10 @@ henc_grow_tables (struct lsquic_henc *enc) return 0; } -int +#ifdef NDEBUG +static +#endif + int lsquic_henc_push_entry (struct lsquic_henc *enc, const char *name, hpack_strlen_t name_len, const char *value, hpack_strlen_t value_len) @@ -819,7 +831,7 @@ lsquic_henc_set_max_capacity (struct lsquic_henc *enc, unsigned max_capacity) henc_remove_overflow_entries(enc); } - +#ifndef NDEBUG void lsquic_henc_iter_reset (struct lsquic_henc *enc) { @@ -847,7 +859,7 @@ lsquic_henc_iter_next (struct lsquic_henc *enc, retval->entry_id = henc_calc_table_id(enc, entry); return 0; } - +#endif size_t lsquic_henc_mem_used (const struct lsquic_henc *enc) diff --git a/src/liblsquic/lsquic_hpack_enc.h b/src/liblsquic/lsquic_hpack_enc.h index 28babd0..14ca6cb 100644 --- a/src/liblsquic/lsquic_hpack_enc.h +++ b/src/liblsquic/lsquic_hpack_enc.h @@ -10,6 +10,7 @@ struct enc_table_entry; +#ifndef NDEBUG struct enc_dyn_table_entry { const char *name, /* Not NUL-terminated */ @@ -18,6 +19,7 @@ struct enc_dyn_table_entry value_len; unsigned entry_id; }; +#endif STAILQ_HEAD(enc_head, enc_table_entry); struct double_enc_head; @@ -42,8 +44,10 @@ struct lsquic_henc struct enc_head hpe_all_entries; struct double_enc_head *hpe_buckets; +#ifndef NDEBUG const struct enc_table_entry *hpe_iter; +#endif }; @@ -79,6 +83,7 @@ lsquic_henc_set_max_capacity (struct lsquic_henc *, unsigned); size_t lsquic_henc_mem_used (const struct lsquic_henc *); +#ifndef NDEBUG unsigned lsquic_henc_get_stx_tab_id (const char *name, hpack_strlen_t name_len, const char *val, hpack_strlen_t val_len, int *val_matched); @@ -97,5 +102,6 @@ lsquic_henc_iter_reset (struct lsquic_henc *enc); /* Returns 0 if entry is found */ int lsquic_henc_iter_next (struct lsquic_henc *enc, struct enc_dyn_table_entry *); +#endif #endif diff --git a/src/liblsquic/lsquic_parse.h b/src/liblsquic/lsquic_parse.h index 1f8fb13..6d220a0 100644 --- a/src/liblsquic/lsquic_parse.h +++ b/src/liblsquic/lsquic_parse.h @@ -143,6 +143,7 @@ struct parse_funcs uint16_t *reason_length, const char **reason); int (*pf_gen_ping_frame) (unsigned char *buf, int buf_len); +#ifndef NDEBUG /* These float reading and writing functions assume `mem' has at least * 2 bytes. */ @@ -150,6 +151,7 @@ struct parse_funcs (*pf_write_float_time16) (lsquic_time_t time_us, void *mem); uint64_t (*pf_read_float_time16) (const void *mem); +#endif size_t (*pf_calc_stream_frame_header_sz) (uint32_t stream_id, uint64_t offset); void