comparison src/fns.c @ 406:b8cc9ab3f761 r21-2-33

Import from CVS: tag r21-2-33
author cvs
date Mon, 13 Aug 2007 11:17:09 +0200
parents a86b2b5e0111
children 501cfd01ee6d
comparison
equal deleted inserted replaced
405:0e08f63c74d2 406:b8cc9ab3f761
113 113
114 static size_t 114 static size_t
115 size_bit_vector (const void *lheader) 115 size_bit_vector (const void *lheader)
116 { 116 {
117 Lisp_Bit_Vector *v = (Lisp_Bit_Vector *) lheader; 117 Lisp_Bit_Vector *v = (Lisp_Bit_Vector *) lheader;
118 return offsetof (Lisp_Bit_Vector, 118 return FLEXIBLE_ARRAY_STRUCT_SIZEOF (Lisp_Bit_Vector, bits,
119 bits[BIT_VECTOR_LONG_STORAGE (bit_vector_length (v))]); 119 BIT_VECTOR_LONG_STORAGE (bit_vector_length (v)));
120 } 120 }
121 121
122 static const struct lrecord_description bit_vector_description[] = { 122 static const struct lrecord_description bit_vector_description[] = {
123 { XD_LISP_OBJECT, offsetof (Lisp_Bit_Vector, next) }, 123 { XD_LISP_OBJECT, offsetof (Lisp_Bit_Vector, next) },
124 { XD_END } 124 { XD_END }
3110 (function, sequence)) 3110 (function, sequence))
3111 { 3111 {
3112 mapcar1 (XINT (Flength (sequence)), 0, function, sequence); 3112 mapcar1 (XINT (Flength (sequence)), 0, function, sequence);
3113 3113
3114 return sequence; 3114 return sequence;
3115 }
3116
3117
3118
3119
3120 DEFUN ("replace-list", Freplace_list, 2, 2, 0, /*
3121 Destructively replace the list OLD with NEW.
3122 This is like (copy-sequence NEW) except that it reuses the
3123 conses in OLD as much as possible. If OLD and NEW are the same
3124 length, no consing will take place.
3125 */
3126 (old, new))
3127 {
3128 Lisp_Object tail, oldtail = old, prevoldtail = Qnil;
3129
3130 EXTERNAL_LIST_LOOP (tail, new)
3131 {
3132 if (!NILP (oldtail))
3133 {
3134 CHECK_CONS (oldtail);
3135 XCAR (oldtail) = XCAR (tail);
3136 }
3137 else if (!NILP (prevoldtail))
3138 {
3139 XCDR (prevoldtail) = Fcons (XCAR (tail), Qnil);
3140 prevoldtail = XCDR (prevoldtail);
3141 }
3142 else
3143 old = oldtail = Fcons (XCAR (tail), Qnil);
3144
3145 if (!NILP (oldtail))
3146 {
3147 prevoldtail = oldtail;
3148 oldtail = XCDR (oldtail);
3149 }
3150 }
3151
3152 if (!NILP (prevoldtail))
3153 XCDR (prevoldtail) = Qnil;
3154 else
3155 old = Qnil;
3156
3157 return old;
3115 } 3158 }
3116 3159
3117 3160
3118 /* #### this function doesn't belong in this file! */ 3161 /* #### this function doesn't belong in this file! */
3119 3162
3798 DEFSUBR (Fnconc); 3841 DEFSUBR (Fnconc);
3799 DEFSUBR (Fmapcar); 3842 DEFSUBR (Fmapcar);
3800 DEFSUBR (Fmapvector); 3843 DEFSUBR (Fmapvector);
3801 DEFSUBR (Fmapc_internal); 3844 DEFSUBR (Fmapc_internal);
3802 DEFSUBR (Fmapconcat); 3845 DEFSUBR (Fmapconcat);
3846 DEFSUBR (Freplace_list);
3803 DEFSUBR (Fload_average); 3847 DEFSUBR (Fload_average);
3804 DEFSUBR (Ffeaturep); 3848 DEFSUBR (Ffeaturep);
3805 DEFSUBR (Frequire); 3849 DEFSUBR (Frequire);
3806 DEFSUBR (Fprovide); 3850 DEFSUBR (Fprovide);
3807 DEFSUBR (Fbase64_encode_region); 3851 DEFSUBR (Fbase64_encode_region);