summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorarseny.kapoulkine <arseny.kapoulkine@99668b35-9821-0410-8761-19e4c4f06640>2010-08-29 15:47:01 +0000
committerarseny.kapoulkine <arseny.kapoulkine@99668b35-9821-0410-8761-19e4c4f06640>2010-08-29 15:47:01 +0000
commitb75c5360f3d0a2e2609fd4de58a83369a7c745a2 (patch)
tree7e4b37f33a1d042a3b3bc9b2ddce9db7f37f6cb9
parent0dd0b4c496c69f47078de58a3c42939a885ddd6b (diff)
Minor refactoring
git-svn-id: http://pugixml.googlecode.com/svn/trunk@689 99668b35-9821-0410-8761-19e4c4f06640
-rw-r--r--src/pugixml.cpp47
1 files changed, 23 insertions, 24 deletions
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<xml_memory_page*>(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<size_t>(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<size_t>(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<const xpath_variable_boolean*>(this)->name;
default:
- assert(false);
+ assert(!"Invalid variable type");
return 0;
}
}