* buffer.c: Include <verify.h>.

(init_buffer_once): Check at compile-time, not run-time.
This commit is contained in:
Paul Eggert 2011-06-17 01:14:30 -07:00
parent 67c36fce59
commit d6202519ae
2 changed files with 6 additions and 2 deletions

View file

@ -1,12 +1,14 @@
2011-06-17 Paul Eggert <eggert@cs.ucla.edu>
* buffer.c (struct sortvec.priority, struct sortstr.priority):
* buffer.c: Include <verify.h>.
(struct sortvec.priority, struct sortstr.priority):
Now EMACS_INT, not int.
(compare_overlays, cmp_for_strings): Avoid subtraction overflow.
(struct sortstr.size, record_overlay_string)
(struct sortstrlist.size, struct sortlist.used):
Don't truncate size to int.
(record_overlay_string): Check for size-calculation overflow.
(init_buffer_once): Check at compile-time, not run-time.
2011-06-16 Paul Eggert <eggert@cs.ucla.edu>

View file

@ -27,6 +27,8 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include <setjmp.h>
#include <unistd.h>
#include <verify.h>
#include "lisp.h"
#include "intervals.h"
#include "window.h"
@ -4975,7 +4977,7 @@ init_buffer_once (void)
The local flag bits are in the local_var_flags slot of the buffer. */
/* Nothing can work if this isn't true */
if (sizeof (EMACS_INT) != sizeof (Lisp_Object)) abort ();
{ verify (sizeof (EMACS_INT) == sizeof (Lisp_Object)); }
/* 0 means not a lisp var, -1 means always local, else mask */
memset (&buffer_local_flags, 0, sizeof buffer_local_flags);