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

Function addReplyDouble

app/redis-6.2.6/src/networking.c:671–694  ·  view source on GitHub ↗

Add a double as a bulk reply */

Source from the content-addressed store, hash-verified

669
670/* Add a double as a bulk reply */
671void addReplyDouble(client *c, double d) {
672 if (isinf(d)) {
673 /* Libc in odd systems (Hi Solaris!) will format infinite in a
674 * different way, so better to handle it in an explicit way. */
675 if (c->resp == 2) {
676 addReplyBulkCString(c, d > 0 ? "inf" : "-inf");
677 } else {
678 addReplyProto(c, d > 0 ? ",inf\r\n" : ",-inf\r\n",
679 d > 0 ? 6 : 7);
680 }
681 } else {
682 char dbuf[MAX_LONG_DOUBLE_CHARS+3],
683 sbuf[MAX_LONG_DOUBLE_CHARS+32];
684 int dlen, slen;
685 if (c->resp == 2) {
686 dlen = snprintf(dbuf,sizeof(dbuf),"%.17g",d);
687 slen = snprintf(sbuf,sizeof(sbuf),"$%d\r\n%s\r\n",dlen,dbuf);
688 addReplyProto(c,sbuf,slen);
689 } else {
690 dlen = snprintf(dbuf,sizeof(dbuf),",%.17g\r\n",d);
691 addReplyProto(c,dbuf,dlen);
692 }
693 }
694}
695
696void addReplyBigNum(client *c, const char* num, size_t len) {
697 if (c->resp == 2) {

Callers 14

luaReplyToRedisReplyFunction · 0.85
memoryCommandFunction · 0.85
aclCommandFunction · 0.85
zaddGenericCommandFunction · 0.85
zscoreCommandFunction · 0.85
zmscoreCommandFunction · 0.85
genericZpopCommandFunction · 0.85

Calls 3

addReplyBulkCStringFunction · 0.85
addReplyProtoFunction · 0.85
snprintfFunction · 0.85

Tested by

no test coverage detected