diff options
Diffstat (limited to 'src/alloc.c')
-rw-r--r-- | src/alloc.c | 65 |
1 files changed, 18 insertions, 47 deletions
diff --git a/src/alloc.c b/src/alloc.c index 2dd5fae7d8e..93bdd9a2810 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -69,7 +69,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ static bool valgrind_p; #endif -#ifdef USE_LOCAL_ALLOCATORS +#if USE_STACK_LISP_OBJECTS # if GC_MARK_STACK != GC_MAKE_GCPROS_NOOPS # error "Stack-allocated Lisp objects are not compatible with GCPROs" # endif @@ -2232,33 +2232,6 @@ make_string (const char *contents, ptrdiff_t nbytes) return val; } -#ifdef USE_LOCAL_ALLOCATORS - -/* Initialize the string S from DATA and SIZE. S must be followed by - SIZE + 1 bytes of memory that can be used. Return S tagged as a - Lisp object. */ - -Lisp_Object -local_string_init (struct Lisp_String *s, char const *data, ptrdiff_t size) -{ - unsigned char *data_copy = (unsigned char *) (s + 1); - parse_str_as_multibyte ((unsigned char const *) data, - size, &s->size, &s->size_byte); - if (size == s->size || size != s->size_byte) - { - s->size = size; - s->size_byte = -1; - } - s->intervals = NULL; - s->data = data_copy; - memcpy (data_copy, data, size); - data_copy[size] = '\0'; - return make_lisp_ptr (s, Lisp_String); -} - -#endif - - /* Make an unibyte string from LENGTH bytes at CONTENTS. */ Lisp_Object @@ -3320,23 +3293,6 @@ See also the function `vector'. */) return vector; } -#ifdef USE_LOCAL_ALLOCATORS - -/* Initialize V with LENGTH objects each with value INIT, - and return it tagged as a Lisp Object. */ - -Lisp_Object -local_vector_init (struct Lisp_Vector *v, ptrdiff_t length, Lisp_Object init) -{ - v->header.size = length; - for (ptrdiff_t i = 0; i < length; i++) - v->contents[i] = init; - return make_lisp_ptr (v, Lisp_Vectorlike); -} - -#endif - - DEFUN ("vector", Fvector, Svector, 0, MANY, 0, doc: /* Return a newly created vector with specified arguments as elements. Any number of arguments, even zero arguments, are allowed. @@ -7157,7 +7113,22 @@ die (const char *msg, const char *file, int line) #endif /* ENABLE_CHECKING */ -#if defined (ENABLE_CHECKING) && defined (USE_STACK_LISP_OBJECTS) +#if defined (ENABLE_CHECKING) && USE_STACK_LISP_OBJECTS + +/* Debugging check whether STR is ASCII-only. */ + +const char * +verify_ascii (const char *str) +{ + const unsigned char *ptr = (unsigned char *) str, *end = ptr + strlen (str); + while (ptr < end) + { + int c = STRING_CHAR_ADVANCE (ptr); + if (!ASCII_CHAR_P (c)) + emacs_abort (); + } + return str; +} /* Stress alloca with inconveniently sized requests and check whether all allocated areas may be used for Lisp_Object. */ @@ -7175,7 +7146,7 @@ verify_alloca (void) } } -#else /* not (ENABLE_CHECKING && USE_STACK_LISP_OBJECTS) */ +#else /* not ENABLE_CHECKING && USE_STACK_LISP_OBJECTS */ #define verify_alloca() ((void) 0) |