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
This commit is contained in:
cubicdaiya 2014-03-16 08:51:54 +09:00 committed by antirez
parent 8db020e2a1
commit 23f08510d5
6 changed files with 20 additions and 20 deletions

View File

@ -73,7 +73,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;

View File

@ -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) {
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);

View File

@ -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) {
} }
} }
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();

View File

@ -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 {
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() {
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) {
} }
/* 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) {
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);
} }
@ -805,7 +805,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"
@ -874,7 +874,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;
@ -1677,7 +1677,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;
@ -1763,7 +1763,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;

View File

@ -1376,7 +1376,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);
@ -1696,7 +1696,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);
@ -3349,7 +3349,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(),
@ -3360,7 +3360,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");

View File

@ -1216,7 +1216,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);
@ -1276,7 +1276,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);