mirror of
https://github.com/fluencelabs/redis
synced 2025-06-13 09:11:20 +00:00
Inline sdslen and sdsavail (thanks to @bitbckt)
This commit is contained in:
12
src/sds.c
12
src/sds.c
@ -36,11 +36,11 @@
|
||||
|
||||
#define SDS_ABORT_ON_OOM
|
||||
|
||||
#include "sds.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include "sds.h"
|
||||
#include "zmalloc.h"
|
||||
|
||||
static void sdsOomAbort(void) {
|
||||
@ -78,11 +78,6 @@ sds sdsnew(const char *init) {
|
||||
return sdsnewlen(init, initlen);
|
||||
}
|
||||
|
||||
size_t sdslen(const sds s) {
|
||||
struct sdshdr *sh = (void*) (s-(sizeof(struct sdshdr)));
|
||||
return sh->len;
|
||||
}
|
||||
|
||||
sds sdsdup(const sds s) {
|
||||
return sdsnewlen(s, sdslen(s));
|
||||
}
|
||||
@ -92,11 +87,6 @@ void sdsfree(sds s) {
|
||||
zfree(s-sizeof(struct sdshdr));
|
||||
}
|
||||
|
||||
size_t sdsavail(sds s) {
|
||||
struct sdshdr *sh = (void*) (s-(sizeof(struct sdshdr)));
|
||||
return sh->free;
|
||||
}
|
||||
|
||||
void sdsupdatelen(sds s) {
|
||||
struct sdshdr *sh = (void*) (s-(sizeof(struct sdshdr)));
|
||||
int reallen = strlen(s);
|
||||
|
Reference in New Issue
Block a user