diff --git a/ChangeLog b/ChangeLog index a01007d81..2852c52af 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2012-03-02 Vladimir Serbinenko + + * util/ieee1275/ofpath.c (my_isdigit): New function. + (trailing_digits): Use my_isdigit. + (strip_trailing_digits): Likewise. + 2012-03-02 Vladimir Serbinenko * util/resolve.c (read_dep_list): Use grub_isspace instead of isspace. diff --git a/util/ieee1275/ofpath.c b/util/ieee1275/ofpath.c index 34132a267..03baceda8 100644 --- a/util/ieee1275/ofpath.c +++ b/util/ieee1275/ofpath.c @@ -185,6 +185,12 @@ block_device_get_sysfs_path_and_link(const char *devicenode) return ret; } +static inline int +my_isdigit (int c) +{ + return (c >= '0' && c <= '9'); +} + static const char * trailing_digits (const char *p) { @@ -193,7 +199,7 @@ trailing_digits (const char *p) end = p + strlen(p) - 1; while (end >= p) { - if (! isdigit(*end)) + if (! my_isdigit(*end)) break; end--; } @@ -410,7 +416,7 @@ strip_trailing_digits (const char *p) end = new + strlen(new) - 1; while (end >= new) { - if (! isdigit(*end)) + if (! my_isdigit(*end)) break; *end-- = '\0'; }