emacs-devel
[Top][All Lists]
Advanced

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

Re: member inconsistency?


From: Stephen Berman
Subject: Re: member inconsistency?
Date: Thu, 28 Jan 2016 23:41:53 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)

On Thu, 28 Jan 2016 23:18:29 +0100 Andreas Schwab <address@hidden> wrote:

> Stephen Berman <address@hidden> writes:
>
>> diff --git a/src/fns.c b/src/fns.c
>> index 86ad333..17c4a75 100644
>> --- a/src/fns.c
>> +++ b/src/fns.c
>> @@ -1349,7 +1349,7 @@ The value is actually the tail of LIST whose car is 
>> ELT.  */)
>>    (register Lisp_Object elt, Lisp_Object list)
>>  {
>>    register Lisp_Object tail;
>> -  for (tail = list; CONSP (tail); tail = XCDR (tail))
>> +  for (tail = list; CONSP (tail) || !NILP (tail); tail = XCDR (tail))
>>      {
>>        register Lisp_Object tem;
>>        CHECK_LIST_CONS (tail, list);
>
> The check for CONSP in the loop condition is redundant, that is already
> checked by CHECK_LIST_CONS (and the latter was a no-op before).

Thanks.  So is the following patch ok to commit to emacs-25?

diff --git a/src/fns.c b/src/fns.c
index 86ad333..b75f0c8 100644
--- a/src/fns.c
+++ b/src/fns.c
@@ -1349,7 +1349,7 @@ The value is actually the tail of LIST whose car is ELT.  
*/)
   (register Lisp_Object elt, Lisp_Object list)
 {
   register Lisp_Object tail;
-  for (tail = list; CONSP (tail); tail = XCDR (tail))
+  for (tail = list; !NILP (tail); tail = XCDR (tail))
     {
       register Lisp_Object tem;
       CHECK_LIST_CONS (tail, list);
@@ -1397,7 +1397,7 @@ The value is actually the tail of LIST whose car is ELT.  
*/)
   if (!FLOATP (elt))
     return Fmemq (elt, list);
 
-  for (tail = list; CONSP (tail); tail = XCDR (tail))
+  for (tail = list; !NILP (tail); tail = XCDR (tail))
     {
       register Lisp_Object tem;
       CHECK_LIST_CONS (tail, list);



reply via email to

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