summaryrefslogtreecommitdiff
path: root/libguile/stacks.c
diff options
context:
space:
mode:
authorAndy Wingo <wingo@pobox.com>2011-07-29 09:17:47 +0200
committerAndy Wingo <wingo@pobox.com>2011-07-29 09:17:47 +0200
commit0f75cc78096578f85cc66bba054044116e2ca413 (patch)
tree6d3ffb5eb28f71b96509e958c84049c44afad2dd /libguile/stacks.c
parent89f886122a37a051087fbfbbab5400a29a661b06 (diff)
downloadguile-0f75cc78096578f85cc66bba054044116e2ca413.tar.gz
simplify narrow_stack.
* libguile/stacks.c (narrow_stack): Simplify outer narrowing by a number of frames. Thanks to http://article.gmane.org/gmane.lisp.guile.devel/12685.
Diffstat (limited to 'libguile/stacks.c')
-rw-r--r--libguile/stacks.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/libguile/stacks.c b/libguile/stacks.c
index 86188f416..d0e82f7bd 100644
--- a/libguile/stacks.c
+++ b/libguile/stacks.c
@@ -184,11 +184,10 @@ narrow_stack (SCM stack, long inner, SCM inner_key, long outer, SCM outer_key)
else
{
/* Cut specified number of frames. */
- for (; outer && len ; --outer)
- {
- frame = scm_stack_ref (stack, scm_from_long (len - 1));
- len--;
- }
+ if (outer < len)
+ len -= outer;
+ else
+ len = 0;
}
SCM_SET_STACK_LENGTH (stack, len);