int ok;
ok = openp (Vexec_path, args[0], Vexec_suffixes, &path,
- make_fixnum (X_OK), false);
+ make_fixnum (X_OK), false, false);
if (ok < 0)
report_file_error ("Searching for program", args[0]);
}
ptrdiff_t count = SPECPDL_INDEX ();
record_unwind_protect_nothing ();
specbind (Qfile_name_handler_alist, Qnil);
- fd = openp (Vcharset_map_path, mapfile, suffixes, NULL, Qnil, false);
+ fd = openp (Vcharset_map_path, mapfile, suffixes, NULL, Qnil, false, false);
fp = fd < 0 ? 0 : fdopen (fd, "r");
if (!fp)
{
if (NILP (Vinvocation_directory))
{
Lisp_Object found;
- int yes = openp (Vexec_path, Vinvocation_name,
- Vexec_suffixes, &found, make_fixnum (X_OK), false);
+ int yes =
+ openp (Vexec_path, Vinvocation_name, Vexec_suffixes, &found,
+ make_fixnum (X_OK), false, false);
if (yes == 1)
{
/* Add /: to the front of the name
/* Search bitmap-file-path for the file, if appropriate. */
if (openp (Vx_bitmap_file_path, file, Qnil, &found,
- make_fixnum (R_OK), false)
+ make_fixnum (R_OK), false, false)
< 0)
return -1;
/* Try to find FILE in data-directory/images, then x-bitmap-file-path. */
fd = openp (search_path, file, Qnil, &file_found,
- pfd ? Qt : make_fixnum (R_OK), false);
+ pfd ? Qt : make_fixnum (R_OK), false, false);
if (fd >= 0 || fd == -2)
{
file_found = ENCODE_FILE (file_found);
extern Lisp_Object save_match_data_load (Lisp_Object, Lisp_Object, Lisp_Object,
Lisp_Object, Lisp_Object);
extern int openp (Lisp_Object, Lisp_Object, Lisp_Object,
- Lisp_Object *, Lisp_Object, bool);
+ Lisp_Object *, Lisp_Object, bool, bool);
enum { S2N_IGNORE_TRAILING = 1 };
extern Lisp_Object string_to_number (char const *, int, ptrdiff_t *);
extern void map_obarray (Lisp_Object, void (*) (Lisp_Object, Lisp_Object),
else
file = Fsubstitute_in_file_name (file);
+ bool no_native = suffix_p (file, ".elc");
+
/* Avoid weird lossage with null string as arg,
since it would try to load a directory as a Lisp file. */
if (SCHARS (file) == 0)
suffixes = CALLN (Fappend, suffixes, Vload_file_rep_suffixes);
}
- fd = openp (Vload_path, file, suffixes, &found, Qnil, load_prefer_newer);
+ fd =
+ openp (Vload_path, file, suffixes, &found, Qnil, load_prefer_newer,
+ no_native);
}
if (fd == -1)
(Lisp_Object filename, Lisp_Object path, Lisp_Object suffixes, Lisp_Object predicate)
{
Lisp_Object file;
- int fd = openp (path, filename, suffixes, &file, predicate, false);
+ int fd = openp (path, filename, suffixes, &file, predicate, false, false);
if (NILP (predicate) && fd >= 0)
emacs_close (fd);
return file;
If found replace the content of FILENAME and FD. */
static void
-maybe_swap_for_eln (Lisp_Object *filename, int *fd)
+maybe_swap_for_eln (bool no_native, Lisp_Object *filename, int *fd)
{
#ifdef HAVE_NATIVE_COMP
struct stat eln_st;
- if (load_no_native
+ if (no_native
+ || load_no_native
|| !suffix_p (*filename, ".elc"))
return;
If NEWER is true, try all SUFFIXes and return the result for the
newest file that exists. Does not apply to remote files,
- or if a non-nil and non-t PREDICATE is specified. */
+ or if a non-nil and non-t PREDICATE is specified.
+
+ if NO_NATIVE is true do not try to load native code. */
int
openp (Lisp_Object path, Lisp_Object str, Lisp_Object suffixes,
- Lisp_Object *storeptr, Lisp_Object predicate, bool newer)
+ Lisp_Object *storeptr, Lisp_Object predicate, bool newer,
+ bool no_native)
{
ptrdiff_t fn_size = 100;
char buf[100];
}
else
{
- maybe_swap_for_eln (&string, &fd);
+ maybe_swap_for_eln (no_native, &string, &fd);
/* We succeeded; return this descriptor and filename. */
if (storeptr)
*storeptr = string;
/* No more suffixes. Return the newest. */
if (0 <= save_fd && ! CONSP (XCDR (tail)))
{
- maybe_swap_for_eln (&save_string, &save_fd);
+ maybe_swap_for_eln (no_native, &save_string, &save_fd);
if (storeptr)
*storeptr = save_string;
SAFE_FREE ();
{
tem = Qnil;
openp (Vexec_path, program, Vexec_suffixes, &tem,
- make_fixnum (X_OK), false);
+ make_fixnum (X_OK), false, false);
if (NILP (tem))
report_file_error ("Searching for program", program);
tem = Fexpand_file_name (tem, Qnil);
if (STRINGP (attrs[SOUND_FILE]))
{
/* Open the sound file. */
- current_sound->fd = openp (list1 (Vdata_directory),
- attrs[SOUND_FILE], Qnil, &file, Qnil, false);
+ current_sound->fd =
+ openp (list1 (Vdata_directory), attrs[SOUND_FILE], Qnil, &file, Qnil,
+ false, false);
if (current_sound->fd < 0)
sound_perror ("Could not open sound file");
need to ENCODE_FILE here, but we do need to convert the file
names from UTF-8 to ANSI. */
init_file = build_string ("term/w32-win");
- fd = openp (Vload_path, init_file, Fget_load_suffixes (), NULL, Qnil, 0);
+ fd =
+ openp (Vload_path, init_file, Fget_load_suffixes (), NULL, Qnil, 0, 0);
if (fd < 0)
{
Lisp_Object load_path_print = Fprin1_to_string (Vload_path, Qnil);
{
program = build_string (cmdname);
full = Qnil;
- openp (Vexec_path, program, Vexec_suffixes, &full, make_fixnum (X_OK), 0);
+ openp (Vexec_path, program, Vexec_suffixes, &full, make_fixnum (X_OK),
+ 0, 0);
if (NILP (full))
{
errno = EINVAL;