Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Daniel Jacobowitz <drow@false.org>
To: gdb-patches@sourceware.org, Richard Earnshaw <rearnsha@arm.com>
Subject: [commit] Avoid using XML_StopParser if not available
Date: Tue, 09 Jan 2007 14:59:00 -0000	[thread overview]
Message-ID: <20070109145934.GB17931@nevyn.them.org> (raw)

XML_StopParser is basically an optimization.  We have to check for
errors ourselves, because expat does not guarantee that it will
immediately stop calling handlers; for instance, I believe it will call
the end element handlers for anything already opened.  So, we can
call it if it's available but consider a missing copy harmless.

I've checked this in.  Richard, could you let me know if it is not
enough for your version of expat?  I can't readily downgrade to be
sure.

-- 
Daniel Jacobowitz
CodeSourcery

2007-01-09  Daniel Jacobowitz  <dan@codesourcery.com>

	* configure.ac: Check for XML_StopParser.
	* xml-support.c (gdb_xml_body_text): Check for an error.
	(gdb_xml_start_element_wrapper): Conditionalize call to XML_StopParser.
	(gdb_xml_end_element_wrapper): Likewise.
	* config.in, configure: Regenerated.

---
 gdb/config.in     |    3 +
 gdb/configure     |  106 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 gdb/configure.ac  |    5 ++
 gdb/xml-support.c |    7 +++
 4 files changed, 121 insertions(+)

Index: src/gdb/configure.ac
===================================================================
--- src.orig/gdb/configure.ac	2007-01-09 09:33:27.000000000 -0500
+++ src/gdb/configure.ac	2007-01-09 09:36:32.000000000 -0500
@@ -325,6 +325,11 @@ AC_LIB_HAVE_LINKFLAGS([expat], [], [#inc
 		      [XML_Parser p = XML_ParserCreate (0);])
 if test "$HAVE_LIBEXPAT" != yes; then
   AC_MSG_WARN([expat is missing or unusable; some features may be disabled.])
+else
+  save_LIBS=$LIBS
+  LIBS="$LIBS $LIBEXPAT"
+  AC_CHECK_FUNCS(XML_StopParser)
+  LIBS=$save_LIBS
 fi
 
 # ------------------------- #
Index: src/gdb/xml-support.c
===================================================================
--- src.orig/gdb/xml-support.c	2007-01-09 09:29:59.000000000 -0500
+++ src/gdb/xml-support.c	2007-01-09 09:33:15.000000000 -0500
@@ -81,6 +81,9 @@ gdb_xml_body_text (void *data, const XML
   struct gdb_xml_parser *parser = data;
   struct scope_level *scope = VEC_last (scope_level_s, parser->scopes);
 
+  if (parser->error.reason < 0)
+    return;
+
   if (scope->body == NULL)
     {
       scope->body = XZALLOC (struct obstack);
@@ -286,7 +289,9 @@ gdb_xml_start_element_wrapper (void *dat
   if (ex.reason < 0)
     {
       parser->error = ex;
+#ifdef HAVE_XML_STOPPARSER
       XML_StopParser (parser->expat_parser, XML_FALSE);
+#endif
     }
 }
 
@@ -362,7 +367,9 @@ gdb_xml_end_element_wrapper (void *data,
   if (ex.reason < 0)
     {
       parser->error = ex;
+#ifdef HAVE_XML_STOPPARSER
       XML_StopParser (parser->expat_parser, XML_FALSE);
+#endif
     }
 }
 


             reply	other threads:[~2007-01-09 14:59 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-01-09 14:59 Daniel Jacobowitz [this message]
2007-01-09 15:39 ` Richard Earnshaw

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=20070109145934.GB17931@nevyn.them.org \
    --to=drow@false.org \
    --cc=gdb-patches@sourceware.org \
    --cc=rearnsha@arm.com \
    /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