summaryrefslogtreecommitdiff
path: root/complex.c
diff options
context:
space:
mode:
Diffstat (limited to 'complex.c')
-rw-r--r--complex.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/complex.c b/complex.c
index 761b70c042..f9f9eed232 100644
--- a/complex.c
+++ b/complex.c
@@ -1726,19 +1726,26 @@ parse_comp(const char *s, int strict,
VALUE *num)
{
char *buf, *b;
+ VALUE tmp;
+ int ret = 1;
- buf = ALLOCA_N(char, strlen(s) + 1);
+ buf = ALLOCV_N(char, tmp, strlen(s) + 1);
b = buf;
skip_ws(&s);
- if (!read_comp(&s, strict, num, &b))
- return 0;
- skip_ws(&s);
+ if (!read_comp(&s, strict, num, &b)) {
+ ret = 0;
+ }
+ else {
+ skip_ws(&s);
- if (strict)
- if (*s != '\0')
- return 0;
- return 1;
+ if (strict)
+ if (*s != '\0')
+ ret = 0;
+ }
+ ALLOCV_END(tmp);
+
+ return ret;
}
static VALUE