From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6673 invoked by alias); 9 Jan 2007 14:59:43 -0000 Received: (qmail 6663 invoked by uid 22791); 9 Jan 2007 14:59:43 -0000 X-Spam-Check-By: sourceware.org Received: from nevyn.them.org (HELO nevyn.them.org) (66.93.172.17) by sourceware.org (qpsmtpd/0.31.1) with ESMTP; Tue, 09 Jan 2007 14:59:37 +0000 Received: from drow by nevyn.them.org with local (Exim 4.63) (envelope-from ) id 1H4IRq-00052n-RC; Tue, 09 Jan 2007 09:59:34 -0500 Date: Tue, 09 Jan 2007 14:59:00 -0000 From: Daniel Jacobowitz To: gdb-patches@sourceware.org, Richard Earnshaw Subject: [commit] Avoid using XML_StopParser if not available Message-ID: <20070109145934.GB17931@nevyn.them.org> Mail-Followup-To: gdb-patches@sourceware.org, Richard Earnshaw MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.13 (2006-08-11) X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2007-01/txt/msg00258.txt.bz2 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 * 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 } }