summaryrefslogtreecommitdiff
path: root/rational.c
diff options
context:
space:
mode:
authortadf <tadf@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-11-18 00:26:15 (GMT)
committertadf <tadf@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-11-18 00:26:15 (GMT)
commit7a1985a96970f7e759b945be74e7a8f41a797cd8 (patch)
treed1de1561d045fa419cbdb48cd45387ff2a649d2e /rational.c
parent55915036a6d1edebe739737bb7d910a8851e21e5 (diff)
trivial changes.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37707 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'rational.c')
-rw-r--r--rational.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/rational.c b/rational.c
index 88f4083..9718913 100644
--- a/rational.c
+++ b/rational.c
@@ -1,5 +1,5 @@
/*
- rational.c: Coded by Tadayoshi Funaba 2008-2011
+ rational.c: Coded by Tadayoshi Funaba 2008-2012
This implementation is based on Keiju Ishitsuka's Rational library
which is written in ruby.
@@ -2093,18 +2093,21 @@ read_rat(const char **s, int strict,
return 1;
}
+static void
+skip_ws(const char **s)
+{
+ while (isspace((unsigned char)**s))
+ (*s)++;
+}
+
static int
parse_rat(const char *s, int strict,
VALUE *num)
{
- while (isspace((unsigned char)*s))
- s++;
-
+ skip_ws(&s);
if (!read_rat(&s, strict, num))
return 0;
-
- while (isspace((unsigned char)*s))
- s++;
+ skip_ws(&s);
if (strict)
if (*s != '\0')