首页
学习
活动
专区
工具
TVP
发布

我是业余自学C/C++的

专栏作者
138
文章
139556
阅读量
41
订阅数
redis_3.0.7_sds.c_dsRemoveFreeSpace()
源程序 sds sdsRemoveFreeSpace(sds s) { struct sdshdr *sh; sh = (void*)(s-(sizeof(struct sdshdr))); sh = realloc(sh,sizeof(struct sdshdr)+sh->len+1); //这一句源函数是zrealloc()函数,我替换成realloc()函数。 // sh->free; return sh->buf; } 删掉sds字符串中的空白部分,即将free的大
青木
2018-05-28
3650
redis_3.0.7_sds.c_sdsAllocSize()
源程序 size_t sdsAllocSize(sds s) { struct sdshdr *sh = (void*)(s-(sizeof(struct sdshdr))); return sizeof(*sh)+sh->len+sh->free+1; } 用来计算sds字符串总共的长度大小,包括为sds存储字符提供的大小,还有free的大小,还有字符串末尾的'\0'。
青木
2018-05-28
2910
redis_3.0.7_sds.c_sdsIncrLen()
源程序 void sdsIncrLen(sds s,int incr) { struct sdshdr *sh = (void*)(s-(sizeof(struct sdshdr))); if(incr >= 0) assert(sh->free >=(unsigned int)incr); else assert(sh->len >= (unsigned int)(-incr)); sh->len += incr; sh->free
青木
2018-05-28
5000
没有更多了
社区活动
腾讯技术创作狂欢月
“码”上创作 21 天,分 10000 元奖品池!
Python精品学习库
代码在线跑,知识轻松学
博客搬家 | 分享价值百万资源包
自行/邀约他人一键搬运博客,速成社区影响力并领取好礼
技术创作特训营·精选知识专栏
往期视频·千货材料·成员作品 最新动态
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档