summaryrefslogtreecommitdiff
path: root/hiredis.c
diff options
context:
space:
mode:
authorPieter Noordhuis <pcnoordhuis@gmail.com>2010-09-20 15:26:18 +0200
committerPieter Noordhuis <pcnoordhuis@gmail.com>2010-09-20 15:26:18 +0200
commitb1fa529cf973247ba79f23b1b5c9249582fc1bfe (patch)
treeb249cfadf90d3be67eb5a5f92d7924c50cfd58a2 /hiredis.c
parente944ea366225d4a925cd3cd6ab927fa671ba6f1d (diff)
Add function to check if the reply reader is empty
Diffstat (limited to 'hiredis.c')
-rw-r--r--hiredis.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/hiredis.c b/hiredis.c
index 664cc44..0b7a17e 100644
--- a/hiredis.c
+++ b/hiredis.c
@@ -326,6 +326,15 @@ void redisFreeReplyReader(void *reader) {
free(r);
}
+int redisIsReplyReaderEmpty(void *reader) {
+ redisReader *r = reader;
+ if (r->buf != NULL && sdslen(r->buf) > 0)
+ return 0;
+ if (r->rlist != NULL && r->rpos < r->rlen)
+ return 0;
+ return 1;
+}
+
static void redisSetReplyReaderError(redisReader *r, redisReply *error) {
/* Clear remaining buffer when we see a protocol error. */
if (r->buf != NULL) {