]> git.donarmstrong.com Git - lilypond.git/commitdiff
Issue 4057: Create Context::here_defined as faster variant of Context::where_defined
authorDavid Kastrup <dak@gnu.org>
Sat, 9 Aug 2014 19:57:44 +0000 (21:57 +0200)
committerDavid Kastrup <dak@gnu.org>
Thu, 14 Aug 2014 15:57:24 +0000 (17:57 +0200)
lily/context.cc
lily/include/context.hh

index 7077014501a7651e76b5f8fe80bc2dea130dded2..718ef311225dfb0062e8e079990231496a49fbfd 100644 (file)
@@ -459,6 +459,19 @@ Context::where_defined (SCM sym, SCM *value) const
   return (daddy_context_) ? daddy_context_->where_defined (sym, value) : 0;
 }
 
+/* Quick variant of where_defined.  Checks only the context itself. */
+
+bool
+Context::here_defined (SCM sym, SCM *value) const
+{
+#ifndef NDEBUG
+  if (profile_property_accesses)
+    note_property_access (&context_property_lookup_table, sym);
+#endif
+
+  return properties_dict ()->try_retrieve (sym, value);
+}
+
 /*
   return SCM_EOL when not found.
 */
index d6cdfde6e4d7e35b934542dffc4c368fe0f23ffd..0595bf851389c655080c34e1199aaa1437bb02fa 100644 (file)
@@ -97,6 +97,7 @@ public:
   SCM internal_get_property (SCM name_sym) const;
   SCM properties_as_alist () const;
   Context *where_defined (SCM name_sym, SCM *value) const;
+  bool here_defined (SCM name_sym, SCM *value) const;
   void unset_property (SCM var_sym);
 
   void instrumented_set_property (SCM, SCM, const char *, int, const char *);