diff options
| author | Andreas Schwab | 2002-05-11 16:00:10 +0000 |
|---|---|---|
| committer | Andreas Schwab | 2002-05-11 16:00:10 +0000 |
| commit | eef762fc0f8608ace52913b8dca6263a88e02f6d (patch) | |
| tree | 26cb28764e40de0418f6a0e4ec835df68c8ca580 /src/coding.c | |
| parent | b670783a4be69f5785b1214f2053e2e75c88d7b5 (diff) | |
| download | emacs-eef762fc0f8608ace52913b8dca6263a88e02f6d.tar.gz emacs-eef762fc0f8608ace52913b8dca6263a88e02f6d.zip | |
(intersection): Keep the elements of the returned list
in the same order as in the first list.
Diffstat (limited to 'src/coding.c')
| -rw-r--r-- | src/coding.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/coding.c b/src/coding.c index 8c54f86e531..baf6acf08af 100644 --- a/src/coding.c +++ b/src/coding.c | |||
| @@ -6324,14 +6324,17 @@ 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 | XSETCDR (tail, Fcons (XCAR (l1), Qnil)); | ||
| 6334 | tail = XCDR (tail); | ||
| 6335 | } | ||
| 6333 | } | 6336 | } |
| 6334 | return val; | 6337 | return XCDR (val); |
| 6335 | } | 6338 | } |
| 6336 | 6339 | ||
| 6337 | 6340 | ||