Signed-off-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx> --- drivers/staging/speakup/varhandlers.c | 23 +++++------------------ 1 file changed, 5 insertions(+), 18 deletions(-) diff --git a/drivers/staging/speakup/varhandlers.c b/drivers/staging/speakup/varhandlers.c index be61a4e..b1c155b 100644 --- a/drivers/staging/speakup/varhandlers.c +++ b/drivers/staging/speakup/varhandlers.c @@ -333,9 +333,9 @@ char *spk_xlate(char *s) { static const char finds[] = "nrtvafe"; static const char subs[] = "\n\r\t\013\001\014\033"; - static const char hx[] = "0123456789abcdefABCDEF"; - char *p = s, *p1, *p2, c; - int num; + char *p = s, *p1, *p2; + u8 num; + while ((p = strchr(p, '\\'))) { p1 = p+1; p2 = strchr(finds, *p1); @@ -349,21 +349,8 @@ char *spk_xlate(char *s) num = (*p1++)&7; } *p++ = num; - } else if (*p1 == 'x' && - strchr(hx, p1[1]) && strchr(hx, p1[2])) { - p1++; - c = *p1++; - if (c > '9') - c = (c - '7') & 0x0f; - else - c -= '0'; - num = c << 4; - c = *p1++; - if (c > '9') - c = (c-'7')&0x0f; - else - c -= '0'; - num += c; + } else if (*p1 == 'x' && !hex2bin(&num, p1 + 1, 1)) { + p1 += 3; *p++ = num; } else *p++ = *p1++; -- 1.8.2.rc0.22.gb3600c3 _______________________________________________ devel mailing list devel@xxxxxxxxxxxxxxxxxxxxxx http://driverdev.linuxdriverproject.org/mailman/listinfo/devel