Skip to content

Commit d968617

Browse files
committed
Correcting the connect callback in examples
Some examples were missed when changing the connect callback signature in PR valkey-io#142 to using a non-const context. Add -Werror to the examples Makefile to find issues in CI. Can be disabled by USE_WERROR=0 as when building libvalkey. Signed-off-by: Björn Svensson <[email protected]>
1 parent fda78bb commit d968617

File tree

6 files changed

+12
-6
lines changed

6 files changed

+12
-6
lines changed

examples/Makefile

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
11
CC?=gcc
22
CXX?=g++
33

4-
CFLAGS?=-fPIC -Wall -Wextra -g -O2 -I../include
4+
WARNINGS=-Wall -Wextra
5+
CFLAGS?=-fPIC -g -O2 $(WARNINGS) -I../include
56
STLIBNAME?=../lib/libvalkey.a
67

8+
USE_WERROR?=1
9+
ifeq ($(USE_WERROR),1)
10+
WARNINGS+=-Werror
11+
endif
12+
713
# Define examples
814
EXAMPLES=example-blocking example-blocking-push example-async-libevent \
915
example-async-libev example-async-glib example-async-poll \

examples/async-ae.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ void getCallback(valkeyAsyncContext *c, void *r, void *privdata) {
2121
valkeyAsyncDisconnect(c);
2222
}
2323

24-
void connectCallback(const valkeyAsyncContext *c, int status) {
24+
void connectCallback(valkeyAsyncContext *c, int status) {
2525
if (status != VALKEY_OK) {
2626
printf("Error: %s\n", c->errstr);
2727
aeStop(loop);

examples/async-ivykis.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ void getCallback(valkeyAsyncContext *c, void *r, void *privdata) {
1818
valkeyAsyncDisconnect(c);
1919
}
2020

21-
void connectCallback(const valkeyAsyncContext *c, int status) {
21+
void connectCallback(valkeyAsyncContext *c, int status) {
2222
if (status != VALKEY_OK) {
2323
printf("Error: %s\n", c->errstr);
2424
return;

examples/async-macosx.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ void getCallback(valkeyAsyncContext *c, void *r, void *privdata) {
4848
valkeyAsyncDisconnect(c);
4949
}
5050

51-
void connectCallback(const valkeyAsyncContext *c, int status) {
51+
void connectCallback(valkeyAsyncContext *c, int status) {
5252
if (status != VALKEY_OK) {
5353
printf("Error: %s\n", c->errstr);
5454
return;

examples/async-poll.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ void getCallback(valkeyAsyncContext *c, void *r, void *privdata) {
2121
valkeyAsyncDisconnect(c);
2222
}
2323

24-
void connectCallback(const valkeyAsyncContext *c, int status) {
24+
void connectCallback(valkeyAsyncContext *c, int status) {
2525
if (status != VALKEY_OK) {
2626
printf("Error: %s\n", c->errstr);
2727
exit_loop = 1;

examples/async-valkeymoduleapi.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ void getCallback(valkeyAsyncContext *c, void *r, void *privdata) {
3232
valkeyAsyncCommand(c, debugCallback, NULL, "DEBUG SLEEP %f", 1.5);
3333
}
3434

35-
void connectCallback(const valkeyAsyncContext *c, int status) {
35+
void connectCallback(valkeyAsyncContext *c, int status) {
3636
if (status != VALKEY_OK) {
3737
printf("Error: %s\n", c->errstr);
3838
return;

0 commit comments

Comments
 (0)