source@mandoc.bsd.lv
 help / color / mirror / Atom feed
* mdocml: When reading back a mandoc.db(5) file in order to apply
@ 2016-08-17 19:00 schwarze
  0 siblings, 0 replies; only message in thread
From: schwarze @ 2016-08-17 19:00 UTC (permalink / raw)
  To: source

Log Message:
-----------
When reading back a mandoc.db(5) file in order to apply incremental
changes, do not prepend a stray NAME_FILE (0x10) byte to the first
names of pages.
Bug found while investigating another issue reported by sthen@.

Modified Files:
--------------
    mdocml:
        dba.c
        dba_read.c

Revision Data
-------------
Index: dba_read.c
===================================================================
RCS file: /home/cvs/mdocml/mdocml/dba_read.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -Ldba_read.c -Ldba_read.c -u -p -r1.2 -r1.3
--- dba_read.c
+++ dba_read.c
@@ -48,10 +48,9 @@ dba_read(const char *fname)
 	dba = dba_new(npages < 128 ? 128 : npages);
 	for (ip = 0; ip < npages; ip++) {
 		pdata = dbm_page_get(ip);
-		page = dba_page_new(dba->pages, pdata->name, pdata->sect,
+		page = dba_page_new(dba->pages, NULL, pdata->sect,
 		    pdata->arch, pdata->desc, pdata->file + 1, *pdata->file);
-		cp = pdata->name;
-		while (*(cp = strchr(cp, '\0') + 1) != '\0')
+		for (cp = pdata->name; *cp != '\0'; cp = strchr(cp, '\0') + 1)
 			dba_page_add(page, DBP_NAME, cp);
 		cp = pdata->sect;
 		while (*(cp = strchr(cp, '\0') + 1) != '\0')
Index: dba.c
===================================================================
RCS file: /home/cvs/mdocml/mdocml/dba.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -Ldba.c -Ldba.c -u -p -r1.6 -r1.7
--- dba.c
+++ dba.c
@@ -143,7 +143,8 @@ dba_page_new(struct dba_array *pages, co
 
 	page = dba_array_new(DBP_MAX, 0);
 	entry = dba_array_new(1, DBA_STR | DBA_GROW);
-	dba_array_add(entry, prepend(name, NAME_FILE & NAME_MASK));
+	if (name != NULL)
+		dba_array_add(entry, prepend(name, NAME_FILE & NAME_MASK));
 	dba_array_add(page, entry);
 	entry = dba_array_new(1, DBA_STR | DBA_GROW);
 	dba_array_add(entry, (void *)sect);
--
 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:[~2016-08-17 19:00 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-17 19:00 mdocml: When reading back a mandoc.db(5) file in order to apply 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).