aboutsummaryrefslogtreecommitdiffstats
path: root/src/lisp.h
diff options
context:
space:
mode:
authorPaul Eggert2018-12-08 16:56:32 -0800
committerPaul Eggert2018-12-08 16:58:40 -0800
commit7bcea8f8c11d10fd189c4250042dfe68e2df8c3a (patch)
tree3676ecf2fccc0b7c4dede99487274931c1214784 /src/lisp.h
parenta9732737f2b48a78de72d67f6ed950495788ed1d (diff)
downloademacs-7bcea8f8c11d10fd189c4250042dfe68e2df8c3a.tar.gz
emacs-7bcea8f8c11d10fd189c4250042dfe68e2df8c3a.zip
Streamline and fix vector-size checks
* src/alloc.c (VECTOR_ELTS_MAX): New constant. (allocate_vectorlike): LEN now must be positive. Assume LEN is in range. All callers changed. (allocate_vector): Arg is now ptrdiff_t, not EMACS_INT. All callers changed. Return zero vector here, not in allocate_vectorlike. * src/lisp.h (make_uninit_vector): Simplify. * src/xwidget.c (webkit_js_to_lisp): Check for overflow in ptrdiff_t calculations.
Diffstat (limited to 'src/lisp.h')
-rw-r--r--src/lisp.h9
1 files changed, 2 insertions, 7 deletions
diff --git a/src/lisp.h b/src/lisp.h
index 7e7dba631f3..77b8b63e196 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -3695,7 +3695,7 @@ build_string (const char *str)
3695 3695
3696extern Lisp_Object pure_cons (Lisp_Object, Lisp_Object); 3696extern Lisp_Object pure_cons (Lisp_Object, Lisp_Object);
3697extern void make_byte_code (struct Lisp_Vector *); 3697extern void make_byte_code (struct Lisp_Vector *);
3698extern struct Lisp_Vector *allocate_vector (EMACS_INT); 3698extern struct Lisp_Vector *allocate_vector (ptrdiff_t);
3699 3699
3700/* Make an uninitialized vector for SIZE objects. NOTE: you must 3700/* Make an uninitialized vector for SIZE objects. NOTE: you must
3701 be sure that GC cannot happen until the vector is completely 3701 be sure that GC cannot happen until the vector is completely
@@ -3709,12 +3709,7 @@ extern struct Lisp_Vector *allocate_vector (EMACS_INT);
3709INLINE Lisp_Object 3709INLINE Lisp_Object
3710make_uninit_vector (ptrdiff_t size) 3710make_uninit_vector (ptrdiff_t size)
3711{ 3711{
3712 Lisp_Object v; 3712 return make_lisp_ptr (allocate_vector (size), Lisp_Vectorlike);
3713 struct Lisp_Vector *p;
3714
3715 p = allocate_vector (size);
3716 XSETVECTOR (v, p);
3717 return v;
3718} 3713}
3719 3714
3720/* Like above, but special for sub char-tables. */ 3715/* Like above, but special for sub char-tables. */