The reply object functions may not change the read tasks

This commit is contained in:
Pieter Noordhuis 2010-10-31 14:44:36 +01:00
parent 3f0394b8a9
commit 44a2d08b30
2 changed files with 12 additions and 12 deletions

View File

@ -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;

View File

@ -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;