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

Function addReplyLongLongWithPrefix

src/networking.cpp:884–904  ·  view source on GitHub ↗

Add a long long as integer reply or bulk len / multi bulk count. * Basically this is used to output . */

Source from the content-addressed store, hash-verified

882/* Add a long long as integer reply or bulk len / multi bulk count.
883 * Basically this is used to output <prefix><long long><crlf>. */
884void addReplyLongLongWithPrefix(client *c, long long ll, char prefix) {
885 char buf[128];
886 int len;
887
888 /* Things like $3\r\n or *2\r\n are emitted very often by the protocol
889 * so we have a few shared objects to use if the integer is small
890 * like it is most of the times. */
891 if (prefix == '*' && ll < OBJ_SHARED_BULKHDR_LEN && ll >= 0) {
892 addReply(c,shared.mbulkhdr[ll]);
893 return;
894 } else if (prefix == '$' && ll < OBJ_SHARED_BULKHDR_LEN && ll >= 0) {
895 addReply(c,shared.bulkhdr[ll]);
896 return;
897 }
898
899 buf[0] = prefix;
900 len = ll2string(buf+1,sizeof(buf)-1,ll);
901 buf[len+1] = '\r';
902 buf[len+2] = '\n';
903 addReplyProto(c,buf,len+3);
904}
905
906void addReplyLongLong(client *c, long long ll) {
907 if (ll == 0)

Callers 5

addReplyLongLongFunction · 0.85
addReplyAggregateLenFunction · 0.85
addReplyBulkLenFunction · 0.85
addReplyBulkCBufferFunction · 0.85
addReplyBulkSdsFunction · 0.85

Calls 3

addReplyFunction · 0.85
ll2stringFunction · 0.85
addReplyProtoFunction · 0.85

Tested by

no test coverage detected