Commit 3ae03fb5 authored by Pekka Pessi's avatar Pekka Pessi
Browse files

msg_parser_util.c: fixed msg_header_find_item().

darcs-hash:20061031200332-65a35-9e4fcf0cc7c0ffd5f6a6945328948984feb775f3.gz
parent 9637cbb8
...@@ -1104,12 +1104,14 @@ int msg_header_update_params(msg_common_t *h, int clear) ...@@ -1104,12 +1104,14 @@ int msg_header_update_params(msg_common_t *h, int clear)
char const *msg_header_find_item(msg_common_t const *h, char const *item) char const *msg_header_find_item(msg_common_t const *h, char const *item)
{ {
if (h && h->h_class->hc_params) { if (h && h->h_class->hc_params) {
msg_param_t const **params = (msg_param_t const **) char const * const * items =
*(char const * const * const *)
((char *)h + h->h_class->hc_params); ((char *)h + h->h_class->hc_params);
for (; *params; params++) { if (items)
if (strcmp(item, *params) == 0) { for (; *items; items++) {
return *params; if (strcmp(item, *items) == 0) {
return *items;
} }
} }
} }
......
...@@ -468,6 +468,7 @@ int test_header_parsing(void) ...@@ -468,6 +468,7 @@ int test_header_parsing(void)
ce = msg_content_encoding_make(home, "zip, zap, zup, lz, zl, zz, ll"); ce = msg_content_encoding_make(home, "zip, zap, zup, lz, zl, zz, ll");
TEST_1(ce); TEST_1(ce);
TEST_S(msg_header_find_param(ce->k_common, "zz"), ""); TEST_S(msg_header_find_param(ce->k_common, "zz"), "");
TEST_S(msg_header_find_item(ce->k_common, "zz"), "zz");
TEST(msg_header_find_param(ce->k_common, "k"), NULL); TEST(msg_header_find_param(ce->k_common, "k"), NULL);
TEST(msg_header_add_param(home, ce->k_common, "zip"), 0); TEST(msg_header_add_param(home, ce->k_common, "zip"), 0);
TEST(msg_header_remove_param(ce->k_common, "zip"), 1); TEST(msg_header_remove_param(ce->k_common, "zip"), 1);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment