log file parsing code improved a bit

This commit is contained in:
antirez 2009-04-27 18:03:34 +02:00
parent be2bb6b07e
commit 85dd2f3ad2
2 changed files with 9 additions and 13 deletions

1
TODO
View File

@ -2,7 +2,6 @@ BEFORE REDIS 1.0.0-rc1
- What happens if the saving child gets killed instead to end normally? Handle this.
- Make sinterstore / unionstore / sdiffstore returning the cardinality of the resulting set.
- Add a new field as INFO output: bgsaveinprogress
- Remove max number of args limit
- GETSET
- network layer stresser in test in demo, make sure to set/get random streams of data and check that what we read back is byte-by-byte the same.

21
redis.c
View File

@ -887,6 +887,12 @@ static long long emptyDb() {
return removed;
}
static int yesnotoi(char *s) {
if (!strcasecmp(s,"yes")) return 1;
else if (!strcasecmp(s,"no")) return 0;
else return -1;
}
/* I agree, this is a very rudimental way to load a configuration...
will improve later if the config gets more complex */
static void loadServerConfig(char *filename) {
@ -980,24 +986,15 @@ static void loadServerConfig(char *filename) {
server.masterport = atoi(argv[2]);
server.replstate = REDIS_REPL_CONNECT;
} else if (!strcmp(argv[0],"glueoutputbuf") && argc == 2) {
sdstolower(argv[1]);
if (!strcmp(argv[1],"yes")) server.glueoutputbuf = 1;
else if (!strcmp(argv[1],"no")) server.glueoutputbuf = 0;
else {
if ((server.glueoutputbuf = yesnotoi(argv[1])) == -1) {
err = "argument must be 'yes' or 'no'"; goto loaderr;
}
} else if (!strcmp(argv[0],"shareobjects") && argc == 2) {
sdstolower(argv[1]);
if (!strcmp(argv[1],"yes")) server.shareobjects = 1;
else if (!strcmp(argv[1],"no")) server.shareobjects = 0;
else {
if ((server.shareobjects = yesnotoi(argv[1])) == -1) {
err = "argument must be 'yes' or 'no'"; goto loaderr;
}
} else if (!strcmp(argv[0],"daemonize") && argc == 2) {
sdstolower(argv[1]);
if (!strcmp(argv[1],"yes")) server.daemonize = 1;
else if (!strcmp(argv[1],"no")) server.daemonize = 0;
else {
if ((server.daemonize = yesnotoi(argv[1])) == -1) {
err = "argument must be 'yes' or 'no'"; goto loaderr;
}
} else if (!strcmp(argv[0],"requirepass") && argc == 2) {