Remove useless casts
This commit is contained in:
parent
e1abacb7b4
commit
2002218981
17
hiredis.c
17
hiredis.c
@ -544,8 +544,7 @@ redisReader *redisReplyReaderCreate(void) {
|
|||||||
|
|
||||||
/* Set the function set to build the reply. Returns REDIS_OK when there
|
/* Set the function set to build the reply. Returns REDIS_OK when there
|
||||||
* is no temporary object and it can be set, REDIS_ERR otherwise. */
|
* is no temporary object and it can be set, REDIS_ERR otherwise. */
|
||||||
int redisReplyReaderSetReplyObjectFunctions(redisReader *reader, redisReplyObjectFunctions *fn) {
|
int redisReplyReaderSetReplyObjectFunctions(redisReader *r, redisReplyObjectFunctions *fn) {
|
||||||
redisReader *r = reader;
|
|
||||||
if (r->reply == NULL) {
|
if (r->reply == NULL) {
|
||||||
r->fn = fn;
|
r->fn = fn;
|
||||||
return REDIS_OK;
|
return REDIS_OK;
|
||||||
@ -555,8 +554,7 @@ int redisReplyReaderSetReplyObjectFunctions(redisReader *reader, redisReplyObjec
|
|||||||
|
|
||||||
/* Set the private data field that is used in the read tasks. This argument can
|
/* Set the private data field that is used in the read tasks. This argument can
|
||||||
* be used to curry arbitrary data to the custom reply object functions. */
|
* be used to curry arbitrary data to the custom reply object functions. */
|
||||||
int redisReplyReaderSetPrivdata(redisReader *reader, void *privdata) {
|
int redisReplyReaderSetPrivdata(redisReader *r, void *privdata) {
|
||||||
redisReader *r = reader;
|
|
||||||
if (r->reply == NULL) {
|
if (r->reply == NULL) {
|
||||||
r->privdata = privdata;
|
r->privdata = privdata;
|
||||||
return REDIS_OK;
|
return REDIS_OK;
|
||||||
@ -564,8 +562,7 @@ int redisReplyReaderSetPrivdata(redisReader *reader, void *privdata) {
|
|||||||
return REDIS_ERR;
|
return REDIS_ERR;
|
||||||
}
|
}
|
||||||
|
|
||||||
void redisReplyReaderFree(redisReader *reader) {
|
void redisReplyReaderFree(redisReader *r) {
|
||||||
redisReader *r = reader;
|
|
||||||
if (r->reply != NULL && r->fn && r->fn->freeObject)
|
if (r->reply != NULL && r->fn && r->fn->freeObject)
|
||||||
r->fn->freeObject(r->reply);
|
r->fn->freeObject(r->reply);
|
||||||
if (r->buf != NULL)
|
if (r->buf != NULL)
|
||||||
@ -573,9 +570,7 @@ void redisReplyReaderFree(redisReader *reader) {
|
|||||||
free(r);
|
free(r);
|
||||||
}
|
}
|
||||||
|
|
||||||
void redisReplyReaderFeed(redisReader *reader, const char *buf, size_t len) {
|
void redisReplyReaderFeed(redisReader *r, const char *buf, size_t len) {
|
||||||
redisReader *r = reader;
|
|
||||||
|
|
||||||
/* Copy the provided buffer. */
|
/* Copy the provided buffer. */
|
||||||
if (buf != NULL && len >= 1) {
|
if (buf != NULL && len >= 1) {
|
||||||
/* Destroy internal buffer when it is empty and is quite large. */
|
/* Destroy internal buffer when it is empty and is quite large. */
|
||||||
@ -590,9 +585,7 @@ void redisReplyReaderFeed(redisReader *reader, const char *buf, size_t len) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int redisReplyReaderGetReply(redisReader *reader, void **reply) {
|
int redisReplyReaderGetReply(redisReader *r, void **reply) {
|
||||||
redisReader *r = reader;
|
|
||||||
|
|
||||||
/* Default target pointer to NULL. */
|
/* Default target pointer to NULL. */
|
||||||
if (reply != NULL)
|
if (reply != NULL)
|
||||||
*reply = NULL;
|
*reply = NULL;
|
||||||
|
10
hiredis.h
10
hiredis.h
@ -133,11 +133,11 @@ typedef struct redisReader {
|
|||||||
|
|
||||||
void freeReplyObject(void *reply);
|
void freeReplyObject(void *reply);
|
||||||
redisReader *redisReplyReaderCreate(void);
|
redisReader *redisReplyReaderCreate(void);
|
||||||
int redisReplyReaderSetReplyObjectFunctions(redisReader *reader, redisReplyObjectFunctions *fn);
|
int redisReplyReaderSetReplyObjectFunctions(redisReader *r, redisReplyObjectFunctions *fn);
|
||||||
int redisReplyReaderSetPrivdata(redisReader *reader, void *privdata);
|
int redisReplyReaderSetPrivdata(redisReader *r, void *privdata);
|
||||||
void redisReplyReaderFree(redisReader *ptr);
|
void redisReplyReaderFree(redisReader *r);
|
||||||
void redisReplyReaderFeed(redisReader *reader, const char *buf, size_t len);
|
void redisReplyReaderFeed(redisReader *r, const char *buf, size_t len);
|
||||||
int redisReplyReaderGetReply(redisReader *reader, void **reply);
|
int redisReplyReaderGetReply(redisReader *r, void **reply);
|
||||||
|
|
||||||
/* Backwards compatibility, can be removed on big version bump. */
|
/* Backwards compatibility, can be removed on big version bump. */
|
||||||
#define redisReplyReaderGetObject(_r) (((redisReader*)(r))->reply)
|
#define redisReplyReaderGetObject(_r) (((redisReader*)(r))->reply)
|
||||||
|
Loading…
Reference in New Issue
Block a user