source@mandoc.bsd.lv
 help / color / mirror / Atom feed
* mdocml: quoted words are not parsed for defined keys
@ 2017-06-21 18:38 schwarze
  0 siblings, 0 replies; only message in thread
From: schwarze @ 2017-06-21 18:38 UTC (permalink / raw)
  To: source

Log Message:
-----------
quoted words are not parsed for defined keys

Modified Files:
--------------
    mdocml:
        eqn.c

Revision Data
-------------
Index: eqn.c
===================================================================
RCS file: /home/cvs/mdocml/mdocml/eqn.c,v
retrieving revision 1.64
retrieving revision 1.65
diff -Leqn.c -Leqn.c -u -p -r1.64 -r1.65
--- eqn.c
+++ eqn.c
@@ -523,6 +523,14 @@ eqn_tok_parse(struct eqn_node *ep, char 
 		if (STRNEQ(start, sz, eqn_toks[i], strlen(eqn_toks[i])))
 			return i;
 
+	for (i = 0; i < EQNSYM__MAX; i++) {
+		if (STRNEQ(start, sz,
+		    eqnsyms[i].str, strlen(eqnsyms[i].str))) {
+			mandoc_asprintf(p, "\\[%s]", eqnsyms[i].sym);
+			return EQN_TOK__MAX;
+		}
+	}
+
 	if (p != NULL)
 		*p = mandoc_strndup(start, sz);
 
@@ -713,7 +721,7 @@ eqn_parse(struct eqn_node *ep, struct eq
 	struct eqn_box	*cur;
 	const char	*start;
 	char		*p;
-	size_t		 i, sz;
+	size_t		 sz;
 	enum eqn_tok	 tok, subtok;
 	enum eqn_post	 pos;
 	int		 size;
@@ -1097,17 +1105,8 @@ this_tok:
 		}
 		cur = eqn_box_alloc(ep, parent);
 		cur->type = EQN_TEXT;
-		for (i = 0; i < EQNSYM__MAX; i++)
-			if (0 == strcmp(eqnsyms[i].str, p)) {
-				(void)snprintf(sym, sizeof(sym),
-					"\\[%s]", eqnsyms[i].sym);
-				cur->text = mandoc_strdup(sym);
-				free(p);
-				break;
-			}
+		cur->text = p;
 
-		if (i == EQNSYM__MAX)
-			cur->text = p;
 		/*
 		 * Post-process list status.
 		 */
--
 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:[~2017-06-21 18:38 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-21 18:38 mdocml: quoted words are not parsed for defined keys 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).