lkml.org 
[lkml]   [2010]   [Sep]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] drivers: s390: remove custom implementation of hex_to_bin()
On Sat, Sep 11, 2010 at 04:36:38PM +0300, Andy Shevchenko wrote:
> diff --git a/drivers/s390/cio/blacklist.c b/drivers/s390/cio/blacklist.c
> index 13cb601..76058a5 100644
> --- a/drivers/s390/cio/blacklist.c
> +++ b/drivers/s390/cio/blacklist.c
> @@ -79,17 +79,15 @@ static int pure_hex(char **cp, unsigned int *val, int min_digit,
> int max_digit, int max_val)
> {
> int diff;
> - unsigned int value;
>
> diff = 0;
> *val = 0;
>
> - while (isxdigit(**cp) && (diff <= max_digit)) {
> + while (diff <= max_digit) {
> + int value = hex_to_bin(**cp);
>
> - if (isdigit(**cp))
> - value = **cp - '0';
> - else
> - value = tolower(**cp) - 'a' + 10;
> + if (value < 0)
> + break;
> *val = *val * 16 + value;
> (*cp)++;
> diff++;

Applied, thanks!


\
 
 \ /
  Last update: 2010-09-13 10:07    [W:0.046 / U:0.036 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site