]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/include/lily-guile.hh
release: 1.5.19
[lilypond.git] / lily / include / lily-guile.hh
index 54c9decd293fea8ff8ef6a33d7caabae96ff427e..e67293e06f89c3c4897097722899b1e692e53f41 100644 (file)
@@ -9,6 +9,8 @@
 #ifndef LILY_GUILE_HH
 #define LILY_GUILE_HH
 
+#define SCM_VOIDP_TEST
+
 #include <libguile.h>
 
 /*
@@ -89,6 +91,8 @@ SCM ly_truncate_list (int k, SCM l );
 #define CACHE_SYMBOLS
 #ifdef CACHE_SYMBOLS
 
+SCM my_gh_symbol2scm (const char* x);
+
 // #warning: CACHE_SYMBOLS
 
 /*
@@ -102,10 +106,11 @@ SCM ly_truncate_list (int k, SCM l );
 */
 #define ly_symbol2scm(x) ({ static SCM cached;  \
  SCM value = cached;  /* We store this one locally, since G++ -O2 fucks up else */   \
- if (__builtin_constant_p (x))\
-   value = cached =  scm_permanent_object (gh_symbol2scm((char*)x));\
- else\
-  value = gh_symbol2scm ((char*)x); \
+ if ( __builtin_constant_p ((x)))\
+ {  if (!cached)\
+     value = cached =  scm_gc_protect_object (my_gh_symbol2scm((char*) (x)));\
+ } else\
+  value = gh_symbol2scm ((char*) (x)); \
   value; })
 #else
 inline SCM ly_symbol2scm(char const* x) { return gh_symbol2scm((char*)x); }