Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xindoo
redis
提交
23d3a5fe
R
redis
项目概览
xindoo
/
redis
通知
2
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
redis
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
23d3a5fe
编写于
6月 11, 2010
作者:
P
Pieter Noordhuis
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
make LINSERT return -1 when the value could not be inserted
上级
70b4b320
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
10 addition
and
5 deletion
+10
-5
redis.c
redis.c
+6
-1
tests/unit/type/list.tcl
tests/unit/type/list.tcl
+4
-4
未找到文件。
redis.c
浏览文件 @
23d3a5fe
...
...
@@ -538,7 +538,7 @@ typedef struct zset {
#define REDIS_SHARED_INTEGERS 10000
struct
sharedObjectsStruct
{
robj
*
crlf
,
*
ok
,
*
err
,
*
emptybulk
,
*
czero
,
*
cone
,
*
pong
,
*
space
,
robj
*
crlf
,
*
ok
,
*
err
,
*
emptybulk
,
*
czero
,
*
cone
,
*
cnegone
,
*
pong
,
*
space
,
*
colon
,
*
nullbulk
,
*
nullmultibulk
,
*
queued
,
*
emptymultibulk
,
*
wrongtypeerr
,
*
nokeyerr
,
*
syntaxerr
,
*
sameobjecterr
,
*
outofrangeerr
,
*
plus
,
...
...
@@ -1677,6 +1677,7 @@ static void createSharedObjects(void) {
shared
.
emptybulk
=
createObject
(
REDIS_STRING
,
sdsnew
(
"$0
\r\n\r\n
"
));
shared
.
czero
=
createObject
(
REDIS_STRING
,
sdsnew
(
":0
\r\n
"
));
shared
.
cone
=
createObject
(
REDIS_STRING
,
sdsnew
(
":1
\r\n
"
));
shared
.
cnegone
=
createObject
(
REDIS_STRING
,
sdsnew
(
":-1
\r\n
"
));
shared
.
nullbulk
=
createObject
(
REDIS_STRING
,
sdsnew
(
"$-1
\r\n
"
));
shared
.
nullmultibulk
=
createObject
(
REDIS_STRING
,
sdsnew
(
"*-1
\r\n
"
));
shared
.
emptymultibulk
=
createObject
(
REDIS_STRING
,
sdsnew
(
"*0
\r\n
"
));
...
...
@@ -5252,6 +5253,10 @@ static void pushxGenericCommand(redisClient *c, robj *refval, robj *val, int whe
ziplistLen
(
subject
->
ptr
)
>
server
.
list_max_ziplist_entries
)
listTypeConvert
(
subject
,
REDIS_ENCODING_LIST
);
server
.
dirty
++
;
}
else
{
/* Notify client of a failed insert */
addReply
(
c
,
shared
.
cnegone
);
return
;
}
}
else
{
listTypePush
(
subject
,
val
,
where
);
...
...
tests/unit/type/list.tcl
浏览文件 @
23d3a5fe
...
...
@@ -101,10 +101,10 @@ start_server {
assert_equal 6
[
r linsert xlist after c yy
]
assert_equal
{
a b zz c yy d
}
[
r lrange xlist 0 10
]
assert_equal 7
[
r linsert xlist after d dd
]
assert_equal
7
[
r linsert xlist after bad ddd
]
assert_equal
-1
[
r linsert xlist after bad ddd
]
assert_equal
{
a b zz c yy d dd
}
[
r lrange xlist 0 10
]
assert_equal 8
[
r linsert xlist before a aa
]
assert_equal
8
[
r linsert xlist before bad aaa
]
assert_equal
-1
[
r linsert xlist before bad aaa
]
assert_equal
{
aa a b zz c yy d dd
}
[
r lrange xlist 0 10
]
# check inserting integer encoded value
...
...
@@ -154,10 +154,10 @@ start_server {
# don't convert when the value could not be inserted
create_ziplist xlist
[
lrepeat 256 a
]
assert_equal
256
[
r linsert xlist before foo a
]
assert_equal
-1
[
r linsert xlist before foo a
]
assert_encoding ziplist xlist
create_ziplist xlist
[
lrepeat 256 a
]
assert_equal
256
[
r linsert xlist after foo a
]
assert_equal
-1
[
r linsert xlist after foo a
]
assert_encoding ziplist xlist
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录