=================================================================== RCS file: /cvs/mandoc/Attic/mdoc_action.c,v retrieving revision 1.52 retrieving revision 1.56 diff -u -p -r1.52 -r1.56 --- mandoc/Attic/mdoc_action.c 2010/04/05 09:03:12 1.52 +++ mandoc/Attic/mdoc_action.c 2010/05/14 15:26:39 1.56 @@ -1,4 +1,4 @@ -/* $Id: mdoc_action.c,v 1.52 2010/04/05 09:03:12 kristaps Exp $ */ +/* $Id: mdoc_action.c,v 1.56 2010/05/14 15:26:39 kristaps Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons * @@ -44,7 +44,7 @@ struct actions { static int concat(struct mdoc *, char *, const struct mdoc_node *, size_t); -static inline int order_rs(int); +static inline int order_rs(enum mdoct); static int post_ar(POST_ARGS); static int post_at(POST_ARGS); @@ -196,7 +196,7 @@ static const struct actions mdoc_actions[MDOC_MAX] = { #define RSORD_MAX 14 -static const int rsord[RSORD_MAX] = { +static const enum mdoct rsord[RSORD_MAX] = { MDOC__A, MDOC__T, MDOC__B, @@ -366,9 +366,10 @@ post_st(POST_ARGS) assert(MDOC_TEXT == n->child->type); p = mdoc_a2st(n->child->string); - assert(p); - free(n->child->string); - n->child->string = mandoc_strdup(p); + if (p != NULL) { + free(n->child->string); + n->child->string = mandoc_strdup(p); + } return(1); } @@ -419,7 +420,7 @@ post_sh(POST_ARGS) if ( ! concat(m, buf, n->child, BUFSIZ)) return(0); - sec = mdoc_atosec(buf); + sec = mdoc_str2sec(buf); /* * The first section should always make us move into a non-new * state. @@ -729,7 +730,7 @@ post_bl_head(POST_ARGS) nn->string = NULL; nnp = nn; nn = nn->next; - mdoc_node_free(nnp); + mdoc_node_delete(NULL, nnp); } n->nchild = 0; @@ -854,29 +855,10 @@ post_dd(POST_ARGS) static int post_prol(POST_ARGS) { - struct mdoc_node *np; - if (n->parent->child == n) - n->parent->child = n->prev; - if (n->prev) - n->prev->next = NULL; - - np = n; - assert(NULL == n->next); - - if (n->prev) { - m->last = n->prev; - m->next = MDOC_NEXT_SIBLING; - } else { - m->last = n->parent; - m->next = MDOC_NEXT_CHILD; - } - - mdoc_node_freelist(np); - + mdoc_node_delete(m, n); if (m->meta.title && m->meta.date && m->meta.os) m->flags |= MDOC_PBODY; - return(1); } @@ -964,11 +946,11 @@ post_display(POST_ARGS) static inline int -order_rs(int t) +order_rs(enum mdoct t) { int i; - for (i = 0; i < RSORD_MAX; i++) + for (i = 0; i < (int)RSORD_MAX; i++) if (rsord[i] == t) return(i);