Replace some erroneously removed debugging code

This commit is contained in:
Bob Perper 2018-03-30 16:38:16 -04:00
parent 14931b3a86
commit a4e2468929
5 changed files with 40 additions and 10 deletions

View file

@ -65,6 +65,9 @@ lsquic_hdec_cleanup (struct lsquic_hdec *dec)
//https://tools.ietf.org/html/draft-ietf-httpbis-header-compression-12#section-5.1 //https://tools.ietf.org/html/draft-ietf-httpbis-header-compression-12#section-5.1
#ifdef NDEBUG
static
#endif
int int
lsquic_hdec_dec_int (const unsigned char **src, const unsigned char *src_end, lsquic_hdec_dec_int (const unsigned char **src, const unsigned char *src_end,
uint8_t prefix_bits, uint32_t *value) 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 //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, hdec_dec_str (unsigned char *dst, size_t dst_len, const unsigned char **src,
const unsigned char *src_end) const unsigned char *src_end)
{ {
@ -244,6 +250,9 @@ hdec_get_table_entry (struct lsquic_hdec *dec, uint32_t index)
} }
#ifdef NDEBUG
static
#endif
int int
lsquic_hdec_push_entry (struct lsquic_hdec *dec, const char *name, lsquic_hdec_push_entry (struct lsquic_hdec *dec, const char *name,
uint16_t name_len, const char *val, uint16_t val_len) uint16_t name_len, const char *val, uint16_t val_len)

View file

@ -45,13 +45,14 @@ lsquic_hdec_set_max_capacity (struct lsquic_hdec *, unsigned);
size_t size_t
lsquic_hdec_mem_used (const struct lsquic_hdec *); lsquic_hdec_mem_used (const struct lsquic_hdec *);
#ifndef NDEBUG
int int
lsquic_hdec_dec_int (const unsigned char **src, const unsigned char *src_end, lsquic_hdec_dec_int (const unsigned char **src, const unsigned char *src_end,
uint8_t prefix_bits, uint32_t *value); uint8_t prefix_bits, uint32_t *value);
int int
lsquic_hdec_push_entry (struct lsquic_hdec *dec, const char *name, lsquic_hdec_push_entry (struct lsquic_hdec *dec, const char *name,
hpack_strlen_t name_len, const char *val, hpack_strlen_t name_len, const char *val,
hpack_strlen_t val_len); hpack_strlen_t val_len);
#endif
#endif #endif

View file

@ -92,6 +92,9 @@ lsquic_henc_cleanup (struct lsquic_henc *enc)
//not find return 0, otherwise return the index //not find return 0, otherwise return the index
#ifdef NDEBUG
static
#endif
unsigned unsigned
lsquic_henc_get_stx_tab_id (const char *name, hpack_strlen_t name_len, 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) 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, henc_huffman_enc (const unsigned char *src, const unsigned char *const src_end,
unsigned char *dst, int dst_len) unsigned char *dst, int dst_len)
{ {
@ -556,6 +562,9 @@ henc_huffman_enc (const unsigned char *src, const unsigned char *const src_end,
} }
#ifdef NDEBUG
static
#endif
int int
lsquic_henc_enc_str (unsigned char *const dst, size_t dst_len, lsquic_henc_enc_str (unsigned char *const dst, size_t dst_len,
const unsigned char *str, hpack_strlen_t str_len) const unsigned char *str, hpack_strlen_t str_len)
@ -702,6 +711,9 @@ henc_grow_tables (struct lsquic_henc *enc)
return 0; return 0;
} }
#ifdef NDEBUG
static
#endif
int int
lsquic_henc_push_entry (struct lsquic_henc *enc, const char *name, lsquic_henc_push_entry (struct lsquic_henc *enc, const char *name,
hpack_strlen_t name_len, const char *value, hpack_strlen_t name_len, const char *value,
@ -819,7 +831,7 @@ lsquic_henc_set_max_capacity (struct lsquic_henc *enc, unsigned max_capacity)
henc_remove_overflow_entries(enc); henc_remove_overflow_entries(enc);
} }
#ifndef NDEBUG
void void
lsquic_henc_iter_reset (struct lsquic_henc *enc) 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); retval->entry_id = henc_calc_table_id(enc, entry);
return 0; return 0;
} }
#endif
size_t size_t
lsquic_henc_mem_used (const struct lsquic_henc *enc) lsquic_henc_mem_used (const struct lsquic_henc *enc)

View file

@ -10,6 +10,7 @@
struct enc_table_entry; struct enc_table_entry;
#ifndef NDEBUG
struct enc_dyn_table_entry struct enc_dyn_table_entry
{ {
const char *name, /* Not NUL-terminated */ const char *name, /* Not NUL-terminated */
@ -18,6 +19,7 @@ struct enc_dyn_table_entry
value_len; value_len;
unsigned entry_id; unsigned entry_id;
}; };
#endif
STAILQ_HEAD(enc_head, enc_table_entry); STAILQ_HEAD(enc_head, enc_table_entry);
struct double_enc_head; struct double_enc_head;
@ -42,8 +44,10 @@ struct lsquic_henc
struct enc_head hpe_all_entries; struct enc_head hpe_all_entries;
struct double_enc_head struct double_enc_head
*hpe_buckets; *hpe_buckets;
#ifndef NDEBUG
const struct enc_table_entry const struct enc_table_entry
*hpe_iter; *hpe_iter;
#endif
}; };
@ -79,6 +83,7 @@ lsquic_henc_set_max_capacity (struct lsquic_henc *, unsigned);
size_t size_t
lsquic_henc_mem_used (const struct lsquic_henc *); lsquic_henc_mem_used (const struct lsquic_henc *);
#ifndef NDEBUG
unsigned unsigned
lsquic_henc_get_stx_tab_id (const char *name, hpack_strlen_t name_len, 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); 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 */ /* Returns 0 if entry is found */
int int
lsquic_henc_iter_next (struct lsquic_henc *enc, struct enc_dyn_table_entry *); lsquic_henc_iter_next (struct lsquic_henc *enc, struct enc_dyn_table_entry *);
#endif
#endif #endif

View file

@ -143,6 +143,7 @@ struct parse_funcs
uint16_t *reason_length, const char **reason); uint16_t *reason_length, const char **reason);
int int
(*pf_gen_ping_frame) (unsigned char *buf, int buf_len); (*pf_gen_ping_frame) (unsigned char *buf, int buf_len);
#ifndef NDEBUG
/* These float reading and writing functions assume `mem' has at least /* These float reading and writing functions assume `mem' has at least
* 2 bytes. * 2 bytes.
*/ */
@ -150,6 +151,7 @@ struct parse_funcs
(*pf_write_float_time16) (lsquic_time_t time_us, void *mem); (*pf_write_float_time16) (lsquic_time_t time_us, void *mem);
uint64_t uint64_t
(*pf_read_float_time16) (const void *mem); (*pf_read_float_time16) (const void *mem);
#endif
size_t size_t
(*pf_calc_stream_frame_header_sz) (uint32_t stream_id, uint64_t offset); (*pf_calc_stream_frame_header_sz) (uint32_t stream_id, uint64_t offset);
void void