Update hiredis and remove Windows patches (#9289)

Co-authored-by: Mehrdad <noreply@github.com>
This commit is contained in:
mehrdadn
2020-07-09 18:45:44 -07:00
committed by GitHub
co-authored by Mehrdad
parent dc51b08c36
commit dd2cc6eb48
8 changed files with 9 additions and 136 deletions
-28
View File
@@ -1,28 +0,0 @@
diff --git test.c test.c
--- test.c
+++ test.c
@@ -94,1 +94,1 @@
-static redisContext *connect(struct config config) {
+static redisContext *connect_(struct config config) {
@@ -251,1 +251,1 @@
- c = connect(config);
+ c = connect_(config);
@@ -390,1 +390,1 @@
- c = connect(config);
+ c = connect_(config);
@@ -471,1 +471,1 @@
- c = connect(config);
+ c = connect_(config);
@@ -483,1 +483,1 @@
- c = connect(config);
+ c = connect_(config);
@@ -517,1 +517,1 @@
- c = connect(config);
+ c = connect_(config);
@@ -552,1 +552,1 @@
- c = connect(config);
+ c = connect_(config);
@@ -586,1 +586,1 @@
- redisContext *c = connect(config);
+ redisContext *c = connect_(config);
--
+4 -5
View File
@@ -14,11 +14,10 @@ diff --git sds.h sds.h
+#pragma pack(pop)
+#endif
diff --git net.c net.c
--- net.c
+++ net.c
@@ -52,1 +52,4 @@
#include <stdlib.h>
diff --git fmacros.h fmacros.h
--- fmacros.h
+++ fmacros.h
@@ -12,0 +12,3 @@
+#if defined(_MSC_VER) && !defined(__clang__) && !defined(strdup)
+#define strdup _strdup
+#endif
-9
View File
@@ -1,9 +0,0 @@
diff --git test.c test.c
--- test.c
+++ test.c
@@ -762,2 +762,4 @@ int main(int argc, char **argv) {
+#ifndef _WIN32
/* Ignore broken pipe signal (for I/O error tests). */
signal(SIGPIPE, SIG_IGN);
+#endif
--
-58
View File
@@ -1,58 +0,0 @@
diff --git hiredis.c hiredis.c
--- hiredis.c
+++ hiredis.c
@@ -620,1 +620,1 @@
- close(c->fd);
+ redisContextCloseFd(c);
@@ -648,1 +648,1 @@
- close(c->fd);
+ redisContextCloseFd(c);
diff --git net.h net.h
--- net.h
+++ net.h
@@ -44,1 +44,2 @@
+void redisContextCloseFd(redisContext *c);
int redisContextConnectTcp(redisContext *c, const char *addr, int port, const struct timeval *timeout);
diff --git net.c net.c
--- net.c
+++ net.c
@@ -60,1 +60,1 @@
-static void redisContextCloseFd(redisContext *c) {
+void redisContextCloseFd(redisContext *c) {
@@ -102,24 +102,33 @@
static int redisSetBlocking(redisContext *c, int blocking) {
int flags;
- /* Set the socket nonblocking.
+ /* Set the socket nonblocking. */
+#ifdef _WINSOCKAPI_
+ unsigned long value = !blocking;
+ if (ioctlsocket(c->fd, FIONBIO, &value) == SOCKET_ERROR) {
+ __redisSetErrorFromErrno(c,REDIS_ERR_IO,"ioctlsocket(FIONBIO)");
+ redisContextCloseFd(c);
+ return REDIS_ERR;
+ }
+#else
- * Note that fcntl(2) for F_GETFL and F_SETFL can't be
+ /* Note that fcntl(2) for F_GETFL and F_SETFL can't be
* interrupted by a signal. */
if ((flags = fcntl(c->fd, F_GETFL)) == -1) {
__redisSetErrorFromErrno(c,REDIS_ERR_IO,"fcntl(F_GETFL)");
redisContextCloseFd(c);
return REDIS_ERR;
}
if (blocking)
flags &= ~O_NONBLOCK;
else
flags |= O_NONBLOCK;
if (fcntl(c->fd, F_SETFL, flags) == -1) {
__redisSetErrorFromErrno(c,REDIS_ERR_IO,"fcntl(F_SETFL)");
redisContextCloseFd(c);
return REDIS_ERR;
}
+#endif
return REDIS_OK;
}
--
-17
View File
@@ -1,17 +0,0 @@
diff --git hiredis.h hiredis.h
--- hiredis.h
+++ hiredis.h
@@ -87,5 +87,12 @@
+#ifdef _WIN32
+#define __redis_strerror_r(errno, buf, len) \
+ do { \
+ strerror_s((buf), (len), (errno)); \
+ } while (0)
+#else
/* "regular" POSIX strerror_r that does the right thing. */
#define __redis_strerror_r(errno, buf, len) \
do { \
strerror_r((errno), (buf), (len)); \
} while (0)
+#endif
--