diff options
author | Dan Winship <danw@src.gnome.org> | 2008-02-09 00:46:12 +0000 |
---|---|---|
committer | Dan Winship <danw@src.gnome.org> | 2008-02-09 00:46:12 +0000 |
commit | 801cefbcf058518a60360e1297c63b482e267655 (patch) | |
tree | 3fc9eee910e0c0994b0311dcf9d912a15c6359c2 /tests/header-parsing.c | |
parent | 0c890a53d6318c078cfd3edf19b4ee8aff05c124 (diff) | |
download | libsoup-801cefbcf058518a60360e1297c63b482e267655.tar.gz libsoup-801cefbcf058518a60360e1297c63b482e267655.tar.bz2 libsoup-801cefbcf058518a60360e1297c63b482e267655.zip |
Add an iterator type for SoupMessageHeaders.
* libsoup/soup-message-headers.c (SoupMessageHeadersIter)
(soup_message_headers_iter_init, soup_message_headers_iter_next):
Add an iterator type for SoupMessageHeaders.
* libsoup/soup-message-client-io.c (get_request_headers):
* libsoup/soup-message-server-io.c (get_response_headers): Use
SoupMessageHeadersIter.
* libsoup/soup-logger.c (print_request, print_response): Use
SoupMessageHeadersIter. And take advantage of the simplification
to fix the kludge where 'direction' was stored as a field in
SoupLoggerPrivate rather than being an argument to
soup_logger_print.
* tests/get.c (get_url):
* tests/header-parsing.c (check_headers):
* tests/simple-httpd.c (server_callback): Use
SoupMessageHeadersIter
svn path=/trunk/; revision=1079
Diffstat (limited to 'tests/header-parsing.c')
-rw-r--r-- | tests/header-parsing.c | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/tests/header-parsing.c b/tests/header-parsing.c index bae3c97e..237c4d14 100644 --- a/tests/header-parsing.c +++ b/tests/header-parsing.c @@ -577,25 +577,22 @@ print_header (const char *name, const char *value, gpointer data) debug_printf (1, " '%s': '%s'\n", name, value); } -static void -add_header_name (const char *name, const char *value, gpointer data) -{ - GSList **names = data; - - if (!g_slist_find_custom (*names, name, (GCompareFunc)strcmp)) - *names = g_slist_append (*names, (char *)name); -} - static gboolean check_headers (Header *headers, SoupMessageHeaders *hdrs) { GSList *header_names, *h; - const char *value; + SoupMessageHeadersIter iter; + const char *name, *value; gboolean ok = TRUE; int i; header_names = NULL; - soup_message_headers_foreach (hdrs, add_header_name, &header_names); + soup_message_headers_iter_init (&iter, hdrs); + while (soup_message_headers_iter_next (&iter, &name, &value)) { + if (!g_slist_find_custom (header_names, name, + (GCompareFunc)strcmp)) + header_names = g_slist_append (header_names, (char *)name); + } for (i = 0, h = header_names; headers[i].name && h; i++, h = h->next) { if (strcmp (h->data, headers[i].name) != 0) { |