diff options
author | michael <michael@82007160-df01-0410-b94d-b575c5fd34c7> | 2013-06-21 11:40:05 +0000 |
---|---|---|
committer | michael <michael@82007160-df01-0410-b94d-b575c5fd34c7> | 2013-06-21 11:40:05 +0000 |
commit | e7f46d3292db21968d5e61dd6ce8e1649535e355 (patch) | |
tree | db3b90775b457ce36b6b8e022e0fbf648bd87cc2 /src | |
parent | 8a9bbfe513c4c3a01a779126c7eba529bd3c02d3 (diff) |
- 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
Diffstat (limited to 'src')
-rw-r--r-- | src/conf.c | 14 |
1 files changed, 8 insertions, 6 deletions
@@ -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; } |