emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/src/lread.c


From: Eli Zaretskii
Subject: [Emacs-diffs] Changes to emacs/src/lread.c
Date: Fri, 29 Mar 2002 07:37:23 -0500

Index: emacs/src/lread.c
diff -c emacs/src/lread.c:1.281 emacs/src/lread.c:1.282
*** emacs/src/lread.c:1.281     Mon Mar 11 13:41:10 2002
--- emacs/src/lread.c   Fri Mar 29 07:37:22 2002
***************
*** 34,39 ****
--- 34,40 ----
  #include "commands.h"
  #include "keyboard.h"
  #include "termhooks.h"
+ #include "coding.h"
  
  #ifdef lint
  #include <sys/inode.h>
***************
*** 633,639 ****
    int count = specpdl_ptr - specpdl;
    Lisp_Object temp;
    struct gcpro gcpro1;
!   Lisp_Object found;
    /* 1 means we printed the ".el is newer" message.  */
    int newer = 0;
    /* 1 means we are loading a compiled file.  */
--- 634,640 ----
    int count = specpdl_ptr - specpdl;
    Lisp_Object temp;
    struct gcpro gcpro1;
!   Lisp_Object found, efound;
    /* 1 means we printed the ".el is newer" message.  */
    int newer = 0;
    /* 1 means we are loading a compiled file.  */
***************
*** 770,783 ****
  
          compiled = 1;
  
  #ifdef DOS_NT
          fmode = "rb";
  #endif /* DOS_NT */
!         stat ((char *)XSTRING (found)->data, &s1);
!         XSTRING (found)->data[STRING_BYTES (XSTRING (found)) - 1] = 0;
!         result = stat ((char *)XSTRING (found)->data, &s2);
!         XSTRING (found)->data[STRING_BYTES (XSTRING (found)) - 1] = 'c';
!         
          if (result >= 0 && (unsigned) s1.st_mtime < (unsigned) s2.st_mtime)
            {
              /* Make the progress messages mention that source is newer.  */
--- 771,788 ----
  
          compiled = 1;
  
+         GCPRO1 (efound);
+         efound = ENCODE_FILE (found);
+ 
  #ifdef DOS_NT
          fmode = "rb";
  #endif /* DOS_NT */
!         stat ((char *)XSTRING (efound)->data, &s1);
!         XSTRING (efound)->data[STRING_BYTES (XSTRING (efound)) - 1] = 0;
!         result = stat ((char *)XSTRING (efound)->data, &s2);
!         XSTRING (efound)->data[STRING_BYTES (XSTRING (efound)) - 1] = 'c';
!         UNGCPRO;
! 
          if (result >= 0 && (unsigned) s1.st_mtime < (unsigned) s2.st_mtime)
            {
              /* Make the progress messages mention that source is newer.  */
***************
*** 812,818 ****
  
  #ifdef WINDOWSNT
    emacs_close (fd);
!   stream = fopen ((char *) XSTRING (found)->data, fmode);
  #else  /* not WINDOWSNT */
    stream = fdopen (fd, fmode);
  #endif /* not WINDOWSNT */
--- 817,826 ----
  
  #ifdef WINDOWSNT
    emacs_close (fd);
!   GCPRO1 (efound);
!   efound = ENCODE_FILE (found);
!   stream = fopen ((char *) XSTRING (efound)->data, fmode);
!   UNGCPRO;
  #else  /* not WINDOWSNT */
    stream = fdopen (fd, fmode);
  #endif /* not WINDOWSNT */
***************
*** 968,975 ****
    int want_size;
    Lisp_Object filename;
    struct stat st;
!   struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5;
!   Lisp_Object string, tail;
    int max_suffix_len = 0;
  
    for (tail = suffixes; CONSP (tail); tail = XCDR (tail))
--- 976,983 ----
    int want_size;
    Lisp_Object filename;
    struct stat st;
!   struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5, gcpro6;
!   Lisp_Object string, tail, encoded_fn;
    int max_suffix_len = 0;
  
    for (tail = suffixes; CONSP (tail); tail = XCDR (tail))
***************
*** 980,987 ****
      }
  
    string = filename = Qnil;
!   GCPRO5 (str, string, filename, path, suffixes);
!   
    if (storeptr)
      *storeptr = Qnil;
  
--- 988,995 ----
      }
  
    string = filename = Qnil;
