Skip to content

Commit

Permalink
Enforce C99 standard
Browse files Browse the repository at this point in the history
  • Loading branch information
attipaci committed Sep 17, 2024
1 parent 1811b41 commit e1fca6e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions config.mk
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ CC ?= gcc
CPPFLAGS += -I$(INC)

# Base compiler options (if not defined externally...)
CFLAGS ?= -Os -Wall
CFLAGS ?= -Os -Wall -std=c99

# Extra warnings (not supported on all compilers)
#CFLAGS += -Wextra
Expand All @@ -47,7 +47,7 @@ LDFLAGS += -lxchange

# cppcheck options for 'check' target
CHECKOPTS ?= --enable=performance,warning,portability,style --language=c \
--error-exitcode=1 $(CHECKEXTRA)
--error-exitcode=1 --std=c99 $(CHECKEXTRA)

CHECKOPTS += --template='{file}({line}): {severity} ({id}): {message}' --inline-suppr

Expand Down
2 changes: 1 addition & 1 deletion src/redisx-client.c
Original file line number Diff line number Diff line change
Expand Up @@ -775,7 +775,7 @@ RESP *redisxReadReplyAsync(RedisClient *cl) {
// FIXME workaround for Redis 4.x improper OK reply to QUIT
if(!strcmp(buf, "OK")) {
resp->type = RESP_SIMPLE_STRING;
resp->value = strdup("OK");
resp->value = xStringCopyOf("OK");
}
else if(cp->isEnabled) {
fprintf(stderr, "WARNING! Redis-X : invalid type '%c' in '%s'\n", buf[0], buf);
Expand Down
4 changes: 3 additions & 1 deletion src/redisx-net.c
Original file line number Diff line number Diff line change
Expand Up @@ -520,6 +520,7 @@ int rConnectClient(Redis *redis, enum redisx_channel channel) {
static const char *fn = "rConnectClient";

struct sockaddr_in serverAddress;
struct utsname u;
const RedisPrivate *p;
RedisClient *cl;
ClientPrivate *cp;
Expand Down Expand Up @@ -566,7 +567,8 @@ int rConnectClient(Redis *redis, enum redisx_channel channel) {
}

// Set the client name in Redis.
gethostname(host, sizeof(host));
uname(&u);
strncpy(host, u.nodename, sizeof(host) - 1);

id = (char *) malloc(strlen(host) + 100); // <host>:pid-<pid>:<channel> + termination;
switch(cp->idx) {
Expand Down

0 comments on commit e1fca6e

Please sign in to comment.