summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile8
-rw-r--r--example-ae.c7
-rw-r--r--sds.c1
3 files changed, 10 insertions, 6 deletions
diff --git a/Makefile b/Makefile
index 3357112..1865bdc 100644
--- a/Makefile
+++ b/Makefile
@@ -73,7 +73,7 @@ hiredis-example-ae:
@false
else
hiredis-example-ae: example-ae.c adapters/ae.h $(STLIBNAME)
- $(CC) -o $@ $(REAL_CFLAGS) $(REAL_LDFLAGS) -I$(AE_DIR) $(AE_DIR)/ae.o $(AE_DIR)/zmalloc.o example-ae.c $(STLIBNAME)
+ $(CC) -o $@ $(REAL_CFLAGS) $(REAL_LDFLAGS) -I$(AE_DIR) $(AE_DIR)/ae.o $(AE_DIR)/zmalloc.o $(AE_DIR)/../deps/jemalloc/lib/libjemalloc.a -pthread example-ae.c $(STLIBNAME)
endif
ifndef LIBUV_DIR
@@ -114,10 +114,8 @@ dep:
# Installation related variables and target
PREFIX?=/usr/local
-INCLUDE_PATH?=include/hiredis
-LIBRARY_PATH?=lib
-INSTALL_INCLUDE_PATH= $(PREFIX)/$(INCLUDE_PATH)
-INSTALL_LIBRARY_PATH= $(PREFIX)/$(LIBRARY_PATH)
+INSTALL_INCLUDE_PATH= $(PREFIX)/include/hiredis
+INSTALL_LIBRARY_PATH= $(PREFIX)/lib
ifeq ($(uname_S),SunOS)
INSTALL?= cp -r
diff --git a/example-ae.c b/example-ae.c
index 5ed34a3..93f1a84 100644
--- a/example-ae.c
+++ b/example-ae.c
@@ -21,17 +21,22 @@ void getCallback(redisAsyncContext *c, void *r, void *privdata) {
void connectCallback(const redisAsyncContext *c, int status) {
if (status != REDIS_OK) {
printf("Error: %s\n", c->errstr);
+ aeStop(loop);
return;
}
+
printf("Connected...\n");
}
void disconnectCallback(const redisAsyncContext *c, int status) {
if (status != REDIS_OK) {
printf("Error: %s\n", c->errstr);
+ aeStop(loop);
return;
}
+
printf("Disconnected...\n");
+ aeStop(loop);
}
int main (int argc, char **argv) {
@@ -44,7 +49,7 @@ int main (int argc, char **argv) {
return 1;
}
- loop = aeCreateEventLoop();
+ loop = aeCreateEventLoop(64);
redisAeAttach(loop, c);
redisAsyncSetConnectCallback(c,connectCallback);
redisAsyncSetDisconnectCallback(c,disconnectCallback);
diff --git a/sds.c b/sds.c
index 0af9c67..9226799 100644
--- a/sds.c
+++ b/sds.c
@@ -178,6 +178,7 @@ sds sdscatvprintf(sds s, const char *fmt, va_list ap) {
buf[buflen-2] = '\0';
va_copy(cpy,ap);
vsnprintf(buf, buflen, fmt, cpy);
+ va_end(cpy);
if (buf[buflen-2] != '\0') {
free(buf);
buflen *= 2;