lilypond-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Unsecure assoc calls


From: Neil Puttock
Subject: Re: Unsecure assoc calls
Date: Thu, 17 Sep 2009 23:47:37 +0100

2009/9/17 Michael Käppler <address@hidden>:

> that's nice. Here's the next step.

Hmm, some of these don't look too secure. :)

                (let* ((table (ly:output-def-lookup layout 'label-page-table))
-                      (label-page (and (list? table) (assoc label table)))
-                      (page-number (and label-page (cdr label-page)))
+                      (page-number (assoc-get label table))

I'm not sure we can always rely on 'label-page-table being a list here.

+    (let ((clef-prop+name (assoc-get (list ?clef-glyph ?clef-position 0)

I suggest changing the name here, since it's now just clef-name.

+  (assoc-get (- moment) moment-duration-alist =))

This looks dangerous.  I had to check the Guile docs here, but the
original assoc call uses the enhanced version from SRFI-1, which has
an optional argument for a comparison procedure.

+  (let* ((handle (assoc-get name '(("volta" . VoltaRepeatedMusic)

Again, the naming should be changed here (and for all cases where
`handle' is used), since it's no longer a handle.

+        (desc-handle (assoc-get 'description context-desc))
+        (desc (if (string? desc-handle)
+                  desc-handle
+                  "(not documented)"))

This could be simplified further; I'm sure if desc-handle returns
anything other than #f, it's going to be a string, since all contexts
have a \description in engraver-init.ly.

(desc (assoc-get 'description context-desc "(not documented)"))

+         (entry (assoc-get inst instrument-names-alist)))
+     (if (>= entry 32768)

What if entry returns #f?

> Btw. what's going on with the paper-margins patch? Could you run another
> regtest / doc build?

I'll try to test it tomorrow.

Regards,
Neil




reply via email to

[Prev in Thread] Current Thread [Next in Thread]