| 1122 | } |
| 1123 | |
| 1124 | const char *RedisProtocolToLuaTypeBulk(lua_State *lua, const char *reply) { |
| 1125 | const char *p = strchr(reply + 1, '\r'); |
| 1126 | auto bulklen = ParseInt<int64_t>(std::string(reply + 1, p - reply - 1), 10).ValueOr(0); |
| 1127 | |
| 1128 | if (bulklen == -1) { |
| 1129 | lua_pushboolean(lua, 0); |
| 1130 | return p + 2; |
| 1131 | } else { |
| 1132 | lua_pushlstring(lua, p + 2, bulklen); |
| 1133 | return p + 2 + bulklen + 2; |
| 1134 | } |
| 1135 | } |
| 1136 | |
| 1137 | const char *RedisProtocolToLuaTypeStatus(lua_State *lua, const char *reply) { |
| 1138 | const char *p = strchr(reply + 1, '\r'); |
no test coverage detected