Cylix / cpp_redis

C++11 Lightweight Redis client: async, thread-safe, no dependency, pipelining, multi-platform - NO LONGER MAINTAINED - Please check https://github.com/cpp-redis/cpp_redis
MIT License
1.25k stars 554 forks source link

Improve bulk_string_builder::operator<< method body #193

Closed knowledge4igor closed 6 years ago

knowledge4igor commented 6 years ago

I have noticed that the implementation of bulk_string_builder::operator<< method can be simplified.

Cylix commented 6 years ago

Hi @knowledge4igor,

Thanks for taking the time to go through the code and finding that! Unfortunately, this essentially does not have the same meaning.

if (!fetch_size(buffer) || m_reply_ready) will first execute fetch_size, and if it does return true, check whether the state of the parsing switched to reply_ready (that is, it was not ready before calling fetch_size, but was after. This is possible if the size is -1).

Thus, I am not able to merge it as it may introduce a bug or degrade performance. However, feel free to drop other pull requests in the future. I kind of lack time to maintain this library, so PR are always welcomed!

Best