]> code.delx.au - gnu-emacs/blobdiff - src/lread.c
ruby-mode: Fix a "required arguments" confusion
[gnu-emacs] / src / lread.c
index 69ec05964bebc5e71db293ab8336511f5dd1cef3..ae175296ddbdbd61018428c0b4e81901c8556c3f 100644 (file)
@@ -28,6 +28,7 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include <sys/file.h>
 #include <errno.h>
 #include <limits.h>    /* For CHAR_BIT.  */
+#include <math.h>
 #include <stat-time.h>
 #include "lisp.h"
 #include "intervals.h"
@@ -1032,13 +1033,9 @@ Return t if the file exists and loads successfully.  */)
   bool compiled = 0;
   Lisp_Object handler;
   bool safe_p = 1;
-  const char *fmode = "r";
+  const char *fmode = "r" FOPEN_TEXT;
   int version;
 
-#ifdef DOS_NT
-  fmode = "rt";
-#endif /* DOS_NT */
-
   CHECK_STRING (file);
 
   /* If file name is magic, call the handler.  */
@@ -1222,10 +1219,7 @@ Return t if the file exists and loads successfully.  */)
          compiled = 1;
 
          efound = ENCODE_FILE (found);
-
-#ifdef DOS_NT
-         fmode = "rb";
-#endif /* DOS_NT */
+         fmode = "r" FOPEN_BINARY;
 
           /* openp already checked for newness, no point doing it again.
              FIXME would be nice to get a message when openp
@@ -3369,10 +3363,6 @@ string_to_number (char const *string, int base, bool ignore_trailing)
   bool float_syntax = 0;
   double value = 0;
 
-  /* Compute NaN and infinities using a variable, to cope with compilers that
-     think they are smarter than we are.  */
-  double zero = 0;
-
   /* Negate the value ourselves.  This treats 0, NaNs, and infinity properly on
      IEEE floating point hosts, and works around a formerly-common bug where
      atof ("-0.0") drops the sign.  */
@@ -3424,30 +3414,15 @@ string_to_number (char const *string, int base, bool ignore_trailing)
            {
              state |= E_EXP;
              cp += 3;
-             value = 1.0 / zero;
+             value = INFINITY;
            }
          else if (cp[-1] == '+'
                   && cp[0] == 'N' && cp[1] == 'a' && cp[2] == 'N')
            {
              state |= E_EXP;
              cp += 3;
-             value = zero / zero;
-
-             /* If that made a "negative" NaN, negate it.  */
-             {
-               int i;
-               union { double d; char c[sizeof (double)]; }
-                 u_data, u_minus_zero;
-               u_data.d = value;
-               u_minus_zero.d = -0.0;
-               for (i = 0; i < sizeof (double); i++)
-                 if (u_data.c[i] & u_minus_zero.c[i])
-                   {
-                     value = -value;
-                     break;
-                   }
-             }
-             /* Now VALUE is a positive NaN.  */
+             /* NAN is a "positive" NaN on all known Emacs hosts.  */
+             value = NAN;
            }
          else
            cp = ecp;