comparison src/coding.c @ 45237:3bb204606957

(intersection): Keep the elements of the returned list in the same order as in the first list.
author Andreas Schwab <schwab@suse.de>
date Sat, 11 May 2002 15:59:49 +0000
parents 6ce63e0a93f1
children 6a20d4c6bb78
comparison
equal deleted inserted replaced
45236:ebc4fa4ef475 45237:3bb204606957
6322 6322
6323 static Lisp_Object 6323 static Lisp_Object
6324 intersection (l1, l2) 6324 intersection (l1, l2)
6325 Lisp_Object l1, l2; 6325 Lisp_Object l1, l2;
6326 { 6326 {
6327 Lisp_Object val; 6327 Lisp_Object val = Fcons (Qnil, Qnil), tail;
6328 6328
6329 for (val = Qnil; CONSP (l1); l1 = XCDR (l1)) 6329 for (tail = val; CONSP (l1); l1 = XCDR (l1))
6330 { 6330 {
6331 if (!NILP (Fmemq (XCAR (l1), l2))) 6331 if (!NILP (Fmemq (XCAR (l1), l2)))
6332 val = Fcons (XCAR (l1), val); 6332 {
6333 } 6333 XSETCDR (tail, Fcons (XCAR (l1), Qnil));
6334 return val; 6334 tail = XCDR (tail);
6335 }
6336 }
6337 return XCDR (val);
6335 } 6338 }
6336 6339
6337 6340
6338 /* Subroutine for Fsafe_coding_systems_region_internal. 6341 /* Subroutine for Fsafe_coding_systems_region_internal.
6339 6342