From b75c5360f3d0a2e2609fd4de58a83369a7c745a2 Mon Sep 17 00:00:00 2001 From: "arseny.kapoulkine" Date: Sun, 29 Aug 2010 15:47:01 +0000 Subject: Minor refactoring git-svn-id: http://pugixml.googlecode.com/svn/trunk@689 99668b35-9821-0410-8761-19e4c4f06640 --- src/pugixml.cpp | 47 +++++++++++++++++++++++------------------------ 1 file changed, 23 insertions(+), 24 deletions(-) (limited to 'src') diff --git a/src/pugixml.cpp b/src/pugixml.cpp index 68ca27f..c2b26f0 100644 --- a/src/pugixml.cpp +++ b/src/pugixml.cpp @@ -169,7 +169,7 @@ namespace pugi { static xml_memory_page* construct(void* memory) { - if (!memory) return 0; + if (!memory) return 0; //$ redundant, left for performance xml_memory_page* result = static_cast(memory); @@ -204,7 +204,7 @@ namespace pugi struct xml_allocator { - xml_allocator(xml_memory_page* root): _root(root), _busy_size(root ? root->busy_size : 0) + xml_allocator(xml_memory_page* root): _root(root), _busy_size(root->busy_size) { } @@ -1163,9 +1163,7 @@ namespace convert_buffer_utf32(out_buffer, out_length, contents, size, opt_true()); } - // invalid encoding combination (this can't happen) - assert(false); - + assert(!"Invalid encoding"); return false; } #else @@ -1238,9 +1236,7 @@ namespace convert_buffer_utf32(out_buffer, out_length, contents, size, opt_true()); } - // invalid encoding combination (this can't happen) - assert(false); - + assert(!"Invalid encoding"); return false; } #endif @@ -2429,9 +2425,7 @@ namespace return static_cast(end - dest) * sizeof(uint32_t); } - // invalid encoding combination (this can't happen) - assert(false); - + assert(!"Invalid encoding"); return 0; } #else @@ -2483,9 +2477,7 @@ namespace return static_cast(end - dest) * sizeof(uint32_t); } - // invalid encoding combination (this can't happen) - assert(false); - + assert(!"Invalid encoding"); return 0; } #endif @@ -2676,8 +2668,7 @@ namespace break; default: - // invalid encoding (this should not happen) - assert(false); + assert(!"Invalid encoding"); } } @@ -2868,7 +2859,7 @@ namespace break; default: - assert(false); + assert(!"Invalid node type"); } } @@ -2942,7 +2933,7 @@ namespace } default: - assert(false); + assert(!"Invalid node type"); } } @@ -5432,7 +5423,7 @@ namespace break; default: - assert(false); + assert(!"Invalid variable type"); } } @@ -5754,10 +5745,18 @@ namespace pugi switch (_type) { - case type_sorted: return *_begin; - case type_sorted_reverse: return *(_end - 1); - case type_unsorted: return *pstd::min_element(_begin, _end, document_order_comparator()); - default: return xpath_node(); + case type_sorted: + return *_begin; + + case type_sorted_reverse: + return *(_end - 1); + + case type_unsorted: + return *pstd::min_element(_begin, _end, document_order_comparator()); + + default: + assert(!"Invalid node set type"); + return xpath_node(); } } @@ -8332,7 +8331,7 @@ namespace pugi return static_cast(this)->name; default: - assert(false); + assert(!"Invalid variable type"); return 0; } } -- cgit v1.2.3