emacs-bug-tracker
[Top][All Lists]
Advanced

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

[debbugs-tracker] bug#22630: closed ([PATCH] Let assv/assoc shortcircuit


From: GNU bug Tracking System
Subject: [debbugs-tracker] bug#22630: closed ([PATCH] Let assv/assoc shortcircuit to assq where feasible)
Date: Sun, 07 Aug 2016 20:54:02 +0000

Your message dated Sun, 07 Aug 2016 22:53:41 +0200
with message-id <address@hidden>
and subject line Re: bug#22630: [PATCH] Let assv/assoc shortcircuit to assq 
where feasible
has caused the debbugs.gnu.org bug report #22630,
regarding [PATCH] Let assv/assoc shortcircuit to assq where feasible
to be marked as done.

(If you believe you have received this mail in error, please contact
address@hidden)


-- 
22630: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=22630
GNU Bug Tracking System
Contact address@hidden with problems
--- Begin Message --- Subject: [PATCH] Let assv/assoc shortcircuit to assq where feasible Date: Thu, 11 Feb 2016 12:31:48 +0100
        * libguile/alist.c (scm_sloppy_assv, scm_sloppy_assoc):
        Shortcircuit to scm_sloppy_assq where feasible
        (scm_assv, scm_assoc): Shortcircuit to scm_assq where feasible
---
 libguile/alist.c | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/libguile/alist.c b/libguile/alist.c
index f33aa41..e9bb80e 100644
--- a/libguile/alist.c
+++ b/libguile/alist.c
@@ -28,6 +28,7 @@
 
 #include "libguile/validate.h"
 #include "libguile/pairs.h"
+#include "libguile/numbers.h"
 #include "libguile/alist.h"
 
 
@@ -72,6 +73,12 @@ SCM_DEFINE (scm_sloppy_assv, "sloppy-assv", 2, 0, 0,
            "Recommended only for use in Guile internals.")
 #define FUNC_NAME s_scm_sloppy_assv
 {
+  /* Non-immediate numbers are the only keys we need to check
+   * other than with eq
+   */
+  if (!SCM_NUMP (key))
+    return scm_sloppy_assq (key, alist);
+
   for (; scm_is_pair (alist); alist = SCM_CDR (alist))
     {
       SCM tmp = SCM_CAR (alist);
@@ -90,6 +97,10 @@ SCM_DEFINE (scm_sloppy_assoc, "sloppy-assoc", 2, 0, 0,
            "Recommended only for use in Guile internals.")
 #define FUNC_NAME s_scm_sloppy_assoc
 {
+  /* Immediate values can be checked using eq */
+  if (SCM_IMP (key))
+    return scm_sloppy_assq (key, alist);
+
   for (; scm_is_pair (alist); alist = SCM_CDR (alist))
     {
       SCM tmp = SCM_CAR (alist);
@@ -139,6 +150,13 @@ SCM_DEFINE (scm_assv, "assv", 2, 0, 0,
 #define FUNC_NAME s_scm_assv
 {
   SCM ls = alist;
+
+  /* Non-immediate numbers are the only keys we need to check
+   * other than with eq
+   */
+  if (!SCM_NUMP (key))
+    return scm_assq (key, alist);
+
   for(; scm_is_pair (ls); ls = SCM_CDR (ls)) 
     {
       SCM tmp = SCM_CAR (ls);
@@ -160,6 +178,11 @@ SCM_DEFINE (scm_assoc, "assoc", 2, 0, 0,
 #define FUNC_NAME s_scm_assoc
 {
   SCM ls = alist;
+
+  /* Immediate values can be checked using eq */
+  if (SCM_IMP (key))
+    return scm_assq (key, alist);
+
   for(; scm_is_pair (ls); ls = SCM_CDR (ls)) 
     {
       SCM tmp = SCM_CAR (ls);
-- 
2.5.0




--- End Message ---
--- Begin Message --- Subject: Re: bug#22630: [PATCH] Let assv/assoc shortcircuit to assq where feasible Date: Sun, 07 Aug 2016 22:53:41 +0200 User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux)
On Thu 11 Feb 2016 12:31, David Kastrup <address@hidden> writes:

>       * libguile/alist.c (scm_sloppy_assv, scm_sloppy_assoc):
>       Shortcircuit to scm_sloppy_assq where feasible
>       (scm_assv, scm_assoc): Shortcircuit to scm_assq where feasible

Applied to master, will backport when I get a chance.  Thanks :)

Andy


--- End Message ---

reply via email to

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