aboutsummaryrefslogtreecommitdiffstats
path: root/src/lisp.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/lisp.h')
-rw-r--r--src/lisp.h20
1 files changed, 11 insertions, 9 deletions
diff --git a/src/lisp.h b/src/lisp.h
index 53bfd7c4daf..15c459c9fdb 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -4451,12 +4451,6 @@ egetenv (const char *var)
4451 return egetenv_internal (var, strlen (var)); 4451 return egetenv_internal (var, strlen (var));
4452} 4452}
4453 4453
4454/* Copy Lisp string to temporary (allocated on stack) C string. */
4455
4456#define xlispstrdupa(string) \
4457 memcpy (alloca (SBYTES (string) + 1), \
4458 SSDATA (string), SBYTES (string) + 1)
4459
4460/* Set up the name of the machine we're running on. */ 4454/* Set up the name of the machine we're running on. */
4461extern void init_system_name (void); 4455extern void init_system_name (void);
4462 4456
@@ -4484,7 +4478,7 @@ extern void *record_xmalloc (size_t) ATTRIBUTE_ALLOC_SIZE ((1));
4484 4478
4485/* SAFE_ALLOCA allocates a simple buffer. */ 4479/* SAFE_ALLOCA allocates a simple buffer. */
4486 4480
4487#define SAFE_ALLOCA(size) ((size) < MAX_ALLOCA \ 4481#define SAFE_ALLOCA(size) ((size) <= MAX_ALLOCA \
4488 ? alloca (size) \ 4482 ? alloca (size) \
4489 : (sa_must_free = true, record_xmalloc (size))) 4483 : (sa_must_free = true, record_xmalloc (size)))
4490 4484
@@ -4504,6 +4498,14 @@ extern void *record_xmalloc (size_t) ATTRIBUTE_ALLOC_SIZE ((1));
4504 } \ 4498 } \
4505 } while (false) 4499 } while (false)
4506 4500
4501/* SAFE_ALLOCA_STRING allocates a C copy of a Lisp string. */
4502
4503#define SAFE_ALLOCA_STRING(ptr, string) \
4504 do { \
4505 (ptr) = SAFE_ALLOCA (SBYTES (string) + 1); \
4506 memcpy (ptr, SDATA (string), SBYTES (string) + 1); \
4507 } while (false)
4508
4507/* SAFE_FREE frees xmalloced memory and enables GC as needed. */ 4509/* SAFE_FREE frees xmalloced memory and enables GC as needed. */
4508 4510
4509#define SAFE_FREE() \ 4511#define SAFE_FREE() \
@@ -4519,9 +4521,9 @@ extern void *record_xmalloc (size_t) ATTRIBUTE_ALLOC_SIZE ((1));
4519 4521
4520#define SAFE_ALLOCA_LISP(buf, nelt) \ 4522#define SAFE_ALLOCA_LISP(buf, nelt) \
4521 do { \ 4523 do { \
4522 if ((nelt) < MAX_ALLOCA / word_size) \ 4524 if ((nelt) <= MAX_ALLOCA / word_size) \
4523 (buf) = alloca ((nelt) * word_size); \ 4525 (buf) = alloca ((nelt) * word_size); \
4524 else if ((nelt) < min (PTRDIFF_MAX, SIZE_MAX) / word_size) \ 4526 else if ((nelt) <= min (PTRDIFF_MAX, SIZE_MAX) / word_size) \
4525 { \ 4527 { \
4526 Lisp_Object arg_; \ 4528 Lisp_Object arg_; \
4527 (buf) = xmalloc ((nelt) * word_size); \ 4529 (buf) = xmalloc ((nelt) * word_size); \