mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-13 09:10:26 +02:00
Refactor handling of precise and conservative roots
This commit is contained in:
parent
2a619ba67d
commit
283721b39a
5 changed files with 31 additions and 37 deletions
19
precise-roots.h
Normal file
19
precise-roots.h
Normal file
|
@ -0,0 +1,19 @@
|
|||
struct handle {
|
||||
void *v;
|
||||
struct handle *next;
|
||||
};
|
||||
|
||||
#define HANDLE_TO(T) union { T* v; struct handle handle; }
|
||||
#define HANDLE_REF(h) h.v
|
||||
#define HANDLE_SET(h,val) do { h.v = val; } while (0)
|
||||
#define PUSH_HANDLE(cx, h) push_handle(&cx->roots, &h.handle)
|
||||
#define POP_HANDLE(cx, h) pop_handle(&cx->roots, &h.handle)
|
||||
|
||||
static inline void push_handle(struct handle **roots, struct handle *handle) {
|
||||
handle->next = *roots;
|
||||
*roots = handle;
|
||||
}
|
||||
|
||||
static inline void pop_handle(struct handle **roots, struct handle *handle) {
|
||||
*roots = handle->next;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue