Perform ReplaceNulls transformation in-place

This commit is contained in:
Eduardo Arias 2024-08-19 08:41:18 -07:00
parent 1505025990
commit da775eca81

View File

@ -23,21 +23,16 @@ ReplaceNulls::ReplaceNulls(const std::string &action)
this->action_kind = 1; this->action_kind = 1;
} }
bool ReplaceNulls::transform(std::string &val, const Transaction *trans) const { bool ReplaceNulls::transform(std::string &value, const Transaction *trans) const {
int64_t i; bool changed = false;
std::string value(val);
i = 0; for(auto &c : value) {
while (i < value.size()) { if (c == '\0') {
if (value.at(i) == '\0') { c = ' ';
value[i] = ' '; changed = true;
} else {
i++;
} }
} }
const auto changed = val != value;
val = value;
return changed; return changed;
} }