aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Eggert2011-09-30 13:22:01 -0700
committerPaul Eggert2011-09-30 13:22:01 -0700
commit4222c55da73988a2bf397184e46505fc9a52f8b4 (patch)
tree42ccf25d299fbf1ad4030b0d613c7d3bca89edde /src
parent9229fe8763afbfe5e416b8d6826307282bd84b60 (diff)
downloademacs-4222c55da73988a2bf397184e46505fc9a52f8b4.tar.gz
emacs-4222c55da73988a2bf397184e46505fc9a52f8b4.zip
* buffer.h (struct buffer): Use time_t, not int, for a time stamp.
This fixes a Y2038 bug on 64-bit hosts. * buffer.c (reset_buffer): * fileio.c (Fdo_auto_save, Fset_buffer_auto_saved) (Fclear_buffer_auto_save_failure): Use 0, not -1, to represent an unset failure time, since time_t might not be signed.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog8
-rw-r--r--src/buffer.c2
-rw-r--r--src/buffer.h4
-rw-r--r--src/fileio.c6
4 files changed, 14 insertions, 6 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 89e705efd73..238e3faae51 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,13 @@
12011-09-30 Paul Eggert <eggert@cs.ucla.edu> 12011-09-30 Paul Eggert <eggert@cs.ucla.edu>
2 2
3 * buffer.h (struct buffer): Use time_t, not int, for a time stamp.
4 This fixes a Y2038 bug on 64-bit hosts.
5 * buffer.c (reset_buffer):
6 * fileio.c (Fdo_auto_save, Fset_buffer_auto_saved)
7 (Fclear_buffer_auto_save_failure):
8 Use 0, not -1, to represent an unset failure time, since time_t
9 might not be signed.
10
3 Remove dependency on glibc malloc internals. 11 Remove dependency on glibc malloc internals.
4 * alloc.c (XMALLOC_OVERRUN_CHECK_OVERHEAD, XMALLOC_OVERRUN_CHECK_SIZE): 12 * alloc.c (XMALLOC_OVERRUN_CHECK_OVERHEAD, XMALLOC_OVERRUN_CHECK_SIZE):
5 Move back here from lisp.h, but with their new implementations. 13 Move back here from lisp.h, but with their new implementations.
diff --git a/src/buffer.c b/src/buffer.c
index dffdeb536fc..f38c9a739a6 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -724,7 +724,7 @@ reset_buffer (register struct buffer *b)
724 b->prevent_redisplay_optimizations_p = 1; 724 b->prevent_redisplay_optimizations_p = 1;
725 BVAR (b, backed_up) = Qnil; 725 BVAR (b, backed_up) = Qnil;
726 BUF_AUTOSAVE_MODIFF (b) = 0; 726 BUF_AUTOSAVE_MODIFF (b) = 0;
727 b->auto_save_failure_time = -1; 727 b->auto_save_failure_time = 0;
728 BVAR (b, auto_save_file_name) = Qnil; 728 BVAR (b, auto_save_file_name) = Qnil;
729 BVAR (b, read_only) = Qnil; 729 BVAR (b, read_only) = Qnil;
730 b->overlays_before = NULL; 730 b->overlays_before = NULL;
diff --git a/src/buffer.h b/src/buffer.h
index 73628fe6dfc..a6b82abf053 100644
--- a/src/buffer.h
+++ b/src/buffer.h
@@ -566,8 +566,8 @@ struct buffer
566 Redisplay of this buffer is inhibited until it changes again. */ 566 Redisplay of this buffer is inhibited until it changes again. */
567 int display_error_modiff; 567 int display_error_modiff;
568 /* The time at which we detected a failure to auto-save, 568 /* The time at which we detected a failure to auto-save,
569 Or -1 if we didn't have a failure. */ 569 Or 0 if we didn't have a failure. */
570 int auto_save_failure_time; 570 time_t auto_save_failure_time;
571 /* Position in buffer at which display started 571 /* Position in buffer at which display started
572 the last time this buffer was displayed. */ 572 the last time this buffer was displayed. */
573 EMACS_INT last_window_start; 573 EMACS_INT last_window_start;
diff --git a/src/fileio.c b/src/fileio.c
index e335dcf027f..44a85ab1977 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -5344,7 +5344,7 @@ A non-nil CURRENT-ONLY argument means save only current buffer. */)
5344 EMACS_GET_TIME (before_time); 5344 EMACS_GET_TIME (before_time);
5345 5345
5346 /* If we had a failure, don't try again for 20 minutes. */ 5346 /* If we had a failure, don't try again for 20 minutes. */
5347 if (b->auto_save_failure_time >= 0 5347 if (b->auto_save_failure_time > 0
5348 && EMACS_SECS (before_time) - b->auto_save_failure_time < 1200) 5348 && EMACS_SECS (before_time) - b->auto_save_failure_time < 1200)
5349 continue; 5349 continue;
5350 5350
@@ -5423,7 +5423,7 @@ No auto-save file will be written until the buffer changes again. */)
5423 they're not autosaved. */ 5423 they're not autosaved. */
5424 BUF_AUTOSAVE_MODIFF (current_buffer) = MODIFF; 5424 BUF_AUTOSAVE_MODIFF (current_buffer) = MODIFF;
5425 XSETFASTINT (BVAR (current_buffer, save_length), Z - BEG); 5425 XSETFASTINT (BVAR (current_buffer, save_length), Z - BEG);
5426 current_buffer->auto_save_failure_time = -1; 5426 current_buffer->auto_save_failure_time = 0;
5427 return Qnil; 5427 return Qnil;
5428} 5428}
5429 5429
@@ -5432,7 +5432,7 @@ DEFUN ("clear-buffer-auto-save-failure", Fclear_buffer_auto_save_failure,
5432 doc: /* Clear any record of a recent auto-save failure in the current buffer. */) 5432 doc: /* Clear any record of a recent auto-save failure in the current buffer. */)
5433 (void) 5433 (void)
5434{ 5434{
5435 current_buffer->auto_save_failure_time = -1; 5435 current_buffer->auto_save_failure_time = 0;
5436 return Qnil; 5436 return Qnil;
5437} 5437}
5438 5438