From b647a7c5b7d196d9a81b2aef9e1bafa61cc2bea8 Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Thu, 23 Feb 2017 22:22:49 +0900 Subject: [PATCH] nghttpx: Simplify code using parse_uint --- src/shrpx_config.cc | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/src/shrpx_config.cc b/src/shrpx_config.cc index b6cf2345..ebdf7fad 100644 --- a/src/shrpx_config.cc +++ b/src/shrpx_config.cc @@ -2428,12 +2428,7 @@ int parse_config(Config *config, int optid, const StringRef &opt, return 0; case SHRPX_OPTID_FASTOPEN: { int n; - if (parse_int(&n, opt, optarg.c_str()) != 0) { - return -1; - } - - if (n < 0) { - LOG(ERROR) << opt << ": " << optarg << " is not allowed"; + if (parse_uint(&n, opt, optarg) != 0) { return -1; } @@ -2629,13 +2624,7 @@ int parse_config(Config *config, int optid, const StringRef &opt, } case SHRPX_OPTID_BACKLOG: { int n; - if (parse_int(&n, opt, optarg.c_str()) != 0) { - return -1; - } - - if (n < -1) { - LOG(ERROR) << opt << ": " << optarg << " is not allowed"; - + if (parse_uint(&n, opt, optarg) != 0) { return -1; }