diff options
author | Kristaps Dzonsons <kristaps@bsd.lv> | 2011-01-03 11:27:32 +0000 |
---|---|---|
committer | Kristaps Dzonsons <kristaps@bsd.lv> | 2011-01-03 11:27:32 +0000 |
commit | 1a43dd98e40e2bf465682b76c28bd1ea2fe90ac5 (patch) | |
tree | a1ce2cbd09419ea936477d7b7ac231d7e06bb2e4 /mdoc.3 | |
parent | 298f818bf95cddb04543ee3777a239b4d7a7fe6d (diff) | |
download | mandoc-1a43dd98e40e2bf465682b76c28bd1ea2fe90ac5.tar.gz mandoc-1a43dd98e40e2bf465682b76c28bd1ea2fe90ac5.tar.zst mandoc-1a43dd98e40e2bf465682b76c28bd1ea2fe90ac5.zip |
Clarified the role of MDOC_HALT in libmdoc functions by having accessor
functions assert() if they're called after MDOC_HALT is set.
This makes more sense than returning 0 because this return value is used
for parse errors, not programme-flow errors, and it's inconsistent to
use the same value for both. Plus, prior to this, I'd return 0 without
printing an error message, which would cause failure to go unreported to
the operator.
Diffstat (limited to 'mdoc.3')
-rw-r--r-- | mdoc.3 | 28 |
1 files changed, 14 insertions, 14 deletions
@@ -1,4 +1,4 @@ -.\" $Id: mdoc.3,v 1.52 2011/01/01 12:18:37 kristaps Exp $ +.\" $Id: mdoc.3,v 1.53 2011/01/03 11:27:32 kristaps Exp $ .\" .\" Copyright (c) 2009, 2010 Kristaps Dzonsons <kristaps@bsd.lv> .\" Copyright (c) 2010 Ingo Schwarze <schwarze@openbsd.org> @@ -15,7 +15,7 @@ .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" -.Dd $Mdocdate: January 1 2011 $ +.Dd $Mdocdate: January 3 2011 $ .Dt MDOC 3 .Os .Sh NAME @@ -96,6 +96,16 @@ See for details. .El .Ss Functions +If +.Fn mdoc_addspan , +.Fn mdoc_parseln , +or +.Fn mdoc_endparse +return 0, calls to any function but +.Fn mdoc_reset +or +.Fn mdoc_free +will raise an assertion. .Bl -ohang .It Fn mdoc_addspan Add a table span to the parsing stream. @@ -106,8 +116,8 @@ The .Fa data pointer is passed to .Fa msgs . -Returns NULL on failure. -If non-NULL, the pointer must be freed with +Always returns a valid pointer. +The pointer must be freed with .Fn mdoc_free . .It Fn mdoc_reset Reset the parser for another parse routine. @@ -135,18 +145,8 @@ the resulting tree is incomplete. Returns 0 on failure, 1 on success. .It Fn mdoc_node Returns the first node of the parse. -Note that if -.Fn mdoc_parseln -or -.Fn mdoc_endparse -return 0, the tree will be incomplete. .It Fn mdoc_meta Returns the document's parsed meta-data. -If this information has not yet been supplied or -.Fn mdoc_parseln -or -.Fn mdoc_endparse -return 0, the data will be incomplete. .El .Ss Variables .Bl -ohang |