mirror of
https://github.com/michaelrsweet/mxml.git
synced 2024-11-24 11:25:30 +00:00
Use realloc for everything (Issue #300)
This commit is contained in:
parent
4c9b2d2260
commit
c07a57e02f
@ -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
|
||||
|
@ -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);
|
||||
|
@ -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.");
|
||||
|
Loading…
Reference in New Issue
Block a user