mirror of
https://github.com/michaelrsweet/mxml.git
synced 2024-11-13 23:35:30 +00:00
mxmlDelete used a recursive algorithm which could require large amounts of
stack space depending on the file (Bug #549) Bump version to 2.10.
This commit is contained in:
parent
0cc2394ff5
commit
d8c0ba9007
8
CHANGES
8
CHANGES
@ -1,6 +1,12 @@
|
||||
CHANGES - 2014-10-19
|
||||
CHANGES - 2016-06-11
|
||||
--------------------
|
||||
|
||||
CHANGES IN Mini-XML 2.10
|
||||
|
||||
- mxmlDelete used a recursive algorithm which could require large
|
||||
amounts of stack space depending on the file (Bug #549)
|
||||
|
||||
|
||||
CHANGES IN Mini-XML 2.9
|
||||
|
||||
- mxmlLoad* did not correctly load value nodes with MXML_NO_CALLBACK
|
||||
|
52
configure
vendored
52
configure
vendored
@ -1,6 +1,8 @@
|
||||
#! /bin/sh
|
||||
# Guess values for system-dependent variables and create Makefiles.
|
||||
# Generated by GNU Autoconf 2.69.
|
||||
# Generated by GNU Autoconf 2.69 for Mini-XML 2.10.
|
||||
#
|
||||
# Report bugs to <http://www.msweet.org/bugs.php/Mini-XML>.
|
||||
#
|
||||
#
|
||||
# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
|
||||
@ -264,8 +266,9 @@ fi
|
||||
$as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should"
|
||||
$as_echo "$0: be upgraded to zsh 4.3.4 or later."
|
||||
else
|
||||
$as_echo "$0: Please tell bug-autoconf@gnu.org about your system,
|
||||
$0: including any error possibly output before this
|
||||
$as_echo "$0: Please tell bug-autoconf@gnu.org and
|
||||
$0: http://www.msweet.org/bugs.php/Mini-XML about your
|
||||
$0: system, including any error possibly output before this
|
||||
$0: message. Then install a modern shell, or manually run
|
||||
$0: the script under such a shell if you do have one."
|
||||
fi
|
||||
@ -575,14 +578,13 @@ MFLAGS=
|
||||
MAKEFLAGS=
|
||||
|
||||
# Identity of this package.
|
||||
PACKAGE_NAME=
|
||||
PACKAGE_TARNAME=
|
||||
PACKAGE_VERSION=
|
||||
PACKAGE_STRING=
|
||||
PACKAGE_BUGREPORT=
|
||||
PACKAGE_URL=
|
||||
PACKAGE_NAME='Mini-XML'
|
||||
PACKAGE_TARNAME='mxml'
|
||||
PACKAGE_VERSION='2.10'
|
||||
PACKAGE_STRING='Mini-XML 2.10'
|
||||
PACKAGE_BUGREPORT='http://www.msweet.org/bugs.php/Mini-XML'
|
||||
PACKAGE_URL='http://www.msweet.org/projects.php/Mini-XML'
|
||||
|
||||
ac_unique_file="mxml.h"
|
||||
# Factoring default headers for most tests.
|
||||
ac_includes_default="\
|
||||
#include <stdio.h>
|
||||
@ -756,7 +758,7 @@ sharedstatedir='${prefix}/com'
|
||||
localstatedir='${prefix}/var'
|
||||
includedir='${prefix}/include'
|
||||
oldincludedir='/usr/include'
|
||||
docdir='${datarootdir}/doc/${PACKAGE}'
|
||||
docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
|
||||
infodir='${datarootdir}/info'
|
||||
htmldir='${docdir}'
|
||||
dvidir='${docdir}'
|
||||
@ -1256,7 +1258,7 @@ if test "$ac_init_help" = "long"; then
|
||||
# Omit some internal or obsolete options to make the list less imposing.
|
||||
# This message is too long to be a string in the A/UX 3.1 sh.
|
||||
cat <<_ACEOF
|
||||
\`configure' configures this package to adapt to many kinds of systems.
|
||||
\`configure' configures Mini-XML 2.10 to adapt to many kinds of systems.
|
||||
|
||||
Usage: $0 [OPTION]... [VAR=VALUE]...
|
||||
|
||||
@ -1304,7 +1306,7 @@ Fine tuning of the installation directories:
|
||||
--infodir=DIR info documentation [DATAROOTDIR/info]
|
||||
--localedir=DIR locale-dependent data [DATAROOTDIR/locale]
|
||||
--mandir=DIR man documentation [DATAROOTDIR/man]
|
||||
--docdir=DIR documentation root [DATAROOTDIR/doc/PACKAGE]
|
||||
--docdir=DIR documentation root [DATAROOTDIR/doc/mxml]
|
||||
--htmldir=DIR html documentation [DOCDIR]
|
||||
--dvidir=DIR dvi documentation [DOCDIR]
|
||||
--pdfdir=DIR pdf documentation [DOCDIR]
|
||||
@ -1316,7 +1318,9 @@ _ACEOF
|
||||
fi
|
||||
|
||||
if test -n "$ac_init_help"; then
|
||||
|
||||
case $ac_init_help in
|
||||
short | recursive ) echo "Configuration of Mini-XML 2.10:";;
|
||||
esac
|
||||
cat <<\_ACEOF
|
||||
|
||||
Optional Features:
|
||||
@ -1350,7 +1354,8 @@ Some influential environment variables:
|
||||
Use these variables to override the choices made by `configure' or to help
|
||||
it to find libraries and programs with nonstandard names/locations.
|
||||
|
||||
Report bugs to the package provider.
|
||||
Report bugs to <http://www.msweet.org/bugs.php/Mini-XML>.
|
||||
Mini-XML home page: <http://www.msweet.org/projects.php/Mini-XML>.
|
||||
_ACEOF
|
||||
ac_status=$?
|
||||
fi
|
||||
@ -1413,7 +1418,7 @@ fi
|
||||
test -n "$ac_init_help" && exit $ac_status
|
||||
if $ac_init_version; then
|
||||
cat <<\_ACEOF
|
||||
configure
|
||||
Mini-XML configure 2.10
|
||||
generated by GNU Autoconf 2.69
|
||||
|
||||
Copyright (C) 2012 Free Software Foundation, Inc.
|
||||
@ -1723,6 +1728,10 @@ $as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;}
|
||||
$as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;}
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
|
||||
$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
|
||||
( $as_echo "## ------------------------------------------------------ ##
|
||||
## Report this to http://www.msweet.org/bugs.php/Mini-XML ##
|
||||
## ------------------------------------------------------ ##"
|
||||
) | sed "s/^/$as_me: WARNING: /" >&2
|
||||
;;
|
||||
esac
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
|
||||
@ -1816,7 +1825,7 @@ cat >config.log <<_ACEOF
|
||||
This file contains any messages produced by compilers while
|
||||
running configure, to aid debugging if configure makes a mistake.
|
||||
|
||||
It was created by $as_me, which was
|
||||
It was created by Mini-XML $as_me 2.10, which was
|
||||
generated by GNU Autoconf 2.69. Invocation command line was
|
||||
|
||||
$ $0 $@
|
||||
@ -2168,7 +2177,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
|
||||
ac_config_headers="$ac_config_headers config.h"
|
||||
|
||||
|
||||
VERSION=2.9
|
||||
VERSION="2.10"
|
||||
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define MXML_VERSION "Mini-XML v$VERSION"
|
||||
@ -4965,7 +4974,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
|
||||
# report actual input values of CONFIG_FILES etc. instead of their
|
||||
# values after options handling.
|
||||
ac_log="
|
||||
This file was extended by $as_me, which was
|
||||
This file was extended by Mini-XML $as_me 2.10, which was
|
||||
generated by GNU Autoconf 2.69. Invocation command line was
|
||||
|
||||
CONFIG_FILES = $CONFIG_FILES
|
||||
@ -5021,13 +5030,14 @@ $config_files
|
||||
Configuration headers:
|
||||
$config_headers
|
||||
|
||||
Report bugs to the package provider."
|
||||
Report bugs to <http://www.msweet.org/bugs.php/Mini-XML>.
|
||||
Mini-XML home page: <http://www.msweet.org/projects.php/Mini-XML>."
|
||||
|
||||
_ACEOF
|
||||
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
|
||||
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
|
||||
ac_cs_version="\\
|
||||
config.status
|
||||
Mini-XML config.status 2.10
|
||||
configured by $0, generated by GNU Autoconf 2.69,
|
||||
with options \\"\$ac_cs_config\\"
|
||||
|
||||
|
@ -3,7 +3,7 @@ dnl "$Id$"
|
||||
dnl
|
||||
dnl Configuration script for Mini-XML, a small XML-like file parsing library.
|
||||
dnl
|
||||
dnl Copyright 2003-2014 by Michael R Sweet.
|
||||
dnl Copyright 2003-2016 by Michael R Sweet.
|
||||
dnl
|
||||
dnl These coded instructions, statements, and computer programs are the
|
||||
dnl property of Michael R Sweet and are protected by Federal copyright
|
||||
@ -14,14 +14,14 @@ dnl
|
||||
dnl http://www.msweet.org/projects.php/Mini-XML
|
||||
dnl
|
||||
|
||||
dnl Specify a source file from the distribution...
|
||||
AC_INIT(mxml.h)
|
||||
dnl Package name and version...
|
||||
AC_INIT([Mini-XML], [2.10], [http://www.msweet.org/bugs.php/Mini-XML], [mxml], [http://www.msweet.org/projects.php/Mini-XML])
|
||||
|
||||
dnl Set the name of the config header file...
|
||||
AC_CONFIG_HEADER(config.h)
|
||||
|
||||
dnl Version number...
|
||||
VERSION=2.9
|
||||
VERSION="AC_PACKAGE_VERSION"
|
||||
AC_SUBST(VERSION)
|
||||
AC_DEFINE_UNQUOTED(MXML_VERSION, "Mini-XML v$VERSION")
|
||||
|
150
mxml-node.c
150
mxml-node.c
@ -3,7 +3,7 @@
|
||||
*
|
||||
* Node support code for Mini-XML, a small XML-like file parsing library.
|
||||
*
|
||||
* Copyright 2003-2014 by Michael R Sweet.
|
||||
* Copyright 2003-2016 by Michael R Sweet.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
* property of Michael R Sweet and are protected by Federal copyright
|
||||
@ -26,6 +26,7 @@
|
||||
* Local functions...
|
||||
*/
|
||||
|
||||
static void mxml_free(mxml_node_t *node);
|
||||
static mxml_node_t *mxml_new(mxml_node_t *parent, mxml_type_t type);
|
||||
|
||||
|
||||
@ -177,7 +178,8 @@ mxmlAdd(mxml_node_t *parent, /* I - Parent node */
|
||||
void
|
||||
mxmlDelete(mxml_node_t *node) /* I - Node to delete */
|
||||
{
|
||||
int i; /* Looping var */
|
||||
mxml_node_t *current, /* Current node */
|
||||
*next; /* Next node */
|
||||
|
||||
|
||||
#ifdef DEBUG
|
||||
@ -201,60 +203,50 @@ mxmlDelete(mxml_node_t *node) /* I - Node to delete */
|
||||
* Delete children...
|
||||
*/
|
||||
|
||||
while (node->child)
|
||||
mxmlDelete(node->child);
|
||||
|
||||
/*
|
||||
* Now delete any node data...
|
||||
*/
|
||||
|
||||
switch (node->type)
|
||||
for (current = node->child; current; current = next)
|
||||
{
|
||||
case MXML_ELEMENT :
|
||||
if (node->value.element.name)
|
||||
free(node->value.element.name);
|
||||
/*
|
||||
* Get the next node...
|
||||
*/
|
||||
|
||||
if (node->value.element.num_attrs)
|
||||
{
|
||||
for (i = 0; i < node->value.element.num_attrs; i ++)
|
||||
{
|
||||
if (node->value.element.attrs[i].name)
|
||||
free(node->value.element.attrs[i].name);
|
||||
if (node->value.element.attrs[i].value)
|
||||
free(node->value.element.attrs[i].value);
|
||||
}
|
||||
if ((next = current->child) != NULL)
|
||||
{
|
||||
/*
|
||||
* Free parent nodes after child nodes have been freed...
|
||||
*/
|
||||
|
||||
free(node->value.element.attrs);
|
||||
}
|
||||
break;
|
||||
case MXML_INTEGER :
|
||||
/* Nothing to do */
|
||||
break;
|
||||
case MXML_OPAQUE :
|
||||
if (node->value.opaque)
|
||||
free(node->value.opaque);
|
||||
break;
|
||||
case MXML_REAL :
|
||||
/* Nothing to do */
|
||||
break;
|
||||
case MXML_TEXT :
|
||||
if (node->value.text.string)
|
||||
free(node->value.text.string);
|
||||
break;
|
||||
case MXML_CUSTOM :
|
||||
if (node->value.custom.data &&
|
||||
node->value.custom.destroy)
|
||||
(*(node->value.custom.destroy))(node->value.custom.data);
|
||||
break;
|
||||
default :
|
||||
break;
|
||||
current->child = NULL;
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((next = current->next) == NULL)
|
||||
{
|
||||
mxml_node_t *temp = current->parent;
|
||||
/* Pointer to parent node */
|
||||
|
||||
if (temp == node)
|
||||
{
|
||||
/*
|
||||
* Got back to the top node...
|
||||
*/
|
||||
|
||||
next = NULL;
|
||||
}
|
||||
else if ((next = temp->next) == NULL)
|
||||
{
|
||||
if ((next = temp->parent) == node)
|
||||
next = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
mxml_free(current);
|
||||
}
|
||||
|
||||
/*
|
||||
* Free this node...
|
||||
* Then free the memory used by this node...
|
||||
*/
|
||||
|
||||
free(node);
|
||||
mxml_free(node);
|
||||
}
|
||||
|
||||
|
||||
@ -729,6 +721,68 @@ mxmlRetain(mxml_node_t *node) /* I - Node */
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'mxml_free()' - Free the memory used by a node.
|
||||
*
|
||||
* Note: Does not free child nodes, does not remove from parent.
|
||||
*/
|
||||
|
||||
static void
|
||||
mxml_free(mxml_node_t *node) /* I - Node */
|
||||
{
|
||||
int i; /* Looping var */
|
||||
|
||||
|
||||
switch (node->type)
|
||||
{
|
||||
case MXML_ELEMENT :
|
||||
if (node->value.element.name)
|
||||
free(node->value.element.name);
|
||||
|
||||
if (node->value.element.num_attrs)
|
||||
{
|
||||
for (i = 0; i < node->value.element.num_attrs; i ++)
|
||||
{
|
||||
if (node->value.element.attrs[i].name)
|
||||
free(node->value.element.attrs[i].name);
|
||||
if (node->value.element.attrs[i].value)
|
||||
free(node->value.element.attrs[i].value);
|
||||
}
|
||||
|
||||
free(node->value.element.attrs);
|
||||
}
|
||||
break;
|
||||
case MXML_INTEGER :
|
||||
/* Nothing to do */
|
||||
break;
|
||||
case MXML_OPAQUE :
|
||||
if (node->value.opaque)
|
||||
free(node->value.opaque);
|
||||
break;
|
||||
case MXML_REAL :
|
||||
/* Nothing to do */
|
||||
break;
|
||||
case MXML_TEXT :
|
||||
if (node->value.text.string)
|
||||
free(node->value.text.string);
|
||||
break;
|
||||
case MXML_CUSTOM :
|
||||
if (node->value.custom.data &&
|
||||
node->value.custom.destroy)
|
||||
(*(node->value.custom.destroy))(node->value.custom.data);
|
||||
break;
|
||||
default :
|
||||
break;
|
||||
}
|
||||
|
||||
/*
|
||||
* Free this node...
|
||||
*/
|
||||
|
||||
free(node);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'mxml_new()' - Create a new node.
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user