From e7f46d3292db21968d5e61dd6ce8e1649535e355 Mon Sep 17 00:00:00 2001 From: michael Date: Fri, 21 Jun 2013 11:40:05 +0000 Subject: - conf.c:valid_tkline(): minor cleanups git-svn-id: svn://svn.ircd-hybrid.org/svnroot/ircd-hybrid/branches/8.1.x@2312 82007160-df01-0410-b94d-b575c5fd34c7 --- src/conf.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/conf.c b/src/conf.c index 585cec8..3339d69 100644 --- a/src/conf.c +++ b/src/conf.c @@ -1719,17 +1719,19 @@ conf_error_report(const char *msg) * Originally written by Dianora (Diane, db@db.net) */ time_t -valid_tkline(const char *p, int minutes) +valid_tkline(const char *data, const int minutes) { + const unsigned char *p = (const unsigned char *)data; + unsigned char tmpch = '\0'; time_t result = 0; - for (; *p; ++p) + while ((tmpch = *p++)) { - if (!IsDigit(*p)) + if (!IsDigit(tmpch)) return 0; result *= 10; - result += (*p & 0xF); + result += (tmpch & 0xF); } /* @@ -1745,12 +1747,12 @@ valid_tkline(const char *p, int minutes) * of this calculation */ if (!minutes) - result = result / (time_t)60; + result = result / 60; if (result > MAX_TDKLINE_TIME) result = MAX_TDKLINE_TIME; - result = result * (time_t)60; /* turn it into seconds */ + result = result * 60; /* turn it into seconds */ return result; } -- cgit