Commit 5a3d8574 authored by antirez's avatar antirez
Browse files

LCS: output LCS len as well in IDX mode.

parent 3f96e162
...@@ -602,8 +602,11 @@ void lcsCommand(client *c) { ...@@ -602,8 +602,11 @@ void lcsCommand(client *c) {
/* Start with a deferred array if we have to emit the ranges. */ /* Start with a deferred array if we have to emit the ranges. */
uint32_t arraylen = 0; /* Number of ranges emitted in the array. */ uint32_t arraylen = 0; /* Number of ranges emitted in the array. */
if (getidx && idxkey == NULL) if (getidx && idxkey == NULL) {
addReplyMapLen(c,2);
addReplyBulkCString(c,"matches");
arraylenptr = addReplyDeferredLen(c); arraylenptr = addReplyDeferredLen(c);
}
i = alen, j = blen; i = alen, j = blen;
while (computelcs && i > 0 && j > 0) { while (computelcs && i > 0 && j > 0) {
...@@ -669,6 +672,8 @@ void lcsCommand(client *c) { ...@@ -669,6 +672,8 @@ void lcsCommand(client *c) {
/* Reply depending on the given options. */ /* Reply depending on the given options. */
if (arraylenptr) { if (arraylenptr) {
addReplyBulkCString(c,"len");
addReplyLongLong(c,LCS(alen,blen));
setDeferredArrayLen(c,arraylenptr,arraylen); setDeferredArrayLen(c,arraylenptr,arraylen);
} else if (getlen) { } else if (getlen) {
addReplyLongLong(c,LCS(alen,blen)); addReplyLongLong(c,LCS(alen,blen));
......
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