diff --git a/include/cyclone/runtime.h b/include/cyclone/runtime.h index 5c666fae..93f21f70 100644 --- a/include/cyclone/runtime.h +++ b/include/cyclone/runtime.h @@ -98,16 +98,16 @@ object Cyc_global_set(void *thd, object *glo, object value); return_closcall1(data, cont, &d) #define return_exact_double_op(data, cont, OP, z) \ - make_int(i, 0); \ + int i = 0; \ Cyc_check_num(data, z); \ if (obj_is_int(z)) { \ - i.value = obj_obj2int(z); \ + i = obj_obj2int(z); \ } else if (type_of(z) == integer_tag) { \ - i.value = (int)OP(((integer_type *)z)->value); \ + i = (int)OP(((integer_type *)z)->value); \ } else { \ - i.value = (int)OP(((double_type *)z)->value); \ + i = (int)OP(((double_type *)z)->value); \ } \ - return_closcall1(data, cont, &i) + return_closcall1(data, cont, obj_int2obj(i)) #define unbox_number(n) \ ((obj_is_int(n) ? obj_obj2int(n) : \ diff --git a/runtime.c b/runtime.c index 26e58082..3d5166e6 100644 --- a/runtime.c +++ b/runtime.c @@ -1108,7 +1108,7 @@ object Cyc_list2string(void *data, object cont, object lst){ object Cyc_string2number2_(void *data, object cont, int argc, object str, ...) { object base = nil; - int base_num; + int base_num, result; va_list ap; va_start(ap, str); if (argc > 1) { @@ -1120,20 +1120,21 @@ object Cyc_string2number2_(void *data, object cont, int argc, object str, ...) base_num = obj_is_int(base) ? obj_obj2int(base) : integer_value(base); Cyc_check_str(data, str); if (base_num == 2) { - make_int(result, binstr2int(string_str(str))); - return_closcall1(data, cont, &result); + result = binstr2int(string_str(str)); + return_closcall1(data, cont, obj_int2obj(result)); }else if (base_num == 8) { - make_int(result, octstr2int(string_str(str))); - return_closcall1(data, cont, &result); + result = octstr2int(string_str(str)); + return_closcall1(data, cont, obj_int2obj(result)); }else if (base_num == 16) { - make_int(result, hexstr2int(string_str(str))); - return_closcall1(data, cont, &result); + result = hexstr2int(string_str(str)); + return_closcall1(data, cont, obj_int2obj(result)); } } Cyc_string2number_(data, cont, str); } object Cyc_string2number_(void *data, object cont, object str){ + int result; double n; Cyc_check_obj(data, string_tag, str); Cyc_check_str(data, str); @@ -1142,8 +1143,8 @@ object Cyc_string2number_(void *data, object cont, object str){ n = atof(((string_type *) str)->str); if (ceilf(n) == n) { - make_int(result, (int)n); - return_closcall1(data, cont, &result); + result = (int)n; + return_closcall1(data, cont, obj_int2obj(result)); } else { make_double(result, n);