Comments (3)
同样疑惑。
过来确认的时候发现,15年以后就没更新了。。
from redis-3.0-annotated.
同样的疑惑,过来确认一下我没错
from redis-3.0-annotated.
sds sdstrim(sds s, const char *cset)
{
struct sdshdr *sh = (void *)(s - (sizeof(struct sdshdr)));
char *start, *end, *sp, *ep;
size_t len;
// 设置和记录指针
sp = start = s;
ep = end = s + sdslen(s) - 1;
// 修剪, T = O(N^2) ===========================>这里是不是也错了???
while (sp <= end && strchr(cset, *sp))
sp++;
while (ep > start && strchr(cset, *ep))
ep--;
// 计算 trim 完毕之后剩余的字符串长度
len = (sp > ep) ? 0 : ((ep - sp) + 1);
// 如果有需要,前移字符串内容
// T = O(N)
if (sh->buf != sp)
memmove(sh->buf, sp, len);
// 添加终结符
sh->buf[len] = '\0';
// 更新属性
sh->free = sh->free + (sh->len - len);
sh->len = len;
// 返回修剪后的 sds
return s;
}
from redis-3.0-annotated.
Related Issues (20)
- 这个repo还维护么
- Getting more done in GitHub with ZenHub
- 关于hashFunction的一点疑问
- redis 3.2 sds改动了
- 集群方面的代码可以更详细些
- redis数据rdb文件结构, EOF字段用一个字节存储不了377,是不是写错了? HOT 1
- 为什么redis哨兵每次要建立2个socket连接?
- redis.h 中 zskiplistNode 结构体中的 level 是如何定义的 HOT 2
- clusterSendPing当中的疑问 HOT 1
- 关于dictRehash的疑问 HOT 1
- 向大家请教一下跳跃表插入节点函数中的两句代码的含义? HOT 2
- 各位大神,我想修改redis3.2.5中的set数据类型的sinter,sdiff命令直接返回交集差集的大小,大神们有没有可以指点下的?
- 试图本地编译一下代码,make失败了,请问huangz,你哪里可以成 HOT 1
- 关于客户端源码hiredis读取服务端响应问题
- p & 3 含义是什么
- sdscatvprintf 时间复杂度问题
- zskiplistNode level为何什么是个数组 HOT 1
- 这里是不是有误?
- Hello my friend nice to meet you HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from redis-3.0-annotated.