See addReplyErrorLength for expectations from the formatted string. * The formatted string is safe to contain \r and \n anywhere. */
| 629 | /* See addReplyErrorLength for expectations from the formatted string. |
| 630 | * The formatted string is safe to contain \r and \n anywhere. */ |
| 631 | void addReplyErrorFormat(client *c, const char *fmt, ...) { |
| 632 | va_list ap; |
| 633 | va_start(ap,fmt); |
| 634 | sds s = sdscatvprintf(sdsempty(),fmt,ap); |
| 635 | va_end(ap); |
| 636 | /* Trim any newlines at the end (ones will be added by addReplyErrorLength) */ |
| 637 | s = sdstrim(s, "\r\n"); |
| 638 | /* Make sure there are no newlines in the middle of the string, otherwise |
| 639 | * invalid protocol is emitted. */ |
| 640 | s = sdsmapchars(s, "\r\n", " ", 2); |
| 641 | addReplyErrorLength(c,s,sdslen(s)); |
| 642 | afterErrorReply(c,s,sdslen(s)); |
| 643 | sdsfree(s); |
| 644 | } |
| 645 | |
| 646 | void addReplyStatusLength(client *c, const char *s, size_t len) { |
| 647 | addReplyProto(c,"+",1); |
no test coverage detected