=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/mandoc/html.c,v retrieving revision 1.1 retrieving revision 1.2 diff -c -r1.1 -r1.2 *** src/usr.bin/mandoc/html.c 2009/10/21 19:13:50 1.1 --- src/usr.bin/mandoc/html.c 2009/10/27 21:40:07 1.2 *************** *** 1,4 **** ! /* $Id: html.c,v 1.1 2009/10/21 19:13:50 schwarze Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons * --- 1,4 ---- ! /* $Id: html.c,v 1.2 2009/10/27 21:40:07 schwarze Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons * *************** *** 15,21 **** * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #include - #include #include #include --- 15,20 ---- *************** *** 98,105 **** if (NULL == (h = calloc(1, sizeof(struct html)))) return(NULL); ! SLIST_INIT(&h->tags); ! SLIST_INIT(&h->ords); if (NULL == (h->symtab = chars_init(CHARS_HTML))) { free(h); --- 97,104 ---- if (NULL == (h = calloc(1, sizeof(struct html)))) return(NULL); ! h->tags.head = NULL; ! h->ords.head = NULL; if (NULL == (h->symtab = chars_init(CHARS_HTML))) { free(h); *************** *** 134,148 **** h = (struct html *)p; ! while ( ! SLIST_EMPTY(&h->ords)) { ! ord = SLIST_FIRST(&h->ords); ! SLIST_REMOVE_HEAD(&h->ords, entry); free(ord); } ! while ( ! SLIST_EMPTY(&h->tags)) { ! tag = SLIST_FIRST(&h->tags); ! SLIST_REMOVE_HEAD(&h->tags, entry); free(tag); } --- 133,145 ---- h = (struct html *)p; ! while ((ord = h->ords.head) != NULL) { ! h->ords.head = ord->next; free(ord); } ! while ((tag = h->tags.head) != NULL) { ! h->tags.head = tag->next; free(tag); } *************** *** 354,360 **** if (NULL == (t = malloc(sizeof(struct tag)))) err(EXIT_FAILURE, "malloc"); t->tag = tag; ! SLIST_INSERT_HEAD(&h->tags, t, entry); } else t = NULL; --- 351,358 ---- if (NULL == (t = malloc(sizeof(struct tag)))) err(EXIT_FAILURE, "malloc"); t->tag = tag; ! t->next = h->tags.head; ! h->tags.head = t; } else t = NULL; *************** *** 464,473 **** { struct tag *tag; ! while ( ! SLIST_EMPTY(&h->tags)) { ! tag = SLIST_FIRST(&h->tags); print_ctag(h, tag->tag); ! SLIST_REMOVE_HEAD(&h->tags, entry); free(tag); if (until && tag == until) return; --- 462,470 ---- { struct tag *tag; ! while ((tag = h->tags.head) != NULL) { print_ctag(h, tag->tag); ! h->tags.head = tag->next; free(tag); if (until && tag == until) return; *************** *** 480,491 **** { struct tag *tag; ! while ( ! SLIST_EMPTY(&h->tags)) { ! tag = SLIST_FIRST(&h->tags); if (suntil && tag == suntil) return; print_ctag(h, tag->tag); ! SLIST_REMOVE_HEAD(&h->tags, entry); free(tag); } } --- 477,487 ---- { struct tag *tag; ! while ((tag = h->tags.head) != NULL) { if (suntil && tag == suntil) return; print_ctag(h, tag->tag); ! h->tags.head = tag->next; free(tag); } }