Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
c7822bf3
Commit
c7822bf3
authored
Jul 16, 2014
by
antirez
Browse files
RDB: load string objects directly as EMBSTR objects when possible.
parent
9e7e0cd6
Changes
1
Show whitespace changes
Inline
Side-by-side
src/rdb.c
View file @
c7822bf3
...
@@ -333,7 +333,7 @@ int rdbSaveStringObject(rio *rdb, robj *obj) {
...
@@ -333,7 +333,7 @@ int rdbSaveStringObject(rio *rdb, robj *obj) {
robj *rdbGenericLoadStringObject(rio *rdb, int encode) {
robj *rdbGenericLoadStringObject(rio *rdb, int encode) {
int isencoded;
int isencoded;
uint32_t len;
uint32_t len;
sds
val
;
robj *o
;
len = rdbLoadLen(rdb,&isencoded);
len = rdbLoadLen(rdb,&isencoded);
if (isencoded) {
if (isencoded) {
...
@@ -350,12 +350,13 @@ robj *rdbGenericLoadStringObject(rio *rdb, int encode) {
...
@@ -350,12 +350,13 @@ robj *rdbGenericLoadStringObject(rio *rdb, int encode) {
}
}
if (len == REDIS_RDB_LENERR) return NULL;
if (len == REDIS_RDB_LENERR) return NULL;
val
=
sdsnewlen
(
NULL
,
len
);
o = encode ? createStringObject(NULL,len) :
if
(
len
&&
rioRead
(
rdb
,
val
,
len
)
==
0
)
{
createRawStringObject(NULL,len);
sdsfree
(
val
);
if (len && rioRead(rdb,o->ptr,len) == 0) {
decrRefCount(o);
return NULL;
return NULL;
}
}
return
createObject
(
REDIS_STRING
,
val
)
;
return
o
;
}
}
robj *rdbLoadStringObject(rio *rdb) {
robj *rdbLoadStringObject(rio *rdb) {
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment