From: Christophe Jaillet Date: Tue, 19 Jan 2016 06:33:04 +0000 (+0000) Subject: No need to search twice for the same value. X-Git-Tag: 2.5.0-alpha~2384 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b676674865c6d21ac8be76c5e6045ba115e7260d;p=thirdparty%2Fapache%2Fhttpd.git No need to search twice for the same value. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1725445 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/modules/proxy/balancers/mod_lbmethod_heartbeat.c b/modules/proxy/balancers/mod_lbmethod_heartbeat.c index 0a4d961ebb7..863fc029e8a 100644 --- a/modules/proxy/balancers/mod_lbmethod_heartbeat.c +++ b/modules/proxy/balancers/mod_lbmethod_heartbeat.c @@ -127,7 +127,7 @@ static apr_status_t readfile_heartbeats(const char *path, apr_hash_t *servers, hb_server_t *server; char buf[4096]; apr_size_t bsize = sizeof(buf); - const char *ip; + const char *ip, *val; apr_brigade_cleanup(tmpbb); @@ -180,20 +180,20 @@ static apr_status_t readfile_heartbeats(const char *path, apr_hash_t *servers, argstr_to_table(pool, apr_pstrdup(pool, t), hbt); - if (apr_table_get(hbt, "busy")) { - server->busy = atoi(apr_table_get(hbt, "busy")); + if ((val = apr_table_get(hbt, "busy"))) { + server->busy = atoi(val); } - if (apr_table_get(hbt, "ready")) { - server->ready = atoi(apr_table_get(hbt, "ready")); + if ((val = apr_table_get(hbt, "ready"))) { + server->ready = atoi(val); } - if (apr_table_get(hbt, "lastseen")) { - server->seen = atoi(apr_table_get(hbt, "lastseen")); + if ((val = apr_table_get(hbt, "lastseen"))) { + server->seen = atoi(val); } - if (apr_table_get(hbt, "port")) { - server->port = atoi(apr_table_get(hbt, "port")); + if ((val = apr_table_get(hbt, "port"))) { + server->port = atoi(val); } if (server->busy == 0 && server->ready != 0) {