torwig commented on issue #2830:
URL: https://github.com/apache/kvrocks/issues/2830#issuecomment-2729621949
@git-hulk @PragmaTwice @mapleFU I see that we intentionally respond with a
nil string if it's empty here:
```
std::string MultiBulkString(RESP ver, const std::vector<std::string>
&values) {
std::string result = MultiLen(values.size());
for (const auto &value : values) {
if (value.empty()) { // yes, it's empty :)
result += NilString(ver); // <<<----- here is that nil string
} else {
result += BulkString(value);
}
}
return result;
}
```
I remember we had a function that took a boolean parameter on how to treat
empty strings (nil or non-nil).
I'm not sure it's safe to modify the existing function like the following:
```
std::string MultiBulkString(RESP ver, const std::vector<std::string>
&values) {
std::string result = MultiLen(values.size());
for (const auto &value : values) {
result += BulkString(value);
}
return result;
}
```
since it's used in a lot of other places.
I can create a dedicated function like the one above and use it for stream
responses. What do you think?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]