From ddcabc1bfd528102c1474b7055fd6ea0c865adcf Mon Sep 17 00:00:00 2001 From: Daniel-Constantin Mierla Date: Wed, 22 Jul 2020 08:09:02 +0200 Subject: [PATCH] core: parse hdr name - removed unused defines - comments to describe indexing arrays --- src/core/parser/parse_hname2.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/core/parser/parse_hname2.c b/src/core/parser/parse_hname2.c index 70ed6adc577..5afae157696 100644 --- a/src/core/parser/parse_hname2.c +++ b/src/core/parser/parse_hname2.c @@ -145,12 +145,26 @@ typedef struct ksr_hdr_map_idx { } ksr_hdr_map_idx_t; #define KSR_HDR_MAP_IDX_SIZE 256 + +/** + * array to keep start and end indexes of header names groupped by first char + */ static ksr_hdr_map_idx_t _ksr_hdr_map_idx[KSR_HDR_MAP_IDX_SIZE]; +/** + * valid chars in header names + */ static char *_ksr_hname_chars_list = "0123456789AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz-._+~"; +/** + * indexed valid chars in 256-array for 1-byte-index access check + */ static char _ksr_hname_chars_idx[KSR_HDR_MAP_IDX_SIZE]; + +/** + * init header name parsing structures and indexes + */ int ksr_hname_init_index(void) { char c; @@ -181,10 +195,6 @@ int ksr_hname_init_index(void) return 0; } -#define LOWER_BYTE(b) ((b) | 0x20) -#define LOWER_DWORD(d) ((d) | 0x20202020) - - /** * parse the sip header name in the buffer starting at 'begin' till before 'end' * - fills hdr structure (must not be null)