bison-patches
[Top][All Lists]
Advanced

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

xml_escape fixes


From: Joel E. Denny
Subject: xml_escape fixes
Date: Sat, 29 Sep 2007 18:37:05 -0400 (EDT)

I committed this.

Index: ChangeLog
===================================================================
RCS file: /sources/bison/bison/ChangeLog,v
retrieving revision 1.1729
diff -p -u -r1.1729 ChangeLog
--- ChangeLog   25 Sep 2007 05:47:25 -0000      1.1729
+++ ChangeLog   29 Sep 2007 22:30:51 -0000
@@ -1,3 +1,11 @@
+2007-09-29  Joel E. Denny  <address@hidden>
+
+       * src/print-xml.c (escape_bufs): New static global variable
+       replacing...
+       (xml_escape_n): ... the static local variable buf here.
+       (print_xml): Free memory for escape_bufs.
+       * src/reduce.c (reduce_xml): XML-escape terminal symbol tags.
+
 2007-09-25  Joel E. Denny  <address@hidden>
 
        Replace `%push-parser' and `%push-pull-parser' with
Index: src/print-xml.c
===================================================================
RCS file: /sources/bison/bison/src/print-xml.c,v
retrieving revision 1.3
diff -p -u -r1.3 print-xml.c
--- src/print-xml.c     24 Sep 2007 06:34:44 -0000      1.3
+++ src/print-xml.c     29 Sep 2007 22:30:58 -0000
@@ -43,6 +43,12 @@
 #include "tables.h"
 
 static bitset no_reduce_set;
+struct escape_buf
+{
+  char *ptr;
+  size_t size;
+};
+static struct escape_buf escape_bufs[2];
 
 
 /*----------------------------.
@@ -516,12 +522,6 @@ xml_printf (FILE *out, int level, char c
   fputc ('\n', out);
 }
 
-struct escape_buf
-{
-  char *ptr;
-  size_t size;
-};
-
 static char const *
 xml_escape_string (struct escape_buf *buf, char const *str)
 {
@@ -553,8 +553,7 @@ xml_escape_string (struct escape_buf *bu
 char const *
 xml_escape_n (int n, char const *str)
 {
-  static struct escape_buf buf[2];
-  return xml_escape_string (buf + n, str);
+  return xml_escape_string (escape_bufs + n, str);
 }
 
 char const *
@@ -608,5 +607,8 @@ print_xml (void)
 
   xml_puts (out, 0, "</bison-xml-report>");
 
+  free (escape_bufs[0].ptr);
+  free (escape_bufs[1].ptr);
+
   xfclose (out);
 }
Index: src/reduce.c
===================================================================
RCS file: /sources/bison/bison/src/reduce.c,v
retrieving revision 1.91
diff -p -u -r1.91 reduce.c
--- src/reduce.c        21 Sep 2007 22:53:57 -0000      1.91
+++ src/reduce.c        29 Sep 2007 22:30:58 -0000
@@ -418,7 +418,7 @@ reduce_xml (FILE *out, int level)
          b = true;
          xml_printf (out, level + 3,
                      "<terminal>%s</terminal>",
-                     symbols[i]->tag);
+                     xml_escape (symbols[i]->tag));
        }
     if (b)
       xml_puts (out, level + 2, "</terminals>");




reply via email to

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