Commit 4222c55d authored by Paul Eggert's avatar Paul Eggert
Browse files

* 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.
parent 9229fe87
2011-09-30 Paul Eggert <eggert@cs.ucla.edu>
* 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.
Remove dependency on glibc malloc internals.
* alloc.c (XMALLOC_OVERRUN_CHECK_OVERHEAD, XMALLOC_OVERRUN_CHECK_SIZE):
Move back here from lisp.h, but with their new implementations.
......
......@@ -724,7 +724,7 @@ reset_buffer (register struct buffer *b)
b->prevent_redisplay_optimizations_p = 1;
BVAR (b, backed_up) = Qnil;
BUF_AUTOSAVE_MODIFF (b) = 0;
b->auto_save_failure_time = -1;
b->auto_save_failure_time = 0;
BVAR (b, auto_save_file_name) = Qnil;
BVAR (b, read_only) = Qnil;
b->overlays_before = NULL;
......
......@@ -566,8 +566,8 @@ struct buffer
Redisplay of this buffer is inhibited until it changes again. */
int display_error_modiff;
/* The time at which we detected a failure to auto-save,
Or -1 if we didn't have a failure. */
int auto_save_failure_time;
Or 0 if we didn't have a failure. */
time_t auto_save_failure_time;
/* Position in buffer at which display started
the last time this buffer was displayed. */
EMACS_INT last_window_start;
......
......@@ -5344,7 +5344,7 @@ A non-nil CURRENT-ONLY argument means save only current buffer. */)
EMACS_GET_TIME (before_time);
/* If we had a failure, don't try again for 20 minutes. */
if (b->auto_save_failure_time >= 0
if (b->auto_save_failure_time > 0
&& EMACS_SECS (before_time) - b->auto_save_failure_time < 1200)
continue;
......@@ -5423,7 +5423,7 @@ No auto-save file will be written until the buffer changes again. */)
they're not autosaved. */
BUF_AUTOSAVE_MODIFF (current_buffer) = MODIFF;
XSETFASTINT (BVAR (current_buffer, save_length), Z - BEG);
current_buffer->auto_save_failure_time = -1;
current_buffer->auto_save_failure_time = 0;
return Qnil;
}
......@@ -5432,7 +5432,7 @@ DEFUN ("clear-buffer-auto-save-failure", Fclear_buffer_auto_save_failure,
doc: /* Clear any record of a recent auto-save failure in the current buffer. */)
(void)
{
current_buffer->auto_save_failure_time = -1;
current_buffer->auto_save_failure_time = 0;
return Qnil;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment