diff options
author | Mikael Djurfeldt <djurfeldt@nada.kth.se> | 2000-03-14 06:39:44 +0000 |
---|---|---|
committer | Mikael Djurfeldt <djurfeldt@nada.kth.se> | 2000-03-14 06:39:44 +0000 |
commit | bd47429edb8f1d2e3942811a69b5430c54c14a40 (patch) | |
tree | a238b63d685a14b079bf2c8576de156b354309cb /libguile/dynwind.c | |
parent | 7cf1a27e9c71a16d4d15516640c2e8c6ebd003b5 (diff) | |
download | guile-bd47429edb8f1d2e3942811a69b5430c54c14a40.tar.gz |
* dynwind.c: changed the wind-guards representation to double
cell.
Diffstat (limited to 'libguile/dynwind.c')
-rw-r--r-- | libguile/dynwind.c | 35 |
1 files changed, 8 insertions, 27 deletions
diff --git a/libguile/dynwind.c b/libguile/dynwind.c index 8a51f3e68..879864f79 100644 --- a/libguile/dynwind.c +++ b/libguile/dynwind.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1995, 1996, 1998, 1999 Free Software Foundation, Inc. +/* Copyright (C) 1995, 1996, 1998, 1999, 2000 Free Software Foundation, Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -135,27 +135,13 @@ SCM_DEFINE (scm_dynamic_wind, "dynamic-wind", 3, 0, 0, * smob. Objects of this type are pushed onto the dynwind chain. */ -typedef struct guardsmem { - scm_guard_t before; - scm_guard_t after; - void *data; -} guardsmem; - -#define SCM_GUARDSMEM(obj) ((guardsmem *) SCM_CDR (obj)) -#define SCM_BEFORE_GUARD(obj) (SCM_GUARDSMEM (obj)->before) -#define SCM_AFTER_GUARD(obj) (SCM_GUARDSMEM (obj)->after) -#define SCM_GUARD_DATA(obj) (SCM_GUARDSMEM (obj)->data) -#define SCM_GUARDSP(obj) (SCM_NIMP(obj) && (SCM_UNPACK_CAR (obj) == tc16_guards)) +#define SCM_GUARDSP(obj) SCM_SMOB_PREDICATE (tc16_guards, obj) +#define SCM_BEFORE_GUARD(obj) ((scm_guard_t) SCM_CELL_WORD (obj, 1)) +#define SCM_AFTER_GUARD(obj) ((scm_guard_t) SCM_CELL_WORD (obj, 2)) +#define SCM_GUARD_DATA(obj) ((void *) SCM_CELL_WORD (obj, 3)) static long tc16_guards; -static scm_sizet -freeguards (SCM guards) -{ - scm_must_free ((char *) SCM_CDR (guards)); - return sizeof (guardsmem); -} - static int printguards (SCM exp, SCM port, scm_print_state *pstate) { @@ -173,13 +159,8 @@ scm_internal_dynamic_wind (scm_guard_t before, void *guard_data) { SCM guards, ans; - guardsmem *g; before (guard_data); - g = (guardsmem *) scm_must_malloc (sizeof (*g), "guards"); - g->before = before; - g->after = after; - g->data = guard_data; - SCM_NEWSMOB (guards, tc16_guards, g); + SCM_NEWSMOB3 (guards, tc16_guards, before, after, guard_data); scm_dynwinds = scm_acons (guards, SCM_BOOL_F, scm_dynwinds); ans = inner (inner_data); scm_dynwinds = SCM_CDR (scm_dynwinds); @@ -288,7 +269,7 @@ scm_dowinds (SCM to, long delta) void scm_init_dynwind () { - tc16_guards = scm_make_smob_type_mfpe ("guards", sizeof (struct guardsmem), - NULL, freeguards, printguards, NULL); + tc16_guards = scm_make_smob_type_mfpe ("guards", 0, + NULL, scm_free0, printguards, NULL); #include "dynwind.x" } |