Replace `abs' with `eabs'.
[bpt/emacs.git] / src / editfns.c
index 2ab852d..98ab2f9 100644 (file)
@@ -7,7 +7,7 @@ This file is part of GNU Emacs.
 
 GNU Emacs is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
+the Free Software Foundation; either version 3, or (at your option)
 any later version.
 
 GNU Emacs is distributed in the hope that it will be useful,
@@ -84,6 +84,11 @@ extern char **environ;
 
 extern size_t emacs_strftimeu P_ ((char *, size_t, const char *,
                                   const struct tm *, int));
+
+#ifdef WINDOWSNT
+extern Lisp_Object w32_get_internal_run_time ();
+#endif
+
 static int tm_diff P_ ((struct tm *, struct tm *));
 static void find_field P_ ((Lisp_Object, Lisp_Object, Lisp_Object, int *, Lisp_Object, int *));
 static void update_buffer_properties P_ ((int, int));
@@ -1483,9 +1488,13 @@ on systems that do not provide resolution finer than a second.  */)
   return list3 (make_number ((secs >> 16) & 0xffff),
                make_number ((secs >> 0)  & 0xffff),
                make_number (usecs));
-#else
+#else /* ! HAVE_GETRUSAGE  */
+#if WINDOWSNT
+  return w32_get_internal_run_time ();
+#else /* ! WINDOWSNT  */
   return Fcurrent_time ();
-#endif
+#endif /* WINDOWSNT  */
+#endif /* HAVE_GETRUSAGE  */
 }
 \f
 
@@ -1839,7 +1848,7 @@ usage: (encode-time SECOND MINUTE HOUR DAY MONTH YEAR &optional ZONE)  */)
        tzstring = (char *) SDATA (zone);
       else if (INTEGERP (zone))
        {
-         int abszone = abs (XINT (zone));
+         int abszone = eabs (XINT (zone));
          sprintf (tzbuf, "XXX%s%d:%02d:%02d", "-" + (XINT (zone) < 0),
                   abszone / (60*60), (abszone/60) % 60, abszone % 60);
          tzstring = tzbuf;
@@ -1974,6 +1983,7 @@ the data it can't find.  */)
       int offset = tm_diff (t, &gmt);
       char *s = 0;
       char buf[6];
+
 #ifdef HAVE_TM_ZONE
       if (t->tm_zone)
        s = (char *)t->tm_zone;
@@ -1984,19 +1994,6 @@ the data it can't find.  */)
 #endif
 #endif /* not HAVE_TM_ZONE */
 
-#if defined HAVE_TM_ZONE || defined HAVE_TZNAME
-      if (s)
-       {
-         /* On Japanese w32, we can get a Japanese string as time
-            zone name.  Don't accept that.  */
-         char *p;
-         for (p = s; *p && (isalnum ((unsigned char)*p) || *p == ' '); ++p)
-           ;
-         if (p == s || *p)
-           s = NULL;
-       }
-#endif
-
       if (!s)
        {
          /* No local time zone name is available; use "+-NNNN" instead.  */
@@ -2004,6 +2001,7 @@ the data it can't find.  */)
          sprintf (buf, "%c%02d%02d", (offset < 0 ? '-' : '+'), am/60, am%60);
          s = buf;
        }
+
       return Fcons (make_number (offset), Fcons (build_string (s), Qnil));
     }
   else
@@ -3042,7 +3040,7 @@ DEFUN ("delete-and-extract-region", Fdelete_and_extract_region,
 {
   validate_region (&start, &end);
   if (XINT (start) == XINT (end))
-    return build_string ("");
+    return empty_unibyte_string;
   return del_range_1 (XINT (start), XINT (end), 1, 1);
 }
 \f
@@ -3516,7 +3514,7 @@ usage: (format STRING &rest OBJECTS)  */)
           precision    ::= '.' [0-9]*
 
           If a field-width is specified, it specifies to which width
-          the output should be padded with blanks, iff the output
+          the output should be padded with blanks, if the output
           string is shorter than field-width.
 
           If precision is specified, it specifies the number of
@@ -4114,9 +4112,9 @@ Transposing beyond buffer boundaries is an error.  */)
      (startr1, endr1, startr2, endr2, leave_markers)
      Lisp_Object startr1, endr1, startr2, endr2, leave_markers;
 {
-  register int start1, end1, start2, end2;
-  int start1_byte, start2_byte, len1_byte, len2_byte;
-  int gap, len1, len_mid, len2;
+  register EMACS_INT start1, end1, start2, end2;
+  EMACS_INT start1_byte, start2_byte, len1_byte, len2_byte;
+  EMACS_INT gap, len1, len_mid, len2;
   unsigned char *start1_addr, *start2_addr, *temp;
 
   INTERVAL cur_intv, tmp_interval1, tmp_interval_mid, tmp_interval2, tmp_interval3;
@@ -4393,8 +4391,7 @@ Transposing beyond buffer boundaries is an error.  */)
       fix_start_end_in_overlays (start1, end2);
     }
 
-  signal_after_change (XINT (start1), XINT (end2 - start1),
-                      XINT (end2 - start1));
+  signal_after_change (start1, end2 - start1, end2 - start1);
   return Qnil;
 }