| 1071 | } |
| 1072 | |
| 1073 | void addData(const char *data, unsigned long size) { |
| 1074 | if (reply != nullptr && (size + reply->used) > reply->size) |
| 1075 | flushData(); |
| 1076 | |
| 1077 | if (reply != nullptr && reply->size < size) { |
| 1078 | serverAssert(reply->used == 0); // flush should have happened |
| 1079 | zfree(reply); |
| 1080 | reply = nullptr; |
| 1081 | } |
| 1082 | |
| 1083 | if (reply == nullptr) { |
| 1084 | reply = (clientReplyBlock*)zmalloc(sizeof(clientReplyBlock) + std::max(size, (unsigned long)(PROTO_REPLY_CHUNK_BYTES*64))); |
| 1085 | reply->size = zmalloc_usable_size(reply) - sizeof(clientReplyBlock); |
| 1086 | reply->used = 0; |
| 1087 | } |
| 1088 | |
| 1089 | serverAssert((reply->size - reply->used) >= size); |
| 1090 | memcpy(reply->buf() + reply->used, data, size); |
| 1091 | reply->used += size; |
| 1092 | } |
| 1093 | |
| 1094 | void addLongLongWithPrefix(long long val, char prefix) { |
| 1095 | char buf[128]; |
nothing calls this directly
no test coverage detected