"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/t_list.c" between
redis-6.2-rc3.tar.gz and redis-6.2.0.tar.gz

About: redis is an advanced key-value store. It is often referred to as a data structure server since keys can contain strings, hashes, lists, sets and sorted sets.

t_list.c  (redis-6.2-rc3):t_list.c  (redis-6.2.0)
skipping to change at line 44 skipping to change at line 44
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/
/* The function pushes an element to the specified list object 'subject', /* The function pushes an element to the specified list object 'subject',
* at head or tail position as specified by 'where'. * at head or tail position as specified by 'where'.
* *
* There is no need for the caller to increment the refcount of 'value' as * There is no need for the caller to increment the refcount of 'value' as
* the function takes care of it if needed. */ * the function takes care of it if needed. */
void listTypePush(robj *subject, robj *value, int where) { void listTypePush(robj *subject, robj *value, int where) {
if (subject->encoding == OBJ_ENCODING_QUICKLIST) { if (subject->encoding == OBJ_ENCODING_QUICKLIST) {
int pos = (where == LIST_HEAD) ? QUICKLIST_HEAD : QUICKLIST_TAIL; int pos = (where == LIST_HEAD) ? QUICKLIST_HEAD : QUICKLIST_TAIL;
value = getDecodedObject(value); if (value->encoding == OBJ_ENCODING_INT) {
size_t len = sdslen(value->ptr); char buf[32];
quicklistPush(subject->ptr, value->ptr, len, pos); ll2string(buf, 32, (long)value->ptr);
decrRefCount(value); quicklistPush(subject->ptr, buf, strlen(buf), pos);
} else {
quicklistPush(subject->ptr, value->ptr, sdslen(value->ptr), pos);
}
} else { } else {
serverPanic("Unknown list encoding"); serverPanic("Unknown list encoding");
} }
} }
void *listPopSaver(unsigned char *data, unsigned int sz) { void *listPopSaver(unsigned char *data, unsigned int sz) {
return createStringObject((char*)data,sz); return createStringObject((char*)data,sz);
} }
robj *listTypePop(robj *subject, int where) { robj *listTypePop(robj *subject, int where) {
skipping to change at line 327 skipping to change at line 330
robj *o = lookupKeyReadOrReply(c,c->argv[1],shared.czero); robj *o = lookupKeyReadOrReply(c,c->argv[1],shared.czero);
if (o == NULL || checkType(c,o,OBJ_LIST)) return; if (o == NULL || checkType(c,o,OBJ_LIST)) return;
addReplyLongLong(c,listTypeLength(o)); addReplyLongLong(c,listTypeLength(o));
} }
/* LINDEX <key> <index> */ /* LINDEX <key> <index> */
void lindexCommand(client *c) { void lindexCommand(client *c) {
robj *o = lookupKeyReadOrReply(c,c->argv[1],shared.null[c->resp]); robj *o = lookupKeyReadOrReply(c,c->argv[1],shared.null[c->resp]);
if (o == NULL || checkType(c,o,OBJ_LIST)) return; if (o == NULL || checkType(c,o,OBJ_LIST)) return;
long index; long index;
robj *value = NULL;
if ((getLongFromObjectOrReply(c, c->argv[2], &index, NULL) != C_OK)) if ((getLongFromObjectOrReply(c, c->argv[2], &index, NULL) != C_OK))
return; return;
if (o->encoding == OBJ_ENCODING_QUICKLIST) { if (o->encoding == OBJ_ENCODING_QUICKLIST) {
quicklistEntry entry; quicklistEntry entry;
if (quicklistIndex(o->ptr, index, &entry)) { if (quicklistIndex(o->ptr, index, &entry)) {
if (entry.value) { if (entry.value) {
value = createStringObject((char*)entry.value,entry.sz); addReplyBulkCBuffer(c, entry.value, entry.sz);
} else { } else {
value = createStringObjectFromLongLong(entry.longval); addReplyBulkLongLong(c, entry.longval);
} }
addReplyBulk(c,value);
decrRefCount(value);
} else { } else {
addReplyNull(c); addReplyNull(c);
} }
} else { } else {
serverPanic("Unknown list encoding"); serverPanic("Unknown list encoding");
} }
} }
/* LSET <key> <index> <element> */ /* LSET <key> <index> <element> */
void lsetCommand(client *c) { void lsetCommand(client *c) {
 End of changes. 5 change blocks. 
9 lines changed or deleted 9 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)