LCS: output LCS len as well in IDX mode.
This commit is contained in:
parent
a3690e8af7
commit
28cf335ba8
@ -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) {
|
|||||||
|
|
||||||
/* 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));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user