diff src/lisp.h @ 5393:e99b473303e3

Use GC_EXTERNAL_LIST_LOOP_* where appropriate, fns.c src/ChangeLog addition: 2011-04-04 Aidan Kehoe <kehoea@parhasard.net> * lisp.h (GC_EXTERNAL_LIST_LOOP_3, GC_EXTERNAL_LIST_LOOP_4): New. * fns.c (count_with_tail, list_position_cons_before, FassocX): * fns.c (FrassocX, position, FdeleteX, FremoveX): * fns.c (list_delete_duplicates_from_end): * fns.c (Fdelete_duplicates, Fremove_duplicates, Freduce): * fns.c (Fnsubstitute, Fsubstitute, sublis, nsublis, Fnsublis): * fns.c (venn, nvenn, Funion, Fset_exclusive_or, Fnset_exclusive_or): Use GC_EXTERNAL_LIST_LOOP_* in the sequence functions in fns.c where appropriate, there were some corner cases where my old approach was unsafe (mainly if the circularity checking's tortoise lost GCPRO protection. Add GC_EXTERNAL_LIST_LOOP_{3,4}, analogous to GC_EXTERNAL_LIST_LOOP_2.
author Aidan Kehoe <kehoea@parhasard.net>
date Mon, 04 Apr 2011 00:20:09 +0100
parents 4f39e57a82b4
children 248176c74e6b
line wrap: on
line diff
--- a/src/lisp.h	Sat Apr 02 16:18:07 2011 +0100
+++ b/src/lisp.h	Mon Apr 04 00:20:09 2011 +0100
@@ -2123,6 +2123,16 @@
 PRIVATE_EXTERNAL_LIST_LOOP_6 (elt, list, len_##elt, tail,		\
 		      tortoise_##elt, CIRCULAR_LIST_SUSPICION_LENGTH)
 
+#define GC_EXTERNAL_LIST_LOOP_3(elt, list, tail)			\
+do {									\
+  XGCDECL3 (elt);							\
+  Lisp_Object elt, tail, tortoise_##elt;				\
+  EMACS_INT len_##elt;							\
+  XGCPRO3 (elt, elt, tail, tortoise_##elt);				\
+  PRIVATE_EXTERNAL_LIST_LOOP_6 (elt, list, len_##elt, tail,		\
+				tortoise_##elt,				\
+				CIRCULAR_LIST_SUSPICION_LENGTH)
+
 #define EXTERNAL_LIST_LOOP_4_NO_DECLARE(elt, list, tail, len)		\
 Lisp_Object tortoise_##elt;						\
 PRIVATE_EXTERNAL_LIST_LOOP_6 (elt, list, len, tail,			\
@@ -2134,6 +2144,15 @@
 PRIVATE_EXTERNAL_LIST_LOOP_6 (elt, list, len, tail,			\
 		      tortoise_##elt, CIRCULAR_LIST_SUSPICION_LENGTH)
 
+#define GC_EXTERNAL_LIST_LOOP_4(elt, list, tail, len)			\
+do {									\
+  XGCDECL3 (elt);							\
+  Lisp_Object elt, tail, tortoise_##elt;				\
+  XGCPRO3 (elt, elt, tail, tortoise_##elt);				\
+  PRIVATE_EXTERNAL_LIST_LOOP_6 (elt, list, len, tail,			\
+				tortoise_##elt,				\
+				CIRCULAR_LIST_SUSPICION_LENGTH)
+
 #define PRIVATE_UNVERIFIED_LIST_LOOP_7(elt, list, len, hare,		\
 				       tortoise, suspicion_length,	\
                                        signalp)				\