Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
别团等shy哥发育
redis
提交
279d7e67
R
redis
项目概览
别团等shy哥发育
/
redis
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
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,发现更多精彩内容 >>
提交
279d7e67
编写于
6月 11, 2010
作者:
P
Pieter Noordhuis
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
use REDIS_TAIL to insert AFTER an entry and REDIS_HEAD to insert BEFORE an entry
上级
0e1684bc
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
7 addition
and
7 deletion
+7
-7
redis.c
redis.c
+7
-7
未找到文件。
redis.c
浏览文件 @
279d7e67
...
...
@@ -5091,7 +5091,7 @@ static robj *listTypeGet(listTypeEntry *entry) {
static
void
listTypeInsert
(
robj
*
subject
,
listTypeEntry
*
old_entry
,
robj
*
new_obj
,
int
where
)
{
listTypeTryConversion
(
subject
,
new_obj
);
if
(
subject
->
encoding
==
REDIS_ENCODING_ZIPLIST
)
{
if
(
where
==
REDIS_
HEAD
)
{
if
(
where
==
REDIS_
TAIL
)
{
unsigned
char
*
next
=
ziplistNext
(
subject
->
ptr
,
old_entry
->
zi
);
if
(
next
==
NULL
)
{
listTypePush
(
subject
,
new_obj
,
REDIS_TAIL
);
...
...
@@ -5102,10 +5102,10 @@ static void listTypeInsert(robj *subject, listTypeEntry *old_entry, robj *new_ob
subject
->
ptr
=
ziplistInsert
(
subject
->
ptr
,
old_entry
->
zi
,
new_obj
->
ptr
,
sdslen
(
new_obj
->
ptr
));
}
}
else
if
(
subject
->
encoding
==
REDIS_ENCODING_LIST
)
{
if
(
where
==
REDIS_
HEAD
)
{
listInsertNode
(
subject
->
ptr
,
old_entry
->
ln
,
new_obj
,
1
);
if
(
where
==
REDIS_
TAIL
)
{
listInsertNode
(
subject
->
ptr
,
old_entry
->
ln
,
new_obj
,
AL_START_TAIL
);
}
else
{
listInsertNode
(
subject
->
ptr
,
old_entry
->
ln
,
new_obj
,
0
);
listInsertNode
(
subject
->
ptr
,
old_entry
->
ln
,
new_obj
,
AL_START_HEAD
);
}
incrRefCount
(
new_obj
);
}
else
{
...
...
@@ -5218,7 +5218,7 @@ static void pushxGenericCommand(redisClient *c, int where, robj *old_obj, robj *
}
if
(
old_obj
!=
NULL
)
{
if
(
where
==
REDIS_
HEAD
)
{
if
(
where
==
REDIS_
TAIL
)
{
iter
=
listTypeInitIterator
(
subject
,
0
,
REDIS_TAIL
);
}
else
{
iter
=
listTypeInitIterator
(
subject
,
-
1
,
REDIS_HEAD
);
...
...
@@ -5248,9 +5248,9 @@ static void rpushxCommand(redisClient *c) {
static
void
linsertCommand
(
redisClient
*
c
)
{
if
(
strcasecmp
(
c
->
argv
[
2
]
->
ptr
,
"after"
)
==
0
)
{
pushxGenericCommand
(
c
,
REDIS_HEAD
,
c
->
argv
[
3
],
c
->
argv
[
4
]);
}
else
if
(
strcasecmp
(
c
->
argv
[
2
]
->
ptr
,
"before"
)
==
0
)
{
pushxGenericCommand
(
c
,
REDIS_TAIL
,
c
->
argv
[
3
],
c
->
argv
[
4
]);
}
else
if
(
strcasecmp
(
c
->
argv
[
2
]
->
ptr
,
"before"
)
==
0
)
{
pushxGenericCommand
(
c
,
REDIS_HEAD
,
c
->
argv
[
3
],
c
->
argv
[
4
]);
}
else
{
addReply
(
c
,
shared
.
syntaxerr
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录