source@mandoc.bsd.lv
 help / color / mirror / Atom feed
From: kristaps@mdocml.bsd.lv
To: source@mdocml.bsd.lv
Subject: texi2mdoc: Don't print out defindex tokens--just save them.
Date: Thu, 5 Mar 2015 03:19:26 -0500 (EST)	[thread overview]
Message-ID: <16672372192787029914.enqueue@fantadrom.bsd.lv> (raw)

Log Message:
-----------
Don't print out defindex tokens--just save them.

Modified Files:
--------------
    texi2mdoc:
        main.c

Revision Data
-------------
Index: main.c
===================================================================
RCS file: /home/cvs/mdocml/texi2mdoc/main.c,v
retrieving revision 1.59
retrieving revision 1.60
diff -Lmain.c -Lmain.c -u -p -r1.59 -r1.60
--- main.c
+++ main.c
@@ -342,6 +342,12 @@ static	const struct texitok __texitoks[T
 
 const	struct texitok *const texitoks = __texitoks;
 
+/*
+ * Texinfo has lots of indexes.
+ * You can add new ones in a variety of ways.
+ * We maintain an array of all of these index names (usually a few
+ * letters) and pass unknown commands through the array list.
+ */
 static void
 dodefindex(struct texi *p, enum texicmd cmd, size_t *pos)
 {
@@ -350,7 +356,6 @@ dodefindex(struct texi *p, enum texicmd 
 
 	while (*pos < BUFSZ(p) && isws(BUF(p)[*pos]))
 		advance(p, pos);
-
 	start = end = *pos;
 	while (end < BUFSZ(p) && ! ismspace(BUF(p)[end]))
 		end++;
@@ -358,18 +363,21 @@ dodefindex(struct texi *p, enum texicmd 
 	if (start == end) {
 		advanceeoln(p, pos, 1);
 		return;
-	} else if (NULL == (cp = malloc(end - start + 1)))
+	} 
+	
+	if (NULL == (cp = malloc(end - start + 1)))
 		texiabort(p, NULL);
-
 	memcpy(cp, &BUF(p)[start], end - start);
 	cp[end - start] = '\0';
 
+	/* FIXME: use reallocarray(). */
 	p->indexs = realloc(p->indexs, 
 		sizeof(char *) * (p->indexsz + 1));
-
 	if (NULL == p->indexs)
 		texiabort(p, NULL);
 	p->indexs[p->indexsz++] = cp;
+
+	advanceeoln(p, pos, 1);
 }
 
 static void
--
 To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv

                 reply	other threads:[~2015-03-05  8:19 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=16672372192787029914.enqueue@fantadrom.bsd.lv \
    --to=kristaps@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).