mirror of
https://codeberg.org/redict/redict.git
synced 2025-01-22 16:18:28 -05:00
RESP3: Use new aggregate reply API in t_set.c.
This commit is contained in:
parent
dcbd40cea4
commit
feb6b31832
12
src/t_set.c
12
src/t_set.c
@ -455,7 +455,7 @@ void spopWithCountCommand(client *c) {
|
|||||||
robj *propargv[3];
|
robj *propargv[3];
|
||||||
propargv[0] = createStringObject("SREM",4);
|
propargv[0] = createStringObject("SREM",4);
|
||||||
propargv[1] = c->argv[1];
|
propargv[1] = c->argv[1];
|
||||||
addReplyMultiBulkLen(c,count);
|
addReplySetLen(c,count);
|
||||||
|
|
||||||
/* Common iteration vars. */
|
/* Common iteration vars. */
|
||||||
sds sdsele;
|
sds sdsele;
|
||||||
@ -647,7 +647,7 @@ void srandmemberWithCountCommand(client *c) {
|
|||||||
* This case is trivial and can be served without auxiliary data
|
* This case is trivial and can be served without auxiliary data
|
||||||
* structures. */
|
* structures. */
|
||||||
if (!uniq) {
|
if (!uniq) {
|
||||||
addReplyMultiBulkLen(c,count);
|
addReplySetLen(c,count);
|
||||||
while(count--) {
|
while(count--) {
|
||||||
encoding = setTypeRandomElement(set,&ele,&llele);
|
encoding = setTypeRandomElement(set,&ele,&llele);
|
||||||
if (encoding == OBJ_ENCODING_INTSET) {
|
if (encoding == OBJ_ENCODING_INTSET) {
|
||||||
@ -737,7 +737,7 @@ void srandmemberWithCountCommand(client *c) {
|
|||||||
dictIterator *di;
|
dictIterator *di;
|
||||||
dictEntry *de;
|
dictEntry *de;
|
||||||
|
|
||||||
addReplyMultiBulkLen(c,count);
|
addReplySetLen(c,count);
|
||||||
di = dictGetIterator(d);
|
di = dictGetIterator(d);
|
||||||
while((de = dictNext(di)) != NULL)
|
while((de = dictNext(di)) != NULL)
|
||||||
addReplyBulk(c,dictGetKey(de));
|
addReplyBulk(c,dictGetKey(de));
|
||||||
@ -833,7 +833,7 @@ void sinterGenericCommand(client *c, robj **setkeys,
|
|||||||
* to the output list and save the pointer to later modify it with the
|
* to the output list and save the pointer to later modify it with the
|
||||||
* right length */
|
* right length */
|
||||||
if (!dstkey) {
|
if (!dstkey) {
|
||||||
replylen = addDeferredMultiBulkLength(c);
|
replylen = addReplyDeferredLen(c);
|
||||||
} else {
|
} else {
|
||||||
/* If we have a target key where to store the resulting set
|
/* If we have a target key where to store the resulting set
|
||||||
* create this key with an empty set inside */
|
* create this key with an empty set inside */
|
||||||
@ -911,7 +911,7 @@ void sinterGenericCommand(client *c, robj **setkeys,
|
|||||||
signalModifiedKey(c->db,dstkey);
|
signalModifiedKey(c->db,dstkey);
|
||||||
server.dirty++;
|
server.dirty++;
|
||||||
} else {
|
} else {
|
||||||
setDeferredMultiBulkLength(c,replylen,cardinality);
|
setDeferredSetLen(c,replylen,cardinality);
|
||||||
}
|
}
|
||||||
zfree(sets);
|
zfree(sets);
|
||||||
}
|
}
|
||||||
@ -1057,7 +1057,7 @@ void sunionDiffGenericCommand(client *c, robj **setkeys, int setnum,
|
|||||||
|
|
||||||
/* Output the content of the resulting set, if not in STORE mode */
|
/* Output the content of the resulting set, if not in STORE mode */
|
||||||
if (!dstkey) {
|
if (!dstkey) {
|
||||||
addReplyMultiBulkLen(c,cardinality);
|
addReplySetLen(c,cardinality);
|
||||||
si = setTypeInitIterator(dstset);
|
si = setTypeInitIterator(dstset);
|
||||||
while((ele = setTypeNextObject(si)) != NULL) {
|
while((ele = setTypeNextObject(si)) != NULL) {
|
||||||
addReplyBulkCBuffer(c,ele,sdslen(ele));
|
addReplyBulkCBuffer(c,ele,sdslen(ele));
|
||||||
|
Loading…
Reference in New Issue
Block a user