0
0
mirror of https://github.com/zeux/pugixml.git synced 2025-01-14 01:47:55 +08:00

More NO_STL fixes

git-svn-id: http://pugixml.googlecode.com/svn/trunk@14 99668b35-9821-0410-8761-19e4c4f06640
This commit is contained in:
arseny.kapoulkine 2006-12-08 14:25:56 +00:00
parent 2164a1ddb5
commit 1ea53e16dd
2 changed files with 15 additions and 7 deletions

View File

@ -13,6 +13,11 @@
#include "pugixml.hpp" #include "pugixml.hpp"
#include <cstring>
#include <cstdlib>
#include <new>
namespace pugi namespace pugi
{ {
/// A 'name=value' XML attribute structure. /// A 'name=value' XML attribute structure.
@ -539,7 +544,7 @@ namespace pugi
// \return pointer to the new node // \return pointer to the new node
xml_node_struct* append_node(xml_node_struct* parent, xml_node_type type = node_element) xml_node_struct* append_node(xml_node_struct* parent, xml_node_type type = node_element)
{ {
if(!parent) return NULL; // Must have a parent. if(!parent) return 0; // Must have a parent.
xml_node_struct* child = alloc.allocate<xml_node_struct>(type); // Allocate a new child. xml_node_struct* child = alloc.allocate<xml_node_struct>(type); // Allocate a new child.
child->parent = parent; // Set it's parent pointer. child->parent = parent; // Set it's parent pointer.
@ -558,7 +563,7 @@ namespace pugi
// \return pointer to appended xml_attribute_struct. // \return pointer to appended xml_attribute_struct.
xml_attribute_struct* append_attribute(xml_node_struct* node) xml_attribute_struct* append_attribute(xml_node_struct* node)
{ {
if(!node) return NULL; if(!node) return 0;
xml_attribute_struct* a = alloc.allocate<xml_attribute_struct>(); xml_attribute_struct* a = alloc.allocate<xml_attribute_struct>();
if (node->last_attribute) if (node->last_attribute)
@ -594,7 +599,7 @@ namespace pugi
// \param s - pointer to XML-formatted string. // \param s - pointer to XML-formatted string.
// \param xmldoc - pointer to root. // \param xmldoc - pointer to root.
// \param optmsk - parse options mask. // \param optmsk - parse options mask.
// \return last string position or null. // \return last string position or NULL.
char* parse(register char* s,xml_node_struct* xmldoc,unsigned int optmsk = parse_default) char* parse(register char* s,xml_node_struct* xmldoc,unsigned int optmsk = parse_default)
{ {
if(!s || !xmldoc) return s; if(!s || !xmldoc) return s;
@ -1098,7 +1103,7 @@ namespace pugi
return true; return true;
} }
xml_attribute::xml_attribute(): _attr(NULL) xml_attribute::xml_attribute(): _attr(0)
{ {
} }
@ -1189,7 +1194,7 @@ namespace pugi
bool xml_attribute::empty() const bool xml_attribute::empty() const
{ {
return (_attr == NULL); return (_attr == 0);
} }
const char* xml_attribute::name() const const char* xml_attribute::name() const
@ -1915,7 +1920,7 @@ namespace pugi
char* xml_parser::parse(char* xmlstr,unsigned int optmsk) char* xml_parser::parse(char* xmlstr,unsigned int optmsk)
{ {
if(!xmlstr) return NULL; if(!xmlstr) return 0;
xml_allocator alloc(&_memory); xml_allocator alloc(&_memory);
@ -1930,7 +1935,7 @@ namespace pugi
char* xml_parser::parse(const transfer_ownership_tag&, char* xmlstr,unsigned int optmsk) char* xml_parser::parse(const transfer_ownership_tag&, char* xmlstr,unsigned int optmsk)
{ {
if(!xmlstr) return NULL; if(!xmlstr) return 0;
delete[] _buffer; delete[] _buffer;
_buffer = xmlstr; _buffer = xmlstr;

View File

@ -14,6 +14,9 @@
#ifndef HEADER_PUGIXML_HPP #ifndef HEADER_PUGIXML_HPP
#define HEADER_PUGIXML_HPP #define HEADER_PUGIXML_HPP
// Uncomment this to disable STL
// #define PUGIXML_NO_STL
#ifndef PUGIXML_NO_STL #ifndef PUGIXML_NO_STL
# include <string> # include <string>
# include <istream> # include <istream>