From: antirez Date: Thu, 16 Sep 2010 10:02:18 +0000 (+0200) Subject: Merge remote branch 'pietern/networking-perf' X-Git-Url: https://git.saurik.com/redis.git/commitdiff_plain/83f39c7ab26e7f7cfa5fb59ca51b768e9ac0facb?hp=89f9f83769a2ad0b4aeb8907b82b453ace6ebe9d Merge remote branch 'pietern/networking-perf' --- diff --git a/src/networking.c b/src/networking.c index 96ce5a99..aefbc2d7 100644 --- a/src/networking.c +++ b/src/networking.c @@ -11,11 +11,7 @@ int listMatchObjects(void *a, void *b) { } redisClient *createClient(int fd) { - redisClient *c; - - /* Allocate more space to hold a static write buffer. */ - c = zmalloc(sizeof(redisClient)+REDIS_REPLY_CHUNK_BYTES); - c->buflen = REDIS_REPLY_CHUNK_BYTES; + redisClient *c = zmalloc(sizeof(redisClient)); c->bufpos = 0; anetNonBlock(NULL,fd); @@ -87,7 +83,7 @@ robj *dupLastObjectIfNeeded(list *reply) { } int _addReplyToBuffer(redisClient *c, char *s, size_t len) { - size_t available = c->buflen-c->bufpos; + size_t available = sizeof(c->buf)-c->bufpos; /* If there already are entries in the reply list, we cannot * add anything more to the static buffer. */ diff --git a/src/redis.h b/src/redis.h index 1ef56288..38727ae2 100644 --- a/src/redis.h +++ b/src/redis.h @@ -313,8 +313,7 @@ typedef struct redisClient { /* Response buffer */ int bufpos; - int buflen; - char buf[]; + char buf[REDIS_REPLY_CHUNK_BYTES]; } redisClient; struct saveparam {