From 8eb61e5261cebf6a566b1138562953350080156b Mon Sep 17 00:00:00 2001 From: Dmitry Antipov Date: Thu, 2 Oct 2014 18:01:27 +0400 Subject: [PATCH] * alloc.c (mark_overlay): Assume that overlay boundaries are always markers. Add comment. * lread.c (read_internal_start): Use convenient validate_subarray. Adjust docstring. (Fread_from_string): Adjust docstring. --- src/ChangeLog | 8 ++++++++ src/alloc.c | 5 +++-- src/lread.c | 30 +++++++----------------------- 3 files changed, 18 insertions(+), 25 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index f3c881f630d..2a4ce099021 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,11 @@ +2014-10-02 Dmitry Antipov + + * alloc.c (mark_overlay): Assume that overlay boundaries are + always markers. Add comment. + * lread.c (read_internal_start): Use convenient validate_subarray. + Adjust docstring. + (Fread_from_string): Adjust docstring. + 2014-10-02 Stefan Monnier * lisp.h: Fix up compilation for USE_STACK_LISP_OBJECTS=false. diff --git a/src/alloc.c b/src/alloc.c index f656dc94216..faad0b59c87 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -6015,8 +6015,9 @@ mark_overlay (struct Lisp_Overlay *ptr) for (; ptr && !ptr->gcmarkbit; ptr = ptr->next) { ptr->gcmarkbit = 1; - mark_object (ptr->start); - mark_object (ptr->end); + /* These two are always markers and can be marked fast. */ + XMARKER (ptr->start)->gcmarkbit = 1; + XMARKER (ptr->end)->gcmarkbit = 1; mark_object (ptr->plist); } } diff --git a/src/lread.c b/src/lread.c index 0e71b13c5c8..59af12cf6da 100644 --- a/src/lread.c +++ b/src/lread.c @@ -2096,9 +2096,10 @@ DEFUN ("read-from-string", Fread_from_string, Sread_from_string, 1, 3, 0, doc: /* Read one Lisp expression which is represented as text by STRING. Returns a cons: (OBJECT-READ . FINAL-STRING-INDEX). FINAL-STRING-INDEX is an integer giving the position of the next - remaining character in STRING. -START and END optionally delimit a substring of STRING from which to read; - they default to 0 and (length STRING) respectively. */) +remaining character in STRING. START and END optionally delimit +a substring of STRING from which to read; they default to 0 and +(length STRING) respectively. Negative values are counted from +the end of STRING. */) (Lisp_Object string, Lisp_Object start, Lisp_Object end) { Lisp_Object ret; @@ -2109,10 +2110,9 @@ START and END optionally delimit a substring of STRING from which to read; } /* Function to set up the global context we need in toplevel read - calls. */ + calls. START and END only used when STREAM is a string. */ static Lisp_Object read_internal_start (Lisp_Object stream, Lisp_Object start, Lisp_Object end) -/* `start', `end' only used when stream is a string. */ { Lisp_Object retval; @@ -2134,25 +2134,9 @@ read_internal_start (Lisp_Object stream, Lisp_Object start, Lisp_Object end) else string = XCAR (stream); - if (NILP (end)) - endval = SCHARS (string); - else - { - CHECK_NUMBER (end); - if (! (0 <= XINT (end) && XINT (end) <= SCHARS (string))) - args_out_of_range (string, end); - endval = XINT (end); - } + validate_subarray (string, start, end, SCHARS (string), + &startval, &endval); - if (NILP (start)) - startval = 0; - else - { - CHECK_NUMBER (start); - if (! (0 <= XINT (start) && XINT (start) <= endval)) - args_out_of_range (string, start); - startval = XINT (start); - } read_from_string_index = startval; read_from_string_index_byte = string_char_to_byte (string, startval); read_from_string_limit = endval; -- 2.39.5