Skip to content

Commit

Permalink
dropEmptyInitThenConcatStringsSep: Allow it to drop items again
Browse files Browse the repository at this point in the history
It's usually harmless, if it occurs at all.
  • Loading branch information
roberth committed Jul 13, 2024
1 parent 46e3f0d commit d7f1d21
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/libutil/util.hh
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,13 @@ std::string dropEmptyInitThenConcatStringsSep(const std::string_view sep, const
{
size_t size = 0;

for (auto & i : ss) {
// Make sure we don't rely on the empty item ignoring behavior
assert(!i.empty());
break;
}
// TODO? remove to make sure we don't rely on the empty item ignoring behavior,
// or just get rid of this function by understanding the remaining calls.
// for (auto & i : ss) {
// // Make sure we don't rely on the empty item ignoring behavior
// assert(!i.empty());
// break;
// }

// need a cast to string_view since this is also called with Symbols
for (const auto & s : ss) size += sep.size() + std::string_view(s).size();
Expand Down

0 comments on commit d7f1d21

Please sign in to comment.