Housekeeping fixes (#764)
Housekeeping * Check for C++ (#758, #750) * Include `alloc.h` in `make install` and `cmake` * Add a `.def` file for Windows (#760) * Include allocation wrappers referenced in adapter headers * Fix minor syntax errors and typos in README * Fix CI in Windows by properly escaping arguments (#761)
This commit is contained in:
parent
3421ac3093
commit
38675d23cc
@ -91,7 +91,6 @@ matrix:
|
|||||||
- choco install ninja
|
- choco install ninja
|
||||||
script:
|
script:
|
||||||
- mkdir build && cd build
|
- mkdir build && cd build
|
||||||
- cmd.exe /C '"C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Auxiliary\Build\vcvarsall.bat" amd64 &&
|
- cmd.exe //C 'C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Auxiliary\Build\vcvarsall.bat' amd64 '&&'
|
||||||
cmake .. -G Ninja -DCMAKE_BUILD_TYPE=Release &&
|
cmake .. -G Ninja -DCMAKE_BUILD_TYPE=Release '&&' ninja -v
|
||||||
ninja -v'
|
|
||||||
- ctest -V
|
- ctest -V
|
||||||
|
@ -23,7 +23,7 @@ PROJECT(hiredis VERSION "${VERSION}")
|
|||||||
|
|
||||||
SET(ENABLE_EXAMPLES OFF CACHE BOOL "Enable building hiredis examples")
|
SET(ENABLE_EXAMPLES OFF CACHE BOOL "Enable building hiredis examples")
|
||||||
|
|
||||||
ADD_LIBRARY(hiredis SHARED
|
SET(hiredis_sources
|
||||||
async.c
|
async.c
|
||||||
dict.c
|
dict.c
|
||||||
hiredis.c
|
hiredis.c
|
||||||
@ -33,6 +33,15 @@ ADD_LIBRARY(hiredis SHARED
|
|||||||
sockcompat.c
|
sockcompat.c
|
||||||
alloc.c)
|
alloc.c)
|
||||||
|
|
||||||
|
IF(WIN32)
|
||||||
|
SET(hiredis_sources
|
||||||
|
${hiredis_sources}
|
||||||
|
hiredis.def
|
||||||
|
)
|
||||||
|
ENDIF()
|
||||||
|
|
||||||
|
ADD_LIBRARY(hiredis SHARED ${hiredis_sources})
|
||||||
|
|
||||||
SET_TARGET_PROPERTIES(hiredis
|
SET_TARGET_PROPERTIES(hiredis
|
||||||
PROPERTIES
|
PROPERTIES
|
||||||
VERSION "${HIREDIS_SONAME}")
|
VERSION "${HIREDIS_SONAME}")
|
||||||
@ -46,7 +55,7 @@ CONFIGURE_FILE(hiredis.pc.in hiredis.pc @ONLY)
|
|||||||
INSTALL(TARGETS hiredis
|
INSTALL(TARGETS hiredis
|
||||||
DESTINATION "${CMAKE_INSTALL_LIBDIR}")
|
DESTINATION "${CMAKE_INSTALL_LIBDIR}")
|
||||||
|
|
||||||
INSTALL(FILES hiredis.h read.h sds.h async.h
|
INSTALL(FILES hiredis.h read.h sds.h async.h alloc.h
|
||||||
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/hiredis)
|
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/hiredis)
|
||||||
|
|
||||||
INSTALL(DIRECTORY adapters
|
INSTALL(DIRECTORY adapters
|
||||||
|
10
README.md
10
README.md
@ -205,16 +205,16 @@ a single call to `read(2)`):
|
|||||||
redisReply *reply;
|
redisReply *reply;
|
||||||
redisAppendCommand(context,"SET foo bar");
|
redisAppendCommand(context,"SET foo bar");
|
||||||
redisAppendCommand(context,"GET foo");
|
redisAppendCommand(context,"GET foo");
|
||||||
redisGetReply(context,&reply); // reply for SET
|
redisGetReply(context,(void *)&reply); // reply for SET
|
||||||
freeReplyObject(reply);
|
freeReplyObject(reply);
|
||||||
redisGetReply(context,&reply); // reply for GET
|
redisGetReply(context,(void *)&reply); // reply for GET
|
||||||
freeReplyObject(reply);
|
freeReplyObject(reply);
|
||||||
```
|
```
|
||||||
This API can also be used to implement a blocking subscriber:
|
This API can also be used to implement a blocking subscriber:
|
||||||
```c
|
```c
|
||||||
reply = redisCommand(context,"SUBSCRIBE foo");
|
reply = redisCommand(context,"SUBSCRIBE foo");
|
||||||
freeReplyObject(reply);
|
freeReplyObject(reply);
|
||||||
while(redisGetReply(context,&reply) == REDIS_OK) {
|
while(redisGetReply(context,(void *)&reply) == REDIS_OK) {
|
||||||
// consume message
|
// consume message
|
||||||
freeReplyObject(reply);
|
freeReplyObject(reply);
|
||||||
}
|
}
|
||||||
@ -432,7 +432,7 @@ SSL can only be enabled on a `redisContext` connection after the connection has
|
|||||||
been established and before any command has been processed. For example:
|
been established and before any command has been processed. For example:
|
||||||
|
|
||||||
```c
|
```c
|
||||||
c = redisConnect('localhost', 6443);
|
c = redisConnect("localhost", 6443);
|
||||||
if (c == NULL || c->err) {
|
if (c == NULL || c->err) {
|
||||||
/* Handle error and abort... */
|
/* Handle error and abort... */
|
||||||
}
|
}
|
||||||
@ -440,7 +440,7 @@ if (c == NULL || c->err) {
|
|||||||
if (redisSecureConnection(c,
|
if (redisSecureConnection(c,
|
||||||
"cacertbundle.crt", /* File name of trusted CA/ca bundle file */
|
"cacertbundle.crt", /* File name of trusted CA/ca bundle file */
|
||||||
"client_cert.pem", /* File name of client certificate file */
|
"client_cert.pem", /* File name of client certificate file */
|
||||||
"client_key.pem", /* File name of client privat ekey */
|
"client_key.pem", /* File name of client private key */
|
||||||
"redis.mydomain.com" /* Server name to request (SNI) */
|
"redis.mydomain.com" /* Server name to request (SNI) */
|
||||||
) != REDIS_OK) {
|
) != REDIS_OK) {
|
||||||
printf("SSL error: %s\n", c->errstr);
|
printf("SSL error: %s\n", c->errstr);
|
||||||
|
8
alloc.h
8
alloc.h
@ -36,9 +36,17 @@
|
|||||||
#define HIREDIS_OOM_HANDLER abort()
|
#define HIREDIS_OOM_HANDLER abort()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
void *hi_malloc(size_t size);
|
void *hi_malloc(size_t size);
|
||||||
void *hi_calloc(size_t nmemb, size_t size);
|
void *hi_calloc(size_t nmemb, size_t size);
|
||||||
void *hi_realloc(void *ptr, size_t size);
|
void *hi_realloc(void *ptr, size_t size);
|
||||||
char *hi_strdup(const char *str);
|
char *hi_strdup(const char *str);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif /* HIREDIS_ALLOC_H */
|
#endif /* HIREDIS_ALLOC_H */
|
||||||
|
38
hiredis.def
Normal file
38
hiredis.def
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
EXPORTS
|
||||||
|
redisAppendCommand
|
||||||
|
redisAppendCommandArgv
|
||||||
|
redisAppendFormattedCommand
|
||||||
|
redisBufferRead
|
||||||
|
redisBufferWrite
|
||||||
|
redisCommand
|
||||||
|
redisCommand
|
||||||
|
redisCommandArgv
|
||||||
|
redisConnect
|
||||||
|
redisConnectBindNonBlock
|
||||||
|
redisConnectBindNonBlockWithReuse
|
||||||
|
redisConnectFd
|
||||||
|
redisConnectNonBlock
|
||||||
|
redisConnectUnix
|
||||||
|
redisConnectUnixNonBlock
|
||||||
|
redisConnectUnixWithTimeout
|
||||||
|
redisConnectWithOptions
|
||||||
|
redisConnectWithTimeout
|
||||||
|
redisEnableKeepAlive
|
||||||
|
redisFormatCommand
|
||||||
|
redisFormatCommandArgv
|
||||||
|
redisFormatSdsCommandArgv
|
||||||
|
redisFree
|
||||||
|
redisFreeCommand
|
||||||
|
redisFreeKeepFd
|
||||||
|
redisFreeSdsCommand
|
||||||
|
redisGetReply
|
||||||
|
redisGetReplyFromReader
|
||||||
|
redisReaderCreate
|
||||||
|
redisReconnect
|
||||||
|
redisSetTimeout
|
||||||
|
redisvAppendCommand
|
||||||
|
redisvCommand
|
||||||
|
redisvFormatCommand
|
||||||
|
freeReplyObject
|
||||||
|
hi_calloc
|
||||||
|
hi_malloc
|
@ -32,6 +32,10 @@
|
|||||||
#ifndef __HIREDIS_SSL_H
|
#ifndef __HIREDIS_SSL_H
|
||||||
#define __HIREDIS_SSL_H
|
#define __HIREDIS_SSL_H
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
/* This is the underlying struct for SSL in ssl.h, which is not included to
|
/* This is the underlying struct for SSL in ssl.h, which is not included to
|
||||||
* keep build dependencies short here.
|
* keep build dependencies short here.
|
||||||
*/
|
*/
|
||||||
@ -50,4 +54,8 @@ int redisSecureConnection(redisContext *c, const char *capath, const char *certp
|
|||||||
|
|
||||||
int redisInitiateSSL(redisContext *c, struct ssl_st *ssl);
|
int redisInitiateSSL(redisContext *c, struct ssl_st *ssl);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif /* __HIREDIS_SSL_H */
|
#endif /* __HIREDIS_SSL_H */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user