Commit a7c46df6 authored by cubicdaiya's avatar cubicdaiya Committed by antirez
Browse files

Use 'void' for zero-argument functions

According to the C standard,
it is desirable to give the type 'void'
to functions have no argument.

Closes #1631
parent 8dbd0134
...@@ -72,7 +72,7 @@ void appendServerSaveParams(time_t seconds, int changes) { ...@@ -72,7 +72,7 @@ void appendServerSaveParams(time_t seconds, int changes) {
server.saveparamslen++; server.saveparamslen++;
} }
void resetServerSaveParams() { void resetServerSaveParams(void) {
zfree(server.saveparams); zfree(server.saveparams);
server.saveparams = NULL; server.saveparams = NULL;
server.saveparamslen = 0; server.saveparamslen = 0;
......
...@@ -66,7 +66,7 @@ ...@@ -66,7 +66,7 @@
#define HI_BIT (1L << (2 * N - 1)) #define HI_BIT (1L << (2 * N - 1))
static uint32_t x[3] = { X0, X1, X2 }, a[3] = { A0, A1, A2 }, c = C; static uint32_t x[3] = { X0, X1, X2 }, a[3] = { A0, A1, A2 }, c = C;
static void next(); static void next(void);
int32_t redisLrand48() { int32_t redisLrand48() {
next(); next();
...@@ -77,7 +77,7 @@ void redisSrand48(int32_t seedval) { ...@@ -77,7 +77,7 @@ void redisSrand48(int32_t seedval) {
SEED(X0, LOW(seedval), HIGH(seedval)); SEED(X0, LOW(seedval), HIGH(seedval));
} }
static void next() { static void next(void) {
uint32_t p[2], q[2], r[2], carry0, carry1; uint32_t p[2], q[2], r[2], carry0, carry1;
MUL(a[0], x[0], p); MUL(a[0], x[0], p);
......
...@@ -168,7 +168,7 @@ int readBytes(void *target, long num) { ...@@ -168,7 +168,7 @@ int readBytes(void *target, long num) {
return 1; return 1;
} }
int processHeader() { int processHeader(void) {
char buf[10] = "_________"; char buf[10] = "_________";
int dump_version; int dump_version;
...@@ -602,7 +602,7 @@ void printErrorStack(entry *e) { ...@@ -602,7 +602,7 @@ void printErrorStack(entry *e) {
} }
} }
void process() { void process(void) {
uint64_t num_errors = 0, num_valid_ops = 0, num_valid_bytes = 0; uint64_t num_errors = 0, num_valid_ops = 0, num_valid_bytes = 0;
entry entry; entry entry;
int dump_version = processHeader(); int dump_version = processHeader();
......
...@@ -98,7 +98,7 @@ static struct config { ...@@ -98,7 +98,7 @@ static struct config {
} config; } config;
static volatile sig_atomic_t force_cancel_loop = 0; static volatile sig_atomic_t force_cancel_loop = 0;
static void usage(); static void usage(void);
static void slaveMode(void); static void slaveMode(void);
char *redisGitSHA1(void); char *redisGitSHA1(void);
char *redisGitDirty(void); char *redisGitDirty(void);
...@@ -158,7 +158,7 @@ typedef struct { ...@@ -158,7 +158,7 @@ typedef struct {
static helpEntry *helpEntries; static helpEntry *helpEntries;
static int helpEntriesLen; static int helpEntriesLen;
static sds cliVersion() { static sds cliVersion(void) {
sds version; sds version;
version = sdscatprintf(sdsempty(), "%s", REDIS_VERSION); version = sdscatprintf(sdsempty(), "%s", REDIS_VERSION);
...@@ -172,7 +172,7 @@ static sds cliVersion() { ...@@ -172,7 +172,7 @@ static sds cliVersion() {
return version; return version;
} }
static void cliInitHelp() { static void cliInitHelp(void) {
int commandslen = sizeof(commandHelp)/sizeof(struct commandHelp); int commandslen = sizeof(commandHelp)/sizeof(struct commandHelp);
int groupslen = sizeof(commandGroups)/sizeof(char*); int groupslen = sizeof(commandGroups)/sizeof(char*);
int i, len, pos = 0; int i, len, pos = 0;
...@@ -211,7 +211,7 @@ static void cliOutputCommandHelp(struct commandHelp *help, int group) { ...@@ -211,7 +211,7 @@ static void cliOutputCommandHelp(struct commandHelp *help, int group) {
} }
/* Print generic help. */ /* Print generic help. */
static void cliOutputGenericHelp() { static void cliOutputGenericHelp(void) {
sds version = cliVersion(); sds version = cliVersion();
printf( printf(
"redis-cli %s\r\n" "redis-cli %s\r\n"
...@@ -368,7 +368,7 @@ static int cliConnect(int force) { ...@@ -368,7 +368,7 @@ static int cliConnect(int force) {
return REDIS_OK; return REDIS_OK;
} }
static void cliPrintContextError() { static void cliPrintContextError(void) {
if (context == NULL) return; if (context == NULL) return;
fprintf(stderr,"Error: %s\n",context->errstr); fprintf(stderr,"Error: %s\n",context->errstr);
} }
...@@ -804,7 +804,7 @@ static sds readArgFromStdin(void) { ...@@ -804,7 +804,7 @@ static sds readArgFromStdin(void) {
return arg; return arg;
} }
static void usage() { static void usage(void) {
sds version = cliVersion(); sds version = cliVersion();
fprintf(stderr, fprintf(stderr,
"redis-cli %s\n" "redis-cli %s\n"
...@@ -873,7 +873,7 @@ static char **convertToSds(int count, char** args) { ...@@ -873,7 +873,7 @@ static char **convertToSds(int count, char** args) {
} }
#define LINE_BUFLEN 4096 #define LINE_BUFLEN 4096
static void repl() { static void repl(void) {
sds historyfile = NULL; sds historyfile = NULL;
int history = 0; int history = 0;
char *line; char *line;
...@@ -1676,7 +1676,7 @@ void bytesToHuman(char *s, long long n) { ...@@ -1676,7 +1676,7 @@ void bytesToHuman(char *s, long long n) {
} }
} }
static void statMode() { static void statMode(void) {
redisReply *reply; redisReply *reply;
long aux, requests = 0; long aux, requests = 0;
int i = 0; int i = 0;
...@@ -1762,7 +1762,7 @@ static void statMode() { ...@@ -1762,7 +1762,7 @@ static void statMode() {
* Scan mode * Scan mode
*--------------------------------------------------------------------------- */ *--------------------------------------------------------------------------- */
static void scanMode() { static void scanMode(void) {
redisReply *reply; redisReply *reply;
unsigned long long cur = 0; unsigned long long cur = 0;
......
...@@ -1297,7 +1297,7 @@ void createSharedObjects(void) { ...@@ -1297,7 +1297,7 @@ void createSharedObjects(void) {
shared.maxstring = createStringObject("maxstring",9); shared.maxstring = createStringObject("maxstring",9);
} }
void initServerConfig() { void initServerConfig(void) {
int j; int j;
getRandomHexChars(server.runid,REDIS_RUN_ID_SIZE); getRandomHexChars(server.runid,REDIS_RUN_ID_SIZE);
...@@ -1611,7 +1611,7 @@ void resetServerStats(void) { ...@@ -1611,7 +1611,7 @@ void resetServerStats(void) {
server.ops_sec_last_sample_ops = 0; server.ops_sec_last_sample_ops = 0;
} }
void initServer() { void initServer(void) {
int j; int j;
signal(SIGHUP, SIG_IGN); signal(SIGHUP, SIG_IGN);
...@@ -3055,7 +3055,7 @@ void daemonize(void) { ...@@ -3055,7 +3055,7 @@ void daemonize(void) {
} }
} }
void version() { void version(void) {
printf("Redis server v=%s sha=%s:%d malloc=%s bits=%d build=%llx\n", printf("Redis server v=%s sha=%s:%d malloc=%s bits=%d build=%llx\n",
REDIS_VERSION, REDIS_VERSION,
redisGitSHA1(), redisGitSHA1(),
...@@ -3066,7 +3066,7 @@ void version() { ...@@ -3066,7 +3066,7 @@ void version() {
exit(0); exit(0);
} }
void usage() { void usage(void) {
fprintf(stderr,"Usage: ./redis-server [/path/to/redis.conf] [options]\n"); fprintf(stderr,"Usage: ./redis-server [/path/to/redis.conf] [options]\n");
fprintf(stderr," ./redis-server - (read config from stdin)\n"); fprintf(stderr," ./redis-server - (read config from stdin)\n");
fprintf(stderr," ./redis-server -v or --version\n"); fprintf(stderr," ./redis-server -v or --version\n");
......
...@@ -1131,7 +1131,7 @@ void redisLog(int level, const char *fmt, ...); ...@@ -1131,7 +1131,7 @@ void redisLog(int level, const char *fmt, ...);
#endif #endif
void redisLogRaw(int level, const char *msg); void redisLogRaw(int level, const char *msg);
void redisLogFromHandler(int level, const char *msg); void redisLogFromHandler(int level, const char *msg);
void usage(); void usage(void);
void updateDictResizePolicy(void); void updateDictResizePolicy(void);
int htNeedsResize(dict *dict); int htNeedsResize(dict *dict);
void oom(const char *msg); void oom(const char *msg);
...@@ -1190,7 +1190,7 @@ sds keyspaceEventsFlagsToString(int flags); ...@@ -1190,7 +1190,7 @@ sds keyspaceEventsFlagsToString(int flags);
/* Configuration */ /* Configuration */
void loadServerConfig(char *filename, char *options); void loadServerConfig(char *filename, char *options);
void appendServerSaveParams(time_t seconds, int changes); void appendServerSaveParams(time_t seconds, int changes);
void resetServerSaveParams(); void resetServerSaveParams(void);
struct rewriteConfigState; /* Forward declaration to export API. */ struct rewriteConfigState; /* Forward declaration to export API. */
void rewriteConfigRewriteLine(struct rewriteConfigState *state, char *option, sds line, int force); void rewriteConfigRewriteLine(struct rewriteConfigState *state, char *option, sds line, int force);
int rewriteConfig(char *path); int rewriteConfig(char *path);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment