MCPcopy Create free account
hub / github.com/F-Stack/f-stack / addReplyLongLongWithPrefix

Function addReplyLongLongWithPrefix

app/redis-6.2.6/src/networking.c:725–745  ·  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

723/* Add a long long as integer reply or bulk len / multi bulk count.
724 * Basically this is used to output <prefix><long long><crlf>. */
725void addReplyLongLongWithPrefix(client *c, long long ll, char prefix) {
726 char buf[128];
727 int len;
728
729 /* Things like $3\r\n or *2\r\n are emitted very often by the protocol
730 * so we have a few shared objects to use if the integer is small
731 * like it is most of the times. */
732 if (prefix == '*' && ll < OBJ_SHARED_BULKHDR_LEN && ll >= 0) {
733 addReply(c,shared.mbulkhdr[ll]);
734 return;
735 } else if (prefix == '$' && ll < OBJ_SHARED_BULKHDR_LEN && ll >= 0) {
736 addReply(c,shared.bulkhdr[ll]);
737 return;
738 }
739
740 buf[0] = prefix;
741 len = ll2string(buf+1,sizeof(buf)-1,ll);
742 buf[len+1] = '\r';
743 buf[len+2] = '\n';
744 addReplyProto(c,buf,len+3);
745}
746
747void addReplyLongLong(client *c, long long ll) {
748 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