[BACK]Return to html.c CVS log [TXT][DIR] Up to [cvsweb.bsd.lv] / mandoc

Diff for /mandoc/html.c between version 1.65 and 1.66

version 1.65, 2009/10/20 05:45:21 version 1.66, 2009/10/26 08:18:15
Line 15 
Line 15 
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.   * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */   */
 #include <sys/types.h>  #include <sys/types.h>
 #include <sys/queue.h>  
   
 #include <assert.h>  #include <assert.h>
 #include <err.h>  #include <err.h>
Line 102  html_alloc(char *outopts)
Line 101  html_alloc(char *outopts)
         if (NULL == (h = calloc(1, sizeof(struct html))))          if (NULL == (h = calloc(1, sizeof(struct html))))
                 return(NULL);                  return(NULL);
   
         SLIST_INIT(&h->tags);          h->tags.head = NULL;
         SLIST_INIT(&h->ords);          h->ords.head = NULL;
   
         if (NULL == (h->symtab = chars_init(CHARS_HTML))) {          if (NULL == (h->symtab = chars_init(CHARS_HTML))) {
                 free(h);                  free(h);
Line 138  html_free(void *p)
Line 137  html_free(void *p)
   
         h = (struct html *)p;          h = (struct html *)p;
   
         while ( ! SLIST_EMPTY(&h->ords)) {          while ((ord = h->ords.head) != NULL) {
                 ord = SLIST_FIRST(&h->ords);                  h->ords.head = ord->next;
                 SLIST_REMOVE_HEAD(&h->ords, entry);  
                 free(ord);                  free(ord);
         }          }
   
         while ( ! SLIST_EMPTY(&h->tags)) {          while ((tag = h->tags.head) != NULL) {
                 tag = SLIST_FIRST(&h->tags);                  h->tags.head = tag->next;
                 SLIST_REMOVE_HEAD(&h->tags, entry);  
                 free(tag);                  free(tag);
         }          }
   
Line 358  print_otag(struct html *h, enum htmltag tag, 
Line 355  print_otag(struct html *h, enum htmltag tag, 
                 if (NULL == (t = malloc(sizeof(struct tag))))                  if (NULL == (t = malloc(sizeof(struct tag))))
                         err(EXIT_FAILURE, "malloc");                          err(EXIT_FAILURE, "malloc");
                 t->tag = tag;                  t->tag = tag;
                 SLIST_INSERT_HEAD(&h->tags, t, entry);                  t->next = h->tags.head;
                   h->tags.head = t;
         } else          } else
                 t = NULL;                  t = NULL;
   
Line 468  print_tagq(struct html *h, const struct tag *until)
Line 466  print_tagq(struct html *h, const struct tag *until)
 {  {
         struct tag      *tag;          struct tag      *tag;
   
         while ( ! SLIST_EMPTY(&h->tags)) {          while ((tag = h->tags.head) != NULL) {
                 tag = SLIST_FIRST(&h->tags);  
                 print_ctag(h, tag->tag);                  print_ctag(h, tag->tag);
                 SLIST_REMOVE_HEAD(&h->tags, entry);                  h->tags.head = tag->next;
                 free(tag);                  free(tag);
                 if (until && tag == until)                  if (until && tag == until)
                         return;                          return;
Line 484  print_stagq(struct html *h, const struct tag *suntil)
Line 481  print_stagq(struct html *h, const struct tag *suntil)
 {  {
         struct tag      *tag;          struct tag      *tag;
   
         while ( ! SLIST_EMPTY(&h->tags)) {          while ((tag = h->tags.head) != NULL) {
                 tag = SLIST_FIRST(&h->tags);  
                 if (suntil && tag == suntil)                  if (suntil && tag == suntil)
                         return;                          return;
                 print_ctag(h, tag->tag);                  print_ctag(h, tag->tag);
                 SLIST_REMOVE_HEAD(&h->tags, entry);                  h->tags.head = tag->next;
                 free(tag);                  free(tag);
         }          }
 }  }

Legend:
Removed from v.1.65  
changed lines
  Added in v.1.66

CVSweb