fix config::get_diff

This commit is contained in:
gfgtdf 2014-11-15 05:44:44 +01:00
parent fd9bfbc42d
commit 622d4c1313

View File

@ -1063,8 +1063,9 @@ void config::get_diff(const config& c, config& res) const
attribute_map::const_iterator i; attribute_map::const_iterator i;
for(i = values.begin(); i != values.end(); ++i) { for(i = values.begin(); i != values.end(); ++i) {
if(i->second.blank()) continue;
const attribute_map::const_iterator j = c.values.find(i->first); const attribute_map::const_iterator j = c.values.find(i->first);
if(j == c.values.end() || (i->second != j->second && i->second != "")) { if(j == c.values.end() || (i->second != j->second && !i->second.blank() )) {
if(inserts == NULL) { if(inserts == NULL) {
inserts = &res.add_child("insert"); inserts = &res.add_child("insert");
} }
@ -1076,8 +1077,9 @@ void config::get_diff(const config& c, config& res) const
config* deletes = NULL; config* deletes = NULL;
for(i = c.values.begin(); i != c.values.end(); ++i) { for(i = c.values.begin(); i != c.values.end(); ++i) {
if(i->second.blank()) continue;
const attribute_map::const_iterator itor = values.find(i->first); const attribute_map::const_iterator itor = values.find(i->first);
if(itor == values.end() || itor->second == "") { if(itor == values.end() || itor->second.blank()) {
if(deletes == NULL) { if(deletes == NULL) {
deletes = &res.add_child("delete"); deletes = &res.add_child("delete");
} }