diff options
author | antirez <antirez@gmail.com> | 2012-08-21 17:27:01 +0200 |
---|---|---|
committer | antirez <antirez@gmail.com> | 2012-08-21 17:27:01 +0200 |
commit | d6704c9bd0f03f277ee23a4e3e1fc86a74e130b3 (patch) | |
tree | e4572aeded1e354d0253128004e19d12e9329137 /deps/hiredis/hiredis.c | |
parent | cada7f9671da8af04400853bed3f3bc1790a522a (diff) | |
download | redis-d6704c9bd0f03f277ee23a4e3e1fc86a74e130b3.tar.gz |
hiredis library updated.
This version of hiredis merges modifications of the Redis fork with
latest changes in the hiredis repository.
The same version was pushed on the hiredis repository and will probably
merged into the master branch in short time.
Diffstat (limited to 'deps/hiredis/hiredis.c')
-rw-r--r-- | deps/hiredis/hiredis.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/deps/hiredis/hiredis.c b/deps/hiredis/hiredis.c index e6109db84..4709ee325 100644 --- a/deps/hiredis/hiredis.c +++ b/deps/hiredis/hiredis.c @@ -446,7 +446,7 @@ static int processMultiBulkItem(redisReader *r) { long elements; int root = 0; - /* Set error for nested multi bulks with depth > 2 */ + /* Set error for nested multi bulks with depth > 7 */ if (r->ridx == 8) { __redisReaderSetError(r,REDIS_ERR_PROTOCOL, "No support for nested multi bulk replies with depth > 7"); @@ -564,6 +564,7 @@ redisReader *redisReaderCreate(void) { r->errstr[0] = '\0'; r->fn = &defaultFunctions; r->buf = sdsempty(); + r->maxbuf = REDIS_READER_MAX_BUF; if (r->buf == NULL) { free(r); return NULL; @@ -590,9 +591,8 @@ int redisReaderFeed(redisReader *r, const char *buf, size_t len) { /* Copy the provided buffer. */ if (buf != NULL && len >= 1) { -#if 0 /* Destroy internal buffer when it is empty and is quite large. */ - if (r->len == 0 && sdsavail(r->buf) > 16*1024) { + if (r->len == 0 && r->maxbuf != 0 && sdsavail(r->buf) > r->maxbuf) { sdsfree(r->buf); r->buf = sdsempty(); r->pos = 0; @@ -600,7 +600,6 @@ int redisReaderFeed(redisReader *r, const char *buf, size_t len) { /* r->buf should not be NULL since we just free'd a larger one. */ assert(r->buf != NULL); } -#endif newbuf = sdscatlen(r->buf,buf,len); if (newbuf == NULL) { |