diff options
author | Werner Koch <[email protected]> | 2018-10-15 09:32:19 +0000 |
---|---|---|
committer | Werner Koch <[email protected]> | 2018-11-05 08:19:13 +0000 |
commit | d5f540e7a9b3a723ba787e3a587fcd1b0948f105 (patch) | |
tree | 4d1db7bd8f417a73c198f5ae92a64367a7d8603c /tools/rfc822parse.h | |
parent | gpg: Don't take the a TOFU trust model from the trustdb, (diff) | |
download | gnupg-d5f540e7a9b3a723ba787e3a587fcd1b0948f105.tar.gz gnupg-d5f540e7a9b3a723ba787e3a587fcd1b0948f105.zip |
tools: Replace duplicated code in mime-maker.
* tools/rfc822parse.c (HEADER_NAME_CHARS): New. Taken from
mime-maker.c.
(rfc822_valid_header_name_p): New. Based on code from mime-maker.c.
(rfc822_capitalize_header_name): New. Copied from mime-maker.c.
(capitalize_header_name): Remove. Replace calls by new func.
(my_toupper, my_strcasecmp): New.
* tools/mime-maker.c: Include rfc822parse.h.
(HEADER_NAME_CHARS, capitalize_header_name): Remove.
(add_header): Replace check and capitalization by new functions.
--
This is a straightforward change with two minor chnages:
- In rfc822parse.c the capitalization handles MIME-Version special.
- The check in mime-maker bow detects a zero-length name as invalid.
my_toupper and my_strcasecmp are introduced to allow standalone use
of that file.
Signed-off-by: Werner Koch <[email protected]>
(cherry picked from commit f03928b16c4fb00077d22d8ec141575ef6d26913)
Diffstat (limited to 'tools/rfc822parse.h')
-rw-r--r-- | tools/rfc822parse.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/tools/rfc822parse.h b/tools/rfc822parse.h index 177d8271a..e2f2bedac 100644 --- a/tools/rfc822parse.h +++ b/tools/rfc822parse.h @@ -48,6 +48,8 @@ typedef int (*rfc822parse_cb_t) (void *opaque, rfc822parse_event_t event, rfc822parse_t msg); +int rfc822_valid_header_name_p (const char *name); +void rfc822_capitalize_header_name (char *name); rfc822parse_t rfc822parse_open (rfc822parse_cb_t cb, void *opaque_value); |