diff options
| author | Arseny Kapoulkine <arseny.kapoulkine@gmail.com> | 2015-04-15 08:32:22 -0700 | 
|---|---|---|
| committer | Arseny Kapoulkine <arseny.kapoulkine@gmail.com> | 2015-04-15 08:34:14 -0700 | 
| commit | 8c8940430ac0d0f82add6fb028ffe9712c9669e8 (patch) | |
| tree | e19908ebd72ae3cc5690665a1b584acb476e2db4 /src | |
| parent | 5158ee903be463c189a80715f92235ceb04871a7 (diff) | |
Minor xpath_variable refactoring
The type of the variable is now initialized correctly in the ctor, so that there
is no interim invalid state.
Diffstat (limited to 'src')
| -rw-r--r-- | src/pugixml.cpp | 19 | ||||
| -rw-r--r-- | src/pugixml.hpp | 2 | 
2 files changed, 13 insertions, 8 deletions
diff --git a/src/pugixml.cpp b/src/pugixml.cpp index fbe13f6..078a39c 100644 --- a/src/pugixml.cpp +++ b/src/pugixml.cpp @@ -7626,7 +7626,7 @@ PUGI__NS_BEGIN  	struct xpath_variable_boolean: xpath_variable  	{ -		xpath_variable_boolean(): value(false) +		xpath_variable_boolean(): xpath_variable(xpath_type_boolean), value(false)  		{  		} @@ -7636,7 +7636,7 @@ PUGI__NS_BEGIN  	struct xpath_variable_number: xpath_variable  	{ -		xpath_variable_number(): value(0) +		xpath_variable_number(): xpath_variable(xpath_type_number), value(0)  		{  		} @@ -7646,7 +7646,7 @@ PUGI__NS_BEGIN  	struct xpath_variable_string: xpath_variable  	{ -		xpath_variable_string(): value(0) +		xpath_variable_string(): xpath_variable(xpath_type_string), value(0)  		{  		} @@ -7661,6 +7661,10 @@ PUGI__NS_BEGIN  	struct xpath_variable_node_set: xpath_variable  	{ +		xpath_variable_node_set(): xpath_variable(xpath_type_node_set) +		{ +		} +  		xpath_node_set value;  		char_t name[1];  	}; @@ -11080,7 +11084,8 @@ namespace pugi  	PUGI__FN xpath_node_set::~xpath_node_set()  	{ -		if (_begin != &_storage) impl::xml_memory::deallocate(_begin); +		if (_begin != &_storage) +			impl::xml_memory::deallocate(_begin);  	}  	PUGI__FN xpath_node_set::xpath_node_set(const xpath_node_set& ns): _type(type_unsorted), _begin(&_storage), _end(&_storage) @@ -11152,7 +11157,7 @@ namespace pugi  		return error ? error : "No error";  	} -	PUGI__FN xpath_variable::xpath_variable(): _type(xpath_type_none), _next(0) +	PUGI__FN xpath_variable::xpath_variable(xpath_value_type type_): _type(type_), _next(0)  	{  	} @@ -11251,7 +11256,8 @@ namespace pugi  	PUGI__FN xpath_variable_set::xpath_variable_set()  	{ -		for (size_t i = 0; i < sizeof(_data) / sizeof(_data[0]); ++i) _data[i] = 0; +		for (size_t i = 0; i < sizeof(_data) / sizeof(_data[0]); ++i) +			_data[i] = 0;  	}  	PUGI__FN xpath_variable_set::~xpath_variable_set() @@ -11299,7 +11305,6 @@ namespace pugi  		if (result)  		{ -			result->_type = type;  			result->_next = _data[hash];  			_data[hash] = result; diff --git a/src/pugixml.hpp b/src/pugixml.hpp index b56f66a..a7154f1 100644 --- a/src/pugixml.hpp +++ b/src/pugixml.hpp @@ -1043,7 +1043,7 @@ namespace pugi  		xpath_value_type _type;  		xpath_variable* _next; -		xpath_variable(); +		xpath_variable(xpath_value_type type);  		// Non-copyable semantics  		xpath_variable(const xpath_variable&);  | 
