Skip to content

Commit da775ec

Browse files
committed
Perform ReplaceNulls transformation in-place
1 parent 1505025 commit da775ec

File tree

1 file changed

+7
-12
lines changed

1 file changed

+7
-12
lines changed

src/actions/transformations/replace_nulls.cc

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,21 +23,16 @@ ReplaceNulls::ReplaceNulls(const std::string &action)
2323
this->action_kind = 1;
2424
}
2525

26-
bool ReplaceNulls::transform(std::string &val, const Transaction *trans) const {
27-
int64_t i;
28-
std::string value(val);
29-
30-
i = 0;
31-
while (i < value.size()) {
32-
if (value.at(i) == '\0') {
33-
value[i] = ' ';
34-
} else {
35-
i++;
26+
bool ReplaceNulls::transform(std::string &value, const Transaction *trans) const {
27+
bool changed = false;
28+
29+
for(auto &c : value) {
30+
if (c == '\0') {
31+
c = ' ';
32+
changed = true;
3633
}
3734
}
3835

39-
const auto changed = val != value;
40-
val = value;
4136
return changed;
4237
}
4338

0 commit comments

Comments
 (0)