mirror of https://github.com/valkey-io/valkey
manual followup - replacing robj->ptr references with interface calls
Signed-off-by: Rain Valentine <rsg000@gmail.com>
This commit is contained in:
parent
3c1879749d
commit
a3cd615452
10
src/bitops.c
10
src/bitops.c
|
|
@ -1215,12 +1215,12 @@ void bitfieldGeneric(client *c, int flags) {
|
|||
uint64_t highest_write_offset = 0;
|
||||
|
||||
for (j = 2; j < c->argc; j++) {
|
||||
int remargs = c->argc - j - 1; /* Remaining args other than current. */
|
||||
int remargs = c->argc - j - 1; /* Remaining args other than current. */
|
||||
char *subcmd = objectGetVal(c->argv[j]); /* Current command name. */
|
||||
int opcode; /* Current operation code. */
|
||||
long long i64 = 0; /* Signed SET value. */
|
||||
int sign = 0; /* Signed or unsigned type? */
|
||||
int bits = 0; /* Bitfield width in bits. */
|
||||
int opcode; /* Current operation code. */
|
||||
long long i64 = 0; /* Signed SET value. */
|
||||
int sign = 0; /* Signed or unsigned type? */
|
||||
int bits = 0; /* Bitfield width in bits. */
|
||||
|
||||
if (!strcasecmp(subcmd, "get") && remargs >= 2)
|
||||
opcode = BITFIELDOP_GET;
|
||||
|
|
|
|||
15
src/defrag.c
15
src/defrag.c
|
|
@ -443,7 +443,10 @@ static void scanLaterHash(robj *ob, unsigned long *cursor) {
|
|||
static void defragQuicklist(robj *ob) {
|
||||
quicklist *ql = objectGetVal(ob), *newql;
|
||||
serverAssert(ob->type == OBJ_LIST && ob->encoding == OBJ_ENCODING_QUICKLIST);
|
||||
if ((newql = activeDefragAlloc(ql))) objectSetVal(ob, ql = newql);
|
||||
if ((newql = activeDefragAlloc(ql))) {
|
||||
objectSetVal(ob, newql);
|
||||
ql = newql;
|
||||
}
|
||||
if (ql->len > server.active_defrag_max_scan_fields)
|
||||
defragLater(ob);
|
||||
else
|
||||
|
|
@ -457,7 +460,10 @@ static void defragZsetSkiplist(robj *ob) {
|
|||
zset *newzs;
|
||||
zskiplist *newzsl;
|
||||
struct zskiplistNode *newheader;
|
||||
if ((newzs = activeDefragAlloc(zs))) objectSetVal(ob, zs = newzs);
|
||||
if ((newzs = activeDefragAlloc(zs))) {
|
||||
objectSetVal(ob, newzs);
|
||||
zs = newzs;
|
||||
}
|
||||
if ((newzsl = activeDefragAlloc(zs->zsl))) zs->zsl = newzsl;
|
||||
if ((newheader = activeDefragAlloc(zs->zsl->header))) zs->zsl->header = newheader;
|
||||
|
||||
|
|
@ -643,7 +649,10 @@ static void defragStream(robj *ob) {
|
|||
stream *s = objectGetVal(ob), *news;
|
||||
|
||||
/* handle the main struct */
|
||||
if ((news = activeDefragAlloc(s))) objectSetVal(ob, s = news);
|
||||
if ((news = activeDefragAlloc(s))) {
|
||||
objectSetVal(ob, news);
|
||||
s = news;
|
||||
}
|
||||
|
||||
if (raxSize(s->rax) > server.active_defrag_max_scan_fields) {
|
||||
rax *newrax = activeDefragAlloc(s->rax);
|
||||
|
|
|
|||
|
|
@ -14113,7 +14113,8 @@ int moduleDefragValue(robj *key, robj *value, int dbid) {
|
|||
*/
|
||||
moduleValue *newmv = activeDefragAlloc(mv);
|
||||
if (newmv) {
|
||||
objectSetVal(value, mv = newmv);
|
||||
objectSetVal(value, newmv);
|
||||
mv = newmv;
|
||||
}
|
||||
|
||||
if (!mt->defrag) return 1;
|
||||
|
|
|
|||
|
|
@ -243,7 +243,7 @@ robj *createStringObjectWithKeyAndExpire(const char *ptr, size_t len, const sds
|
|||
}
|
||||
|
||||
void *objectGetVal(const robj *o) {
|
||||
return objectGetVal(o);
|
||||
return o->val_ptr;
|
||||
}
|
||||
|
||||
sds objectGetKey(const robj *o) {
|
||||
|
|
@ -288,7 +288,7 @@ robj *objectSetExpire(robj *o, long long expire) {
|
|||
}
|
||||
|
||||
void objectSetVal(robj *o, void *val) {
|
||||
objectSetVal(o, val);
|
||||
o->val_ptr = val;
|
||||
}
|
||||
|
||||
/* This functions may reallocate the value. The new allocation is returned and
|
||||
|
|
|
|||
|
|
@ -796,7 +796,7 @@ struct serverObject {
|
|||
unsigned hasexpire : 1;
|
||||
unsigned hasembkey : 1;
|
||||
unsigned refcount : OBJ_REFCOUNT_BITS;
|
||||
void *ptr;
|
||||
void *val_ptr;
|
||||
};
|
||||
|
||||
/* The string name for an object's type as listed above
|
||||
|
|
@ -815,7 +815,7 @@ char *getObjectTypeName(robj *);
|
|||
_var.encoding = OBJ_ENCODING_RAW; \
|
||||
_var.hasexpire = 0; \
|
||||
_var.hasembkey = 0; \
|
||||
_var.ptr = _ptr; \
|
||||
_var.val_ptr = _ptr; \
|
||||
} while (0)
|
||||
|
||||
struct evictionPoolEntry; /* Defined in evict.c */
|
||||
|
|
|
|||
10
src/t_list.c
10
src/t_list.c
|
|
@ -164,13 +164,15 @@ void listTypePush(robj *subject, robj *value, int where) {
|
|||
quicklistPush(objectGetVal(subject), objectGetVal(value), sdslen(objectGetVal(value)), pos);
|
||||
}
|
||||
} else if (subject->encoding == OBJ_ENCODING_LISTPACK) {
|
||||
unsigned char *new_val = NULL;
|
||||
if (value->encoding == OBJ_ENCODING_INT) {
|
||||
subject->ptr = (where == LIST_HEAD) ? lpPrependInteger(objectGetVal(subject), (long)objectGetVal(value))
|
||||
: lpAppendInteger(objectGetVal(subject), (long)objectGetVal(value));
|
||||
new_val = (where == LIST_HEAD) ? lpPrependInteger(objectGetVal(subject), (long)objectGetVal(value))
|
||||
: lpAppendInteger(objectGetVal(subject), (long)objectGetVal(value));
|
||||
} else {
|
||||
subject->ptr = (where == LIST_HEAD) ? lpPrepend(objectGetVal(subject), objectGetVal(value), sdslen(objectGetVal(value)))
|
||||
: lpAppend(objectGetVal(subject), objectGetVal(value), sdslen(objectGetVal(value)));
|
||||
new_val = (where == LIST_HEAD) ? lpPrepend(objectGetVal(subject), objectGetVal(value), sdslen(objectGetVal(value)))
|
||||
: lpAppend(objectGetVal(subject), objectGetVal(value), sdslen(objectGetVal(value)));
|
||||
}
|
||||
objectSetVal(subject, new_val);
|
||||
} else {
|
||||
serverPanic("Unknown list encoding");
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue