summaryrefslogtreecommitdiffstats
path: root/source/helper.c
diff options
context:
space:
mode:
authorTom Hinton <tom.hinton@cse.org.uk>2015-10-02 09:58:56 +0100
committerTom Hinton <tom.hinton@cse.org.uk>2015-10-02 09:58:56 +0100
commitc2d8cb1f45f3f592a87223cae5e2c495bb204934 (patch)
tree33fe28633e1c591e169b99d2ac2e0bb0d5e27b4d /source/helper.c
parent3ba2da9cae0c48995e9a547defe029fe6f6fdd0c (diff)
Move ascii testing gizmos to macros at the top.
Still not sure about best way to do this.
Diffstat (limited to 'source/helper.c')
-rw-r--r--source/helper.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/source/helper.c b/source/helper.c
index 4db21ab4..69c8f975 100644
--- a/source/helper.c
+++ b/source/helper.c
@@ -44,6 +44,10 @@
static int stored_argc = 0;
static char **stored_argv = NULL;
+// TODO: is this safe?
+#define NON_ASCII_NON_NULL( x ) ( ((x) < 0) )
+#define ASCII_NON_NULL( x ) ( ((x) > 0) )
+
void cmd_set_arguments ( int argc, char **argv )
{
stored_argc = argc;
@@ -316,7 +320,7 @@ static void advance_unicode_glyph( char** token_in, char** input_in ) {
char *token = *token_in;
char *input = *input_in;
- while (*token < 0) {
+ while (NON_ASCII_NON_NULL(*token)) {
token++;
}
@@ -534,7 +538,7 @@ void config_sanity_check ( )
int is_not_ascii ( const char * str )
{
- while (*str > 0) {
+ while (ASCII_NON_NULL(*str)) {
str++;
}
if (*str) return 1;