]> git.donarmstrong.com Git - lilypond.git/commitdiff
Issue 4069: Rewrite ly_lily_module_constant in terms of scm_c_module_lookup
authorDavid Kastrup <dak@gnu.org>
Sun, 17 Aug 2014 13:52:19 +0000 (15:52 +0200)
committerDavid Kastrup <dak@gnu.org>
Fri, 22 Aug 2014 07:23:15 +0000 (09:23 +0200)
Overusing eval is not desirable.

lily/include/lily-guile-macros.hh

index acc817f87812779cc3c20a9290b7eac379d59363..1bdf9aa7bc20a75db5f1565e210eaf216858dd3b 100644 (file)
@@ -81,8 +81,6 @@ inline SCM ly_symbol2scm (char const *x) { return scm_from_locale_symbol ((x));
 #endif
 
 /*
-  TODO: rename me to ly_c_lily_module_eval
-
   we don't have to protect the result; it's already part of the
   exports list of the module.
 */
@@ -95,11 +93,12 @@ inline SCM ly_symbol2scm (char const *x) { return scm_from_locale_symbol ((x));
     if (__builtin_constant_p ((x)))                                     \
       {                                                                 \
         if (!cached)                                                    \
-          value = cached = scm_eval (scm_from_locale_symbol (x),                \
-                                    global_lily_module);                \
+          value = cached =                                              \
+            scm_variable_ref (scm_c_module_lookup (global_lily_module, (x))); \
       }                                                                 \
     else                                                                \
-      value = scm_eval (scm_from_locale_symbol (x), global_lily_module);        \
+      value =                                                           \
+        scm_variable_ref (scm_c_module_lookup (global_lily_module, (x))); \
     value;                                                              \
   })