summaryrefslogtreecommitdiff
path: root/hiredis.c
diff options
context:
space:
mode:
authorm <m@bitsnbites.eu>2019-03-31 18:05:32 +0200
committerMarcus Geelnard <marcus.geelnard@smarteye.se>2019-04-01 11:52:24 +0200
commite84086cb92bfcab88e7dfd7760351e3d2a65950d (patch)
tree795d60a35ed74ecb0eff74438f33e7228d0a2ad4 /hiredis.c
parent1788f41f168e7fe19a79908a58fc1841b60ab170 (diff)
Introduce a redisFD type
The redisFD type should be equal to the system native socket file desciptor type (for POSIX, this is a plain int). We also introduce the REDIS_INVALID_FD value, which maps to -1 on POSIX systems.
Diffstat (limited to 'hiredis.c')
-rw-r--r--hiredis.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/hiredis.c b/hiredis.c
index 629f43e..4a30da6 100644
--- a/hiredis.c
+++ b/hiredis.c
@@ -620,9 +620,9 @@ void redisFree(redisContext *c) {
free(c);
}
-int redisFreeKeepFd(redisContext *c) {
- int fd = c->fd;
- c->fd = -1;
+redisFD redisFreeKeepFd(redisContext *c) {
+ redisFD fd = c->fd;
+ c->fd = REDIS_INVALID_FD;
redisFree(c);
return fd;
}
@@ -746,7 +746,7 @@ redisContext *redisConnectUnixNonBlock(const char *path) {
return redisConnectWithOptions(&options);
}
-redisContext *redisConnectFd(int fd) {
+redisContext *redisConnectFd(redisFD fd) {
redisOptions options = {0};
options.type = REDIS_CONN_USERFD;
options.endpoint.fd = fd;