aboutsummaryrefslogtreecommitdiffstats
path: root/src/listen.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2009-01-21 08:48:02 +0100
committerMax Kellermann <max@duempel.org>2009-01-21 08:48:02 +0100
commit2362ee4a4897502b3ccedf7af31d6d1ad89cff8e (patch)
tree4e2ddac0c1935356041947304c1ff99a2044879e /src/listen.c
parentf11eb14c8a7d0134ff5399e1c38777ad7938459a (diff)
downloadmpd-2362ee4a4897502b3ccedf7af31d6d1ad89cff8e.tar.gz
mpd-2362ee4a4897502b3ccedf7af31d6d1ad89cff8e.tar.xz
mpd-2362ee4a4897502b3ccedf7af31d6d1ad89cff8e.zip
use config_get_positive() instead of manual parsing
Simplify some code by using config_get_positive(), instead of doing manual parsing and validation each time.
Diffstat (limited to 'src/listen.c')
-rw-r--r--src/listen.c16
1 files changed, 1 insertions, 15 deletions
diff --git a/src/listen.c b/src/listen.c
index eac166330..a0efbe148 100644
--- a/src/listen.c
+++ b/src/listen.c
@@ -253,23 +253,9 @@ parseListenConfigParam(G_GNUC_UNUSED unsigned int port,
void listenOnPort(void)
{
- int port = DEFAULT_PORT;
+ int port = config_get_positive(CONF_PORT, DEFAULT_PORT);
struct config_param *param =
config_get_next_param(CONF_BIND_TO_ADDRESS, NULL);
- struct config_param *portParam = config_get_param(CONF_PORT);
-
- if (portParam) {
- char *test;
- port = strtol(portParam->value, &test, 10);
- if (port <= 0 || *test != '\0') {
- g_error("%s \"%s\" specified at line %i is not a "
- "positive integer",
- CONF_PORT,
- portParam->value, portParam->line);
- }
- }
-
- boundPort = port;
do {
parseListenConfigParam(port, param);