summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPieter Noordhuis <pcnoordhuis@gmail.com>2010-10-31 14:44:36 +0100
committerPieter Noordhuis <pcnoordhuis@gmail.com>2010-10-31 14:44:36 +0100
commit44a2d08b304a8b4e9cc2e8f5be62edc7a7791af3 (patch)
tree250c5595e1aa3671938aa842786aa349ea7cf659
parent3f0394b8a91dd77560a2d1ae7bcafced0cbcffcf (diff)
The reply object functions may not change the read tasks
-rw-r--r--hiredis.c16
-rw-r--r--hiredis.h8
2 files changed, 12 insertions, 12 deletions
diff --git a/hiredis.c b/hiredis.c
index 16fed97..900d8d7 100644
--- a/hiredis.c
+++ b/hiredis.c
@@ -52,10 +52,10 @@ typedef struct redisReader {
} redisReader;
static redisReply *createReplyObject(int type);
-static void *createStringObject(redisReadTask *task, char *str, size_t len);
-static void *createArrayObject(redisReadTask *task, int elements);
-static void *createIntegerObject(redisReadTask *task, long long value);
-static void *createNilObject(redisReadTask *task);
+static void *createStringObject(const redisReadTask *task, char *str, size_t len);
+static void *createArrayObject(const redisReadTask *task, int elements);
+static void *createIntegerObject(const redisReadTask *task, long long value);
+static void *createNilObject(const redisReadTask *task);
static void redisSetReplyReaderError(redisReader *r, sds err);
/* Default set of functions to build the reply. */
@@ -103,7 +103,7 @@ void freeReplyObject(void *reply) {
free(r);
}
-static void *createStringObject(redisReadTask *task, char *str, size_t len) {
+static void *createStringObject(const redisReadTask *task, char *str, size_t len) {
redisReply *r = createReplyObject(task->type);
char *value = malloc(len+1);
if (!value) redisOOM();
@@ -125,7 +125,7 @@ static void *createStringObject(redisReadTask *task, char *str, size_t len) {
return r;
}
-static void *createArrayObject(redisReadTask *task, int elements) {
+static void *createArrayObject(const redisReadTask *task, int elements) {
redisReply *r = createReplyObject(REDIS_REPLY_ARRAY);
r->elements = elements;
if ((r->element = calloc(sizeof(redisReply*),elements)) == NULL)
@@ -138,7 +138,7 @@ static void *createArrayObject(redisReadTask *task, int elements) {
return r;
}
-static void *createIntegerObject(redisReadTask *task, long long value) {
+static void *createIntegerObject(const redisReadTask *task, long long value) {
redisReply *r = createReplyObject(REDIS_REPLY_INTEGER);
r->integer = value;
if (task->parent) {
@@ -149,7 +149,7 @@ static void *createIntegerObject(redisReadTask *task, long long value) {
return r;
}
-static void *createNilObject(redisReadTask *task) {
+static void *createNilObject(const redisReadTask *task) {
redisReply *r = createReplyObject(REDIS_REPLY_NIL);
if (task->parent) {
redisReply *parent = task->parent;
diff --git a/hiredis.h b/hiredis.h
index 08d1df9..11d9d05 100644
--- a/hiredis.h
+++ b/hiredis.h
@@ -67,10 +67,10 @@ typedef struct redisReadTask {
} redisReadTask;
typedef struct redisReplyObjectFunctions {
- void *(*createString)(redisReadTask*, char*, size_t);
- void *(*createArray)(redisReadTask*, int);
- void *(*createInteger)(redisReadTask*, long long);
- void *(*createNil)(redisReadTask*);
+ void *(*createString)(const redisReadTask*, char*, size_t);
+ void *(*createArray)(const redisReadTask*, int);
+ void *(*createInteger)(const redisReadTask*, long long);
+ void *(*createNil)(const redisReadTask*);
void (*freeObject)(void*);
} redisReplyObjectFunctions;