source@mandoc.bsd.lv
 help / color / mirror / Atom feed
From: schwarze@mdocml.bsd.lv
To: source@mdocml.bsd.lv
Subject: mdocml: Unify description handling across all document types (mdoc, man,
Date: Sun, 13 Apr 2014 18:03:04 -0400 (EDT)	[thread overview]
Message-ID: <201404132203.s3DM347P017182@krisdoz.my.domain> (raw)

Log Message:
-----------
Unify description handling across all document types (mdoc, man, cat).
Assert that the description is unset right before calling the parse_*
handler, and assign a default if it's still unset right afterwards.
Remove all stray asserts and default assignments found elsewhere.

This fixes SQL_STEP failures for man(7) pages lacking descriptions.

Modified Files:
--------------
    mdocml:
        mandocdb.c

Revision Data
-------------
Index: mandocdb.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mandocdb.c,v
retrieving revision 1.134
retrieving revision 1.135
diff -Lmandocdb.c -Lmandocdb.c -u -p -r1.134 -r1.135
--- mandocdb.c
+++ mandocdb.c
@@ -1154,18 +1154,17 @@ mpages_merge(struct mchars *mc, struct m
 			putkey(mpage, mlink->name, NAME_FILE);
 		}
 
+		assert(NULL == mpage->desc);
 		if (NULL != mdoc) {
 			if (NULL != (cp = mdoc_meta(mdoc)->name))
 				putkey(mpage, cp, NAME_HEAD);
-			assert(NULL == mpage->desc);
 			parse_mdoc(mpage, mdoc_node(mdoc));
-			if (NULL == mpage->desc)
-				mpage->desc = mandoc_strdup(
-				    mpage->mlinks->name);
 		} else if (NULL != man)
 			parse_man(mpage, man_node(man));
 		else
 			parse_cat(mpage, fd[0]);
+		if (NULL == mpage->desc)
+			mpage->desc = mandoc_strdup(mpage->mlinks->name);
 
 		if (warnings && !use_all)
 			for (mlink = mpage->mlinks; mlink;
@@ -1302,8 +1301,6 @@ parse_cat(struct mpage *mpage, int fd)
 		if (warnings)
 			say(mpage->mlinks->file,
 			    "Cannot find NAME section");
-		assert(NULL == mpage->desc);
-		mpage->desc = mandoc_strdup(mpage->mlinks->name);
 		fclose(stream);
 		free(title);
 		return;
@@ -1342,7 +1339,6 @@ parse_cat(struct mpage *mpage, int fd)
 		plen -= 2;
 	}
 
-	assert(NULL == mpage->desc);
 	mpage->desc = mandoc_strdup(p);
 	fclose(stream);
 	free(title);
@@ -1482,7 +1478,6 @@ parse_man(struct mpage *mpage, const str
 			while (' ' == *start)
 				start++;
 
-			assert(NULL == mpage->desc);
 			mpage->desc = mandoc_strdup(start);
 			free(title);
 			return;
--
 To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv

                 reply	other threads:[~2014-04-13 22:03 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201404132203.s3DM347P017182@krisdoz.my.domain \
    --to=schwarze@mdocml.bsd.lv \
    --cc=source@mdocml.bsd.lv \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).