make_obj(void) { return (ScmObj)scm_call_with_gc_ready_stack(make_obj_internal, NULL); } static void * make_obj_internal(void *dummy) { return (void *)CONS(SCM_FALSE, SCM_FALSE); } TST_CASE("scm_gc_protected_contextp()") { TST_TN_FALSE(scm_gc_protected_contextp()); TST_TN_TRUE (protected_func(NULL) == NULL); TST_TN_TRUE (scm_call_with_gc_ready_stack(protected_func, NULL)); TST_TN_FALSE(protected_func(NULL)); } static void * protected_func(void *arg) { return (void *)scm_gc_protected_contextp(); } TST_CASE("GC stack protection") { TST_TN_FALSE(scm_gc_protected_contextp()); #if TRY_TESTS_THAT_PASS_IN_MOST_CASES
void call_protected_func1(void) { printf("var = %d, %s at %s\n", protected_var, __func__, __FILE__); protected_func(); }