1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-09 15:10:29 +02:00
guile/precise-roots-api.h
2022-08-16 17:54:15 +02:00

21 lines
596 B
C

#ifndef PRECISE_ROOTS_API_H
#define PRECISE_ROOTS_API_H
#include "precise-roots-types.h"
#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.roots, &h.handle)
#define POP_HANDLE(cx) pop_handle(&(cx)->roots.roots)
static inline void push_handle(struct handle **roots, struct handle *handle) {
handle->next = *roots;
*roots = handle;
}
static inline void pop_handle(struct handle **roots) {
*roots = (*roots)->next;
}
#endif // PRECISE_ROOTS_API_H