MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / addReplyErrorFormat

Function addReplyErrorFormat

src/networking.cpp:631–644  ·  view source on GitHub ↗

See addReplyErrorLength for expectations from the formatted string. * The formatted string is safe to contain \r and \n anywhere. */

Source from the content-addressed store, hash-verified

629/* See addReplyErrorLength for expectations from the formatted string.
630 * The formatted string is safe to contain \r and \n anywhere. */
631void 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
646void addReplyStatusLength(client *c, const char *s, size_t len) {
647 addReplyProto(c,"+",1);

Callers 15

latencyCommandFunction · 0.85
clusterCommandFunction · 0.85
migrateCommandFunction · 0.85
execCommandAbortFunction · 0.85
execCommandFunction · 0.85
hsetCommandFunction · 0.85
extractLongLatOrReplyFunction · 0.85
georadiusGenericFunction · 0.85
replconfCommandFunction · 0.85

Calls 8

sdscatvprintfFunction · 0.85
sdsemptyFunction · 0.85
sdstrimFunction · 0.85
sdsmapcharsFunction · 0.85
addReplyErrorLengthFunction · 0.85
sdslenFunction · 0.85
afterErrorReplyFunction · 0.85
sdsfreeFunction · 0.85

Tested by

no test coverage detected