texinfo-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[7528] parsetexi convert macrobody only once


From: gavinsmith0123
Subject: [7528] parsetexi convert macrobody only once
Date: Mon, 21 Nov 2016 16:56:48 +0000 (UTC)

Revision: 7528
          http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=7528
Author:   gavin
Date:     2016-11-21 16:56:48 +0000 (Mon, 21 Nov 2016)
Log Message:
-----------
parsetexi convert macrobody only once

Modified Paths:
--------------
    trunk/tp/parsetexi/macro.c
    trunk/tp/parsetexi/tree_types.h

Modified: trunk/tp/parsetexi/macro.c
===================================================================
--- trunk/tp/parsetexi/macro.c  2016-11-21 16:48:08 UTC (rev 7527)
+++ trunk/tp/parsetexi/macro.c  2016-11-21 16:56:48 UTC (rev 7528)
@@ -38,6 +38,7 @@
 {
   enum command_id new;
   MACRO *m = 0;
+  ELEMENT tmp;
 
   /* Check for an existing definition first for us to overwrite. */
   new = lookup_command (name);
@@ -60,8 +61,12 @@
       user_defined_command_data[new].flags |= CF_MACRO;
     }
 
-  m->macro_name = name; /* strdup ? */
+  m->macro_name = strdup (name);
   m->element = macro;
+
+  memset (&tmp, 0, sizeof (ELEMENT));
+  tmp.contents = macro->contents;
+  m->macrobody = convert_to_texinfo (&tmp);
 }
 
 // 1088
@@ -364,18 +369,18 @@
 /* ARGUMENTS are the arguments used in the macro invocation.  EXPANDED gets 
the 
    result of the expansion. */
 static void
-expand_macro_body (ELEMENT *macro, char *arguments[], TEXT *expanded)
+expand_macro_body (MACRO *macro_record, char *arguments[], TEXT *expanded)
 {
   char *arg;
   int pos; /* Index into arguments. */
   int i; /* Index into macro contents. */
+  ELEMENT *macro;
   char *macrobody;
-  ELEMENT tmp;
   char *ptext;
 
-  memset (&tmp, 0, sizeof (ELEMENT));
-  tmp.contents = macro->contents;
-  macrobody = convert_to_texinfo (&tmp);
+  macro = macro_record->element;
+
+  macrobody = macro_record->macrobody;
   
   /* Initialize TEXT object. */
   expanded->end = 0;
@@ -537,7 +542,7 @@
         }
     }
 
-  expand_macro_body (macro, arguments, &expanded);
+  expand_macro_body (macro_record, arguments, &expanded);
   debug ("MACROBODY: %s||||||", expanded.text);
 
   if (expanded.end > 0 && expanded.text[expanded.end - 1] == '\n')

Modified: trunk/tp/parsetexi/tree_types.h
===================================================================
--- trunk/tp/parsetexi/tree_types.h     2016-11-21 16:48:08 UTC (rev 7527)
+++ trunk/tp/parsetexi/tree_types.h     2016-11-21 16:56:48 UTC (rev 7528)
@@ -221,6 +221,7 @@
     char *macro_name;
     ELEMENT *element;
     enum command_id cmd;
+    char *macrobody;
 } MACRO;
 
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]