From add39db40b5b617a2444e65aab56c78252507d23 Mon Sep 17 00:00:00 2001 From: Alex Shinn Date: Wed, 20 Jan 2010 21:00:37 +0900 Subject: [PATCH] fixing error checks on first digit for numbers with #r prefix (issue #27) --- sexp.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sexp.c b/sexp.c index 5e313b12..e0285afc 100644 --- a/sexp.c +++ b/sexp.c @@ -1328,12 +1328,12 @@ sexp sexp_read_number(sexp ctx, sexp in, int base) { int c, digit, negativep = 0; c = sexp_read_char(ctx, in); - if (c == '-') + if (c == '-') { negativep = 1; - else if (isdigit(c)) - res = digit_value(c); + c = sexp_read_char(ctx, in); + } - for (c=sexp_read_char(ctx, in); isxdigit(c); c=sexp_read_char(ctx, in)) { + for ( ; isxdigit(c); c=sexp_read_char(ctx, in)) { digit = digit_value(c); if ((digit < 0) || (digit >= base)) break;