This uses the variables `load-suffixes' and `load-file-rep-suffixes'. */)
(void)
{
- Lisp_Object lst = Qnil, suffixes = Vload_suffixes, suffix, ext;
- while (CONSP (suffixes))
+ Lisp_Object lst = Qnil, suffixes = Vload_suffixes;
+ FOR_EACH_TAIL (suffixes)
{
Lisp_Object exts = Vload_file_rep_suffixes;
- suffix = XCAR (suffixes);
- suffixes = XCDR (suffixes);
- while (CONSP (exts))
- {
- ext = XCAR (exts);
- exts = XCDR (exts);
- lst = Fcons (concat2 (suffix, ext), lst);
- }
+ Lisp_Object suffix = XCAR (suffixes);
+ FOR_EACH_TAIL (exts)
+ lst = Fcons (concat2 (suffix, XCAR (exts)), lst);
}
return Fnreverse (lst);
}
the general case; the second load may do something different. */
{
int load_count = 0;
- Lisp_Object tem;
- for (tem = Vloads_in_progress; CONSP (tem); tem = XCDR (tem))
+ Lisp_Object tem = Vloads_in_progress;
+ FOR_EACH_TAIL_SAFE (tem)
if (!NILP (Fequal (found, XCAR (tem))) && (++load_count > 3))
signal_error ("Recursive load", Fcons (found, Vloads_in_progress));
record_unwind_protect (record_load_unwind, Vloads_in_progress);
CHECK_STRING (str);
- for (tail = suffixes; CONSP (tail); tail = XCDR (tail))
+ tail = suffixes;
+ FOR_EACH_TAIL_SAFE (tail)
{
CHECK_STRING_CAR (tail);
max_suffix_len = max (max_suffix_len,
absolute = complete_filename_p (str);
+ AUTO_LIST1 (just_use_str, Qnil);
+ if (NILP (path))
+ path = just_use_str;
+
/* Go through all entries in the path and see whether we find the
executable. */
- do {
+ FOR_EACH_TAIL_SAFE (path)
+ {
ptrdiff_t baselen, prefixlen;
- if (NILP (path))
+ if (EQ (path, just_use_str))
filename = str;
else
filename = Fexpand_file_name (str, XCAR (path));
memcpy (fn, SDATA (filename) + prefixlen, baselen);
/* Loop over suffixes. */
- for (tail = NILP (suffixes) ? list1 (empty_unibyte_string) : suffixes;
- CONSP (tail); tail = XCDR (tail))
+ AUTO_LIST1 (empty_string_only, empty_unibyte_string);
+ tail = NILP (suffixes) ? empty_string_only : suffixes;
+ FOR_EACH_TAIL_SAFE (tail)
{
Lisp_Object suffix = XCAR (tail);
ptrdiff_t fnlen, lsuffix = SBYTES (suffix);
}
}
}
- if (absolute || NILP (path))
+ if (absolute)
break;
- path = XCDR (path);
- } while (CONSP (path));
+ }
SAFE_FREE ();
errno = last_errno;
tail = Vload_history;
prev = Qnil;
- while (CONSP (tail))
+ FOR_EACH_TAIL (tail)
{
tem = XCAR (tail);
{
tem2 = Vcurrent_load_list;
- while (CONSP (tem2))
+ FOR_EACH_TAIL (tem2)
{
newelt = XCAR (tem2);
if (NILP (Fmember (newelt, tem)))
Fsetcar (tail, Fcons (XCAR (tem),
Fcons (newelt, XCDR (tem))));
-
- tem2 = XCDR (tem2);
maybe_quit ();
}
}
}
else
prev = tail;
- tail = XCDR (tail);
maybe_quit ();
}
if (EQ (CAR_SAFE (val), Qprogn))
{
Lisp_Object subforms = XCDR (val);
-
- for (val = Qnil; CONSP (subforms); subforms = XCDR (subforms))
- val = readevalloop_eager_expand_eval (XCAR (subforms),
- macroexpand);
+ val = Qnil;
+ FOR_EACH_TAIL (subforms)
+ val = readevalloop_eager_expand_eval (XCAR (subforms), macroexpand);
}
else
val = eval_sub (call2 (macroexpand, val, Qt));
/* Now use params to make a new hash table and fill it. */
ht = Fmake_hash_table (param_count, params);
- while (CONSP (data))
- {
+ Lisp_Object last = data;
+ FOR_EACH_TAIL_SAFE (data)
+ {
key = XCAR (data);
data = XCDR (data);
if (!CONSP (data))
- error ("Odd number of elements in hash table data");
+ break;
val = XCAR (data);
- data = XCDR (data);
+ last = XCDR (data);
Fputhash (key, val, ht);
- }
+ }
+ if (!NILP (last))
+ error ("Hash table data is not a list of even length");
return ht;
}