]> git.itanic.dy.fi Git - rrdd/commitdiff
string.h: Use defintions from ctype.h when applicable
authorTimo Kokkonen <timo.t.kokkonen@iki.fi>
Wed, 22 Feb 2012 19:59:49 +0000 (21:59 +0200)
committerTimo Kokkonen <timo.t.kokkonen@iki.fi>
Wed, 22 Feb 2012 20:01:39 +0000 (22:01 +0200)
This improves code readability and maintainability without costing
anything.

Signed-off-by: Timo Kokkonen <timo.t.kokkonen@iki.fi>
string.h

index 377e4392dea8c9be31ca7d45b9603aa6e047d8af..31ac799393b695e04da48ec308a7deb26cf8cd5a 100644 (file)
--- a/string.h
+++ b/string.h
@@ -3,6 +3,7 @@
 
 #include <string.h>
 #include <stdlib.h>
+#include <ctype.h>
 
 int dec_to_int(char *src, char **dst);
 long long dec_to_longlong(char *src, char **dst);
@@ -11,7 +12,7 @@ int get_word(char *src, char **dst, char *word, int size);
 
 static inline char *skip_non_numbers(char *str)
 {
-       while(((*str < '0') || (*str > '9')) && *str)
+       while(*str && !isdigit(*str))
                str++;
 
        return str;
@@ -19,7 +20,7 @@ static inline char *skip_non_numbers(char *str)
 
 static inline char *skip_numbers(char *str)
 {
-       while((*str >= '0') && (*str <= '9'))
+       while(isdigit(*str))
                str++;
 
        return str;