summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2015-10-04 08:59:30 -0700
committerKaz Kylheku <kaz@kylheku.com>2015-10-04 08:59:30 -0700
commit3911b067ed00ad1cda5cdebd9945f1e5d80b6a57 (patch)
tree3439fdcc07343bb4f1657cc28122ad21e1f94a6c
parent66320508c3c964ea33584c5c4b1b84850ae469bf (diff)
downloadtxr-3911b067ed00ad1cda5cdebd9945f1e5d80b6a57.tar.gz
txr-3911b067ed00ad1cda5cdebd9945f1e5d80b6a57.tar.bz2
txr-3911b067ed00ad1cda5cdebd9945f1e5d80b6a57.zip
Eliminate recursion from make_struct.
* struct.c (make_struct): Don't wastefully evaluate the symbolp test twice via recursion; assign and fall through.
-rw-r--r--struct.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/struct.c b/struct.c
index 0a38677a..bc490a6e 100644
--- a/struct.c
+++ b/struct.c
@@ -326,8 +326,10 @@ val make_struct(val type, val plist, struct args *args)
if (!typeobj)
uw_throwf(error_s, lit("~a: ~s doesn't name a struct type"),
self, type, nao);
- return make_struct(typeobj, plist, args);
- } else {
+ type = typeobj;
+ }
+
+ {
struct struct_type *st = coerce(struct struct_type *,
cobj_handle(type, struct_type_s));
cnum nslots = st->nslots, sl;