CVSROOT:        /cvs
Module name:    src
Changes by:     schwa...@cvs.openbsd.org        2015/02/12 05:20:47

Modified files:
        usr.bin/mandoc : mdoc.c mdoc.h mdoc_html.c mdoc_macro.c 
                         mdoc_man.c mdoc_term.c mdoc_validate.c 
        regress/usr.bin/mandoc/mdoc/Bl: broken.in broken.out_ascii 
                                        broken.out_lint 

Log message:
Delete the mdoc_node.pending pointer and the function calculating
it, make_pending(), which was the most difficult function of the
whole mdoc(7) parser.  After almost five years of maintaining this
hellhole, i just noticed the pointer isn't needed after all.

Blocks are always rewound in the reverse order they were opened;
that even holds for broken blocks.  Consequently, it is sufficient
to just mark broken blogs with the flag MDOC_BROKEN and breaking
blocks with the flag MDOC_ENDED.  When rewinding, instead of iterating
the pending pointers, just iterate from each broken block to its
parents, rewinding all that are MDOC_ENDED and stopping after
processing the first ancestor that it not MDOC_BROKEN.  For ENDBODY
markers, use the mdoc_node.body pointer in place of the former
mdoc_node.pending.

This also fixes an assertion failure found by jsg@ with afl,
test case #467 (Bo Bl It Bd Bc It), where (surprise surprise)
the pending pointer got corrupted.

Improved functionality, minus one function, minus one struct field,
minus 50 lines of code.

Reply via email to