Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [commit] Avoid using XML_StopParser if not available
@ 2007-01-09 14:59 Daniel Jacobowitz
  2007-01-09 15:39 ` Richard Earnshaw
  0 siblings, 1 reply; 2+ messages in thread
From: Daniel Jacobowitz @ 2007-01-09 14:59 UTC (permalink / raw)
  To: gdb-patches, Richard Earnshaw

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
     }
 }
 


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [commit] Avoid using XML_StopParser if not available
  2007-01-09 14:59 [commit] Avoid using XML_StopParser if not available Daniel Jacobowitz
@ 2007-01-09 15:39 ` Richard Earnshaw
  0 siblings, 0 replies; 2+ messages in thread
From: Richard Earnshaw @ 2007-01-09 15:39 UTC (permalink / raw)
  To: Daniel Jacobowitz; +Cc: gdb-patches

On Tue, 2007-01-09 at 09:59 -0500, Daniel Jacobowitz wrote:
> 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.
> 

Yes, that builds without problems.

R.
-- 
Richard Earnshaw             Email: Richard.Earnshaw@arm.com
ARM Ltd                      Phone: +44 1223 400569 (Direct + VoiceMail)
110 Fulbourn Road            Switchboard: +44 1223 400400
Cherry Hinton                Fax: +44 1223 400410
Cambridge CB1 9NJ            Web: http://www.arm.com/
UK


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-01-09 15:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-01-09 14:59 [commit] Avoid using XML_StopParser if not available Daniel Jacobowitz
2007-01-09 15:39 ` Richard Earnshaw

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox