hello, erverybody!
i looking the source code of redis and have some query.
why we need judge obj for each j?
the obj object not have matter with argv.
it's unnecessary? or some other reason?
t_list.c:pushGenericCommand:197
for (j = 2; j < c->argc; j++) {
if (!lobj) {
lobj = createQuicklistObject();
quicklistSetOptions(lobj->ptr, server.list_max_ziplist_size,
server.list_compress_depth);
dbAdd(c->db,c->argv[1],lobj);
}
listTypePush(lobj,c->argv[j],where);
pushed++;
}
i think like such as
if (!lobj) {
lobj = createQuicklistObject();
quicklistSetOptions(lobj->ptr, server.list_max_ziplist_size,
server.list_compress_depth);
dbAdd(c->db,c->argv[1],lobj);
}
for (j = 2; j < c->argc; j++) {
listTypePush(lobj,c->argv[j],where);
pushed++;
}
Comment From: trevor211
Since a PR has been proposed, this issue is safe to close. @itamarhaber