summaryrefslogtreecommitdiffhomepage
path: root/ir/tv
diff options
context:
space:
mode:
authorChristoph Mallon <mallon@cs.uni-saarland.de>2015-02-15 11:08:51 +0100
committerChristoph Mallon <mallon@cs.uni-saarland.de>2015-04-27 13:18:47 +0200
commitc0a95531983586f651cf6f0b298cb2b843689fad (patch)
tree82bf9b2dfdffe6fa174fce0eff6582e09d3e5c42 /ir/tv
parentf444ac1088814d7ef643dbd234687786de2bbba1 (diff)
util: Add and use is_digit().
Diffstat (limited to 'ir/tv')
-rw-r--r--ir/tv/strcalc.c3
-rw-r--r--ir/tv/tv.c2
2 files changed, 3 insertions, 2 deletions
diff --git a/ir/tv/strcalc.c b/ir/tv/strcalc.c
index 47dd065..9d17ab0 100644
--- a/ir/tv/strcalc.c
+++ b/ir/tv/strcalc.c
@@ -19,6 +19,7 @@
#include "panic.h"
#include "bitfiddle.h"
#include "tv_t.h"
+#include "util.h"
#define SC_MASK ((sc_word)0xFF)
#define SC_RESULT(x) ((x) & SC_MASK)
@@ -342,7 +343,7 @@ bool sc_val_from_str(bool negative, unsigned base, const char *str, size_t len,
while (len > 0) {
char c = *str;
unsigned v;
- if (c >= '0' && c <= '9')
+ if (is_digit(c))
v = c - '0';
else if (c >= 'A' && c <= 'F')
v = c - 'A' + 10;
diff --git a/ir/tv/tv.c b/ir/tv/tv.c
index e0de405..3b0752a 100644
--- a/ir/tv/tv.c
+++ b/ir/tv/tv.c
@@ -1178,7 +1178,7 @@ static char hexchar(unsigned val)
static unsigned hexval(char c)
{
- if (c >= '0' && c <= '9')
+ if (is_digit(c))
return c - '0';
return (c - 'A')+10;
}