!   GCPRO6 (str, string, filename, path, suffixes, encoded_fn);
! 
    if (storeptr)
      *storeptr = Qnil;
  
***************
*** 1014,1019 ****
--- 1022,1028 ----
        {
          int lsuffix = STRING_BYTES (XSTRING (XCAR (tail)));
          Lisp_Object handler;
+         int exists;
  
          /* Concatenate path element/specified name with the suffix.
             If the directory starts with /:, remove that.  */
***************
*** 1034,1040 ****
  
          if (lsuffix != 0)  /* Bug happens on CCI if lsuffix is 0.  */
            strncat (fn, XSTRING (XCAR (tail))->data, lsuffix);
!         
          /* Check that the file exists and is not a directory.  */
          /* We used to only check for handlers on non-absolute file names:
                if (absolute)
--- 1043,1049 ----
  
          if (lsuffix != 0)  /* Bug happens on CCI if lsuffix is 0.  */
            strncat (fn, XSTRING (XCAR (tail))->data, lsuffix);
! 
          /* Check that the file exists and is not a directory.  */
          /* We used to only check for handlers on non-absolute file names:
                if (absolute)
***************
*** 1044,1084 ****
             It's not clear why that was the case and it breaks things like
             (load "/bar.el") where the file is actually "/bar.el.gz".  */
          handler = Ffind_file_name_handler (filename, Qfile_exists_p);
          if (!NILP (handler) && !exec_only)
            {
-             int exists;
- 
-             string = build_string (fn);
              exists = !NILP (Ffile_readable_p (string));
!             if (exists && !NILP (Ffile_directory_p (build_string (fn))))
                exists = 0;
  
              if (exists)
                {
                  /* We succeeded; return this descriptor and filename.  */
                  if (storeptr)
!                   *storeptr = build_string (fn);
                  UNGCPRO;
                  return -2;
                }
            }
          else
            {
!             int exists = (stat (fn, &st) >= 0
!                           && (st.st_mode & S_IFMT) != S_IFDIR);
              if (exists)
                {
                  /* Check that we can access or open it.  */
                  if (exec_only)
!                   fd = (access (fn, X_OK) == 0) ? 1 : -1;
                  else
!                   fd = emacs_open (fn, O_RDONLY, 0);
  
                  if (fd >= 0)
                    {
                      /* We succeeded; return this descriptor and filename.  */
                      if (storeptr)
!                       *storeptr = build_string (fn);
                      UNGCPRO;
                      return fd;
                    }
--- 1053,1095 ----
             It's not clear why that was the case and it breaks things like
             (load "/bar.el") where the file is actually "/bar.el.gz".  */
          handler = Ffind_file_name_handler (filename, Qfile_exists_p);
+         string = build_string (fn);
          if (!NILP (handler) && !exec_only)
            {
              exists = !NILP (Ffile_readable_p (string));
!             if (exists && !NILP (Ffile_directory_p (string)))
                exists = 0;
  
              if (exists)
                {
                  /* We succeeded; return this descriptor and filename.  */
                  if (storeptr)
!                   *storeptr = string;
                  UNGCPRO;
                  return -2;
                }
            }
          else
            {
!             char *pfn;
! 
!             encoded_fn = ENCODE_FILE (string);
!             pfn = XSTRING (encoded_fn)->data;
!             exists = (stat (pfn, &st) >= 0
!                       && (st.st_mode & S_IFMT) != S_IFDIR);
              if (exists)
                {
                  /* Check that we can access or open it.  */
                  if (exec_only)
!                   fd = (access (pfn, X_OK) == 0) ? 1 : -1;
                  else
!                   fd = emacs_open (pfn, O_RDONLY, 0);
  
                  if (fd >= 0)
                    {
                      /* We succeeded; return this descriptor and filename.  */
                      if (storeptr)
!                       *storeptr = string;
                      UNGCPRO;
                      return fd;
                    }



reply via email to

[Prev in Thread] Current Thread [Next in Thread]