Bind reference to avoid repeated accesses by index

This commit is contained in:
Dmitry-Me 2014-10-01 10:30:16 +04:00
parent 0895e78549
commit d048f1e8e3
1 changed files with 6 additions and 5 deletions

View File

@ -212,12 +212,13 @@ const char* StrPair::GetStr()
else {
int i=0;
for(; i<NUM_ENTITIES; ++i ) {
if ( strncmp( p+1, entities[i].pattern, entities[i].length ) == 0
&& *(p+entities[i].length+1) == ';' ) {
// Found an entity convert;
*q = entities[i].value;
const Entity& entity = entities[i];
if ( strncmp( p + 1, entity.pattern, entity.length ) == 0
&& *( p + entity.length + 1 ) == ';' ) {
// Found an entity - convert.
*q = entity.value;
++q;
p += entities[i].length + 2;
p += entity.length + 2;
break;
}
}