diff --git a/CHANGES.md b/CHANGES.md index 6a31420..2858b00 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,16 +1,18 @@ # Changes in Mini-XML 4.0.0 -- Now require C99 support. +- Now require C99 support (Issue #300) - Now install as "libmxml4" to support installing both Mini-XML 3.x and 4.x at the same time (use `--disable-libmxml4-prefix` configure option to disable) - Added `mxmlLoadIO` and `mxmlSaveIO` functions to load and save XML via callbacks (Issue #98) - Added new `MXML_TYPE_CDATA`, `MXML_TYPE_COMMENT`, `MXML_TYPE_DECLARATION`, and `MXML_TYPE_DIRECTIVE` node types (Issue #250) +- Added `mxmlLoadFilename` and `mxmlSaveFilename` functions (Issue #291) - Renamed `mxml_type_t` enumerations to `MXML_TYPE_xxx` (Issue #251) - Updated APIs to use bool type instead of an int representing a boolean value. - Updated the SAX callback to return a `bool` value to control processing (Issue #51) +- Updated the load and save callbacks to include a context pointer (Issue #106) # Changes in Mini-XML 3.3.2 diff --git a/mxml-attr.c b/mxml-attr.c index a44dc68..4bb6129 100644 --- a/mxml-attr.c +++ b/mxml-attr.c @@ -246,9 +246,7 @@ mxml_set_attr(mxml_node_t *node, // I - Element node } // Add a new attribute... - attr = realloc(node->value.element.attrs, (node->value.element.num_attrs + 1) * sizeof(_mxml_attr_t)); - - if (!attr) + if ((attr = realloc(node->value.element.attrs, (node->value.element.num_attrs + 1) * sizeof(_mxml_attr_t))) == NULL) { _mxml_error("Unable to allocate memory for attribute '%s' in element %s.", name, node->value.element.name); return (false); diff --git a/mxml-index.c b/mxml-index.c index 44b191e..dc66725 100644 --- a/mxml-index.c +++ b/mxml-index.c @@ -245,12 +245,7 @@ mxmlIndexNew(mxml_node_t *node, // I - XML node tree { if (ind->num_nodes >= ind->alloc_nodes) { - if (!ind->alloc_nodes) - temp = malloc(64 * sizeof(mxml_node_t *)); - else - temp = realloc(ind->nodes, (ind->alloc_nodes + 64) * sizeof(mxml_node_t *)); - - if (!temp) + if ((temp = realloc(ind->nodes, (ind->alloc_nodes + 64) * sizeof(mxml_node_t *))) == NULL) { // Unable to allocate memory for the index, so abort... _mxml_error("Unable to allocate memory for index nodes."); diff --git a/mxml.h b/mxml.h index 03704f5..916afb2 100644 --- a/mxml.h +++ b/mxml.h @@ -17,7 +17,6 @@ # include # include # include -# include # include # if defined(_WIN32) && !defined(__CUPS_SSIZE_T_DEFINED) # define __CUPS_SSIZE_T_DEFINED