source@mandoc.bsd.lv
 help / color / mirror / Atom feed
* mdocml: Unify description handling across all document types (mdoc, man,
@ 2014-04-13 22:03 schwarze
  0 siblings, 0 replies; only message in thread
From: schwarze @ 2014-04-13 22:03 UTC (permalink / raw)
  To: source

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2014-04-13 22:03 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-13 22:03 mdocml: Unify description handling across all document types (mdoc, man, schwarze

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).