MCPcopy Create free account
hub / github.com/apache/kvrocks / RedisProtocolToLuaTypeDouble

Function RedisProtocolToLuaTypeDouble

src/storage/scripting.cc:1211–1230  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1209}
1210
1211const char *RedisProtocolToLuaTypeDouble(lua_State *lua, const char *reply) {
1212 const char *p = strchr(reply + 1, '\r');
1213 char buf[MAX_LONG_DOUBLE_CHARS + 1];
1214 size_t len = p - reply - 1;
1215 double d = NAN;
1216
1217 if (len <= MAX_LONG_DOUBLE_CHARS) {
1218 memcpy(buf, reply + 1, len);
1219 buf[len] = '\0';
1220 d = strtod(buf, nullptr); /* We expect a valid representation. */
1221 } else {
1222 d = 0;
1223 }
1224
1225 lua_newtable(lua);
1226 lua_pushstring(lua, "double");
1227 lua_pushnumber(lua, d);
1228 lua_settable(lua, -3);
1229 return p + 2;
1230}
1231
1232const char *RedisProtocolToLuaTypeBigNumber(lua_State *lua, const char *reply) {
1233 const char *p = strchr(reply + 1, '\r');

Callers 1

RedisProtocolToLuaTypeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected