| 1071 | */ |
| 1072 | |
| 1073 | const char *RedisProtocolToLuaType(lua_State *lua, const char *reply) { |
| 1074 | const char *p = reply; |
| 1075 | |
| 1076 | switch (*p) { |
| 1077 | case ':': |
| 1078 | p = RedisProtocolToLuaTypeInt(lua, reply); |
| 1079 | break; |
| 1080 | case '$': |
| 1081 | p = RedisProtocolToLuaTypeBulk(lua, reply); |
| 1082 | break; |
| 1083 | case '+': |
| 1084 | p = RedisProtocolToLuaTypeStatus(lua, reply); |
| 1085 | break; |
| 1086 | case '-': |
| 1087 | p = RedisProtocolToLuaTypeError(lua, reply); |
| 1088 | break; |
| 1089 | case '*': |
| 1090 | p = RedisProtocolToLuaTypeAggregate(lua, reply, *p); |
| 1091 | break; |
| 1092 | case '%': |
| 1093 | p = RedisProtocolToLuaTypeAggregate(lua, reply, *p); |
| 1094 | break; |
| 1095 | case '~': |
| 1096 | p = RedisProtocolToLuaTypeAggregate(lua, reply, *p); |
| 1097 | break; |
| 1098 | case '_': |
| 1099 | p = RedisProtocolToLuaTypeNull(lua, reply); |
| 1100 | break; |
| 1101 | case '#': |
| 1102 | p = RedisProtocolToLuaTypeBool(lua, reply, p[1]); |
| 1103 | break; |
| 1104 | case ',': |
| 1105 | p = RedisProtocolToLuaTypeDouble(lua, reply); |
| 1106 | break; |
| 1107 | case '(': |
| 1108 | p = RedisProtocolToLuaTypeBigNumber(lua, reply); |
| 1109 | break; |
| 1110 | case '=': |
| 1111 | p = RedisProtocolToLuaTypeVerbatimString(lua, reply); |
| 1112 | break; |
| 1113 | } |
| 1114 | return p; |
| 1115 | } |
| 1116 | |
| 1117 | const char *RedisProtocolToLuaTypeInt(lua_State *lua, const char *reply) { |
| 1118 | const char *p = strchr(reply + 1, '\r'); |
no test coverage detected