X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Fmodule-scheme.cc;h=eda467fe68b259336663f08ccfaf72f1e2818afb;hb=2bbacb364aa29041af9cbbbd32cfad2e8e387cb3;hp=67f642ec08dbcfd41adc007a0c36cba92846aea7;hpb=47db9a3883d726ca53e2133a3b2298f78dd6a32e;p=lilypond.git diff --git a/lily/module-scheme.cc b/lily/module-scheme.cc index 67f642ec08..eda467fe68 100644 --- a/lily/module-scheme.cc +++ b/lily/module-scheme.cc @@ -33,8 +33,8 @@ module_define_closure_func (void *closure, SCM val, SCM /* result */) { - SCM module = (SCM) closure; - if (scm_variable_bound_p (val) == SCM_BOOL_T) + SCM module = *static_cast (closure); + if (to_boolean (scm_variable_bound_p (val))) scm_module_define (module, key, scm_variable_ref (val)); return SCM_EOL; } @@ -46,7 +46,7 @@ LY_DEFINE (ly_module_copy, "ly:module-copy", #define FUNC_NAME __FUNCTION__ SCM_VALIDATE_MODULE (1, src); scm_internal_hash_fold ((scm_t_hash_fold_fn) &module_define_closure_func, - (void *) dest, + static_cast (&dest), SCM_EOL, SCM_MODULE_OBARRAY (src)); return SCM_UNSPECIFIED; } @@ -67,9 +67,9 @@ ly_module_lookup (SCM module, SCM sym) /* Issue 2758: Guile V2 onward has a scm_module_variable API module. - Guile V1.8.7 only has a (module-variable) REPL function, however - using ly_lily_module_constant ("module-variable") and calling - the memoized result is slow. + Guile V1.8.7 only has a (module-variable) REPL function and we + can't import this via Scm_variable since that needs + ly_module_lookup itself. */ #if GUILEV1 return scm_sym2var (sym, scm_module_lookup_closure (module), SCM_BOOL_F); @@ -92,11 +92,11 @@ LY_DEFINE (ly_modules_lookup, "ly:modules-lookup", { SCM mod = scm_car (s); SCM v = ly_module_lookup (mod, sym); - if (SCM_VARIABLEP (v) && SCM_VARIABLE_REF (v) != SCM_UNDEFINED) + if (SCM_VARIABLEP (v) && !SCM_UNBNDP (SCM_VARIABLE_REF (v))) return scm_variable_ref (v); } - if (def != SCM_UNDEFINED) + if (!SCM_UNBNDP (def)) return def; return SCM_BOOL_F; }