Commit 19aba4ac authored by antirez's avatar antirez
Browse files

RESP3: double -> human readable conversion.

parent e8e30bc4
...@@ -2157,6 +2157,7 @@ char *ldbRedisProtocolToHuman_Set(sds *o, char *reply); ...@@ -2157,6 +2157,7 @@ char *ldbRedisProtocolToHuman_Set(sds *o, char *reply);
char *ldbRedisProtocolToHuman_Map(sds *o, char *reply); char *ldbRedisProtocolToHuman_Map(sds *o, char *reply);
char *ldbRedisProtocolToHuman_Null(sds *o, char *reply); char *ldbRedisProtocolToHuman_Null(sds *o, char *reply);
char *ldbRedisProtocolToHuman_Bool(sds *o, char *reply); char *ldbRedisProtocolToHuman_Bool(sds *o, char *reply);
char *ldbRedisProtocolToHuman_Double(sds *o, char *reply);
/* Get Redis protocol from 'reply' and appends it in human readable form to /* Get Redis protocol from 'reply' and appends it in human readable form to
* the passed SDS string 'o'. * the passed SDS string 'o'.
...@@ -2175,6 +2176,7 @@ char *ldbRedisProtocolToHuman(sds *o, char *reply) { ...@@ -2175,6 +2176,7 @@ char *ldbRedisProtocolToHuman(sds *o, char *reply) {
case '%': p = ldbRedisProtocolToHuman_Map(o,reply); break; case '%': p = ldbRedisProtocolToHuman_Map(o,reply); break;
case '_': p = ldbRedisProtocolToHuman_Null(o,reply); break; case '_': p = ldbRedisProtocolToHuman_Null(o,reply); break;
case '#': p = ldbRedisProtocolToHuman_Bool(o,reply); break; case '#': p = ldbRedisProtocolToHuman_Bool(o,reply); break;
case ',': p = ldbRedisProtocolToHuman_Double(o,reply); break;
} }
return p; return p;
} }
...@@ -2278,6 +2280,13 @@ char *ldbRedisProtocolToHuman_Bool(sds *o, char *reply) { ...@@ -2278,6 +2280,13 @@ char *ldbRedisProtocolToHuman_Bool(sds *o, char *reply) {
return p+2; return p+2;
} }
char *ldbRedisProtocolToHuman_Double(sds *o, char *reply) {
char *p = strchr(reply+1,'\r');
*o = sdscatlen(*o,"(double) ",9);
*o = sdscatlen(*o,reply+1,p-reply-1);
return p+2;
}
/* Log a Redis reply as debugger output, in an human readable format. /* Log a Redis reply as debugger output, in an human readable format.
* If the resulting string is longer than 'len' plus a few more chars * If the resulting string is longer than 'len' plus a few more chars
* used as prefix, it gets truncated. */ * used as prefix, it gets truncated. */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment