mirror of https://mirror.osredm.com/root/redis.git
Change function name to match what it does
This commit is contained in:
parent
586500c0ef
commit
cc20906390
|
@ -117,8 +117,8 @@ static sds sdsMakeRoomFor(sds s, size_t addlen) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Grow the sds to have the specified length. Bytes that were not part of
|
/* Grow the sds to have the specified length. Bytes that were not part of
|
||||||
* the original length of the sds will be set to NULL. */
|
* the original length of the sds will be set to zero. */
|
||||||
sds sdsgrowsafe(sds s, size_t len) {
|
sds sdsgrowzero(sds s, size_t len) {
|
||||||
struct sdshdr *sh = (void*)(s-(sizeof(struct sdshdr)));
|
struct sdshdr *sh = (void*)(s-(sizeof(struct sdshdr)));
|
||||||
size_t totlen, curlen = sh->len;
|
size_t totlen, curlen = sh->len;
|
||||||
|
|
||||||
|
@ -128,7 +128,7 @@ sds sdsgrowsafe(sds s, size_t len) {
|
||||||
|
|
||||||
/* Make sure added region doesn't contain garbage */
|
/* Make sure added region doesn't contain garbage */
|
||||||
sh = (void*)(s-(sizeof(struct sdshdr)));
|
sh = (void*)(s-(sizeof(struct sdshdr)));
|
||||||
memset(s+curlen,0,(len-curlen+1)); /* also set trailing NULL byte */
|
memset(s+curlen,0,(len-curlen+1)); /* also set trailing \0 byte */
|
||||||
totlen = sh->len+sh->free;
|
totlen = sh->len+sh->free;
|
||||||
sh->len = len;
|
sh->len = len;
|
||||||
sh->free = totlen-sh->len;
|
sh->free = totlen-sh->len;
|
||||||
|
|
|
@ -49,7 +49,7 @@ size_t sdslen(const sds s);
|
||||||
sds sdsdup(const sds s);
|
sds sdsdup(const sds s);
|
||||||
void sdsfree(sds s);
|
void sdsfree(sds s);
|
||||||
size_t sdsavail(sds s);
|
size_t sdsavail(sds s);
|
||||||
sds sdsgrowsafe(sds s, size_t len);
|
sds sdsgrowzero(sds s, size_t len);
|
||||||
sds sdscatlen(sds s, void *t, size_t len);
|
sds sdscatlen(sds s, void *t, size_t len);
|
||||||
sds sdscat(sds s, char *t);
|
sds sdscat(sds s, char *t);
|
||||||
sds sdscpylen(sds s, char *t, size_t len);
|
sds sdscpylen(sds s, char *t, size_t len);
|
||||||
|
|
|
@ -139,7 +139,7 @@ void setbitCommand(redisClient *c) {
|
||||||
byte = bitoffset >> 3;
|
byte = bitoffset >> 3;
|
||||||
bit = 7 - (bitoffset & 0x7);
|
bit = 7 - (bitoffset & 0x7);
|
||||||
on = bitvalue & 0x1;
|
on = bitvalue & 0x1;
|
||||||
o->ptr = sdsgrowsafe(o->ptr,byte+1);
|
o->ptr = sdsgrowzero(o->ptr,byte+1);
|
||||||
((char*)o->ptr)[byte] |= on << bit;
|
((char*)o->ptr)[byte] |= on << bit;
|
||||||
((char*)o->ptr)[byte] &= ~((!on) << bit);
|
((char*)o->ptr)[byte] &= ~((!on) << bit);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue