nghttpx: Simplify code using parse_uint

This commit is contained in:
Tatsuhiro Tsujikawa 2017-02-23 22:22:49 +09:00
parent 46ba9e080d
commit b647a7c5b7
1 changed files with 2 additions and 13 deletions

View File

@ -2428,12 +2428,7 @@ int parse_config(Config *config, int optid, const StringRef &opt,
return 0; return 0;
case SHRPX_OPTID_FASTOPEN: { case SHRPX_OPTID_FASTOPEN: {
int n; int n;
if (parse_int(&n, opt, optarg.c_str()) != 0) { if (parse_uint(&n, opt, optarg) != 0) {
return -1;
}
if (n < 0) {
LOG(ERROR) << opt << ": " << optarg << " is not allowed";
return -1; return -1;
} }
@ -2629,13 +2624,7 @@ int parse_config(Config *config, int optid, const StringRef &opt,
} }
case SHRPX_OPTID_BACKLOG: { case SHRPX_OPTID_BACKLOG: {
int n; int n;
if (parse_int(&n, opt, optarg.c_str()) != 0) { if (parse_uint(&n, opt, optarg) != 0) {
return -1;
}
if (n < -1) {
LOG(ERROR) << opt << ": " << optarg << " is not allowed";
return -1; return -1;
} }