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

Function addReplyHumanLongDouble

src/networking.cpp:868–880  ·  view source on GitHub ↗

Add a long double as a bulk reply, but uses a human readable formatting * of the double instead of exposing the crude behavior of doubles to the * dear user. */

Source from the content-addressed store, hash-verified

866 * of the double instead of exposing the crude behavior of doubles to the
867 * dear user. */
868void addReplyHumanLongDouble(client *c, long double d) {
869 if (c->resp == 2) {
870 robj *o = createStringObjectFromLongDouble(d,1);
871 addReplyBulk(c,o);
872 decrRefCount(o);
873 } else {
874 char buf[MAX_LONG_DOUBLE_CHARS];
875 int len = ld2string(buf,sizeof(buf),d,LD_STR_HUMAN);
876 addReplyProto(c,",",1);
877 addReplyProto(c,buf,len);
878 addReplyProto(c,"\r\n",2);
879 }
880}
881
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>. */

Callers 3

georadiusGenericFunction · 0.85
geoposCommandFunction · 0.85
RM_ReplyWithLongDoubleFunction · 0.85

Calls 5

addReplyBulkFunction · 0.85
decrRefCountFunction · 0.85
ld2stringFunction · 0.85
addReplyProtoFunction · 0.85

Tested by

no test coverage detected