diff options
| author | Paul Eggert | 2014-09-23 10:03:48 -0700 |
|---|---|---|
| committer | Paul Eggert | 2014-09-23 10:03:48 -0700 |
| commit | 97914756e8de76b8e83550eab2e12e5dfcb87754 (patch) | |
| tree | 81c4f9d262e1cce19a6294658231bf854a4d8029 /src/lisp.h | |
| parent | ccc7be94d73afce4295b6ee7eaa388d1cd930926 (diff) | |
| download | emacs-97914756e8de76b8e83550eab2e12e5dfcb87754.tar.gz emacs-97914756e8de76b8e83550eab2e12e5dfcb87754.zip | |
* lisp.h (lispstpcpy): Rename from lispstrcpy, and act like stpcpy.
All callers changed.
* xterm.c (x_term_init): Use new functionality to avoid two needs
to compute a string length.
Diffstat (limited to 'src/lisp.h')
| -rw-r--r-- | src/lisp.h | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/lisp.h b/src/lisp.h index 6ece4810b0b..deb4635d035 100644 --- a/src/lisp.h +++ b/src/lisp.h | |||
| @@ -4463,12 +4463,15 @@ extern char *xstrdup (const char *) ATTRIBUTE_MALLOC; | |||
| 4463 | extern char *xlispstrdup (Lisp_Object) ATTRIBUTE_MALLOC; | 4463 | extern char *xlispstrdup (Lisp_Object) ATTRIBUTE_MALLOC; |
| 4464 | extern void dupstring (char **, char const *); | 4464 | extern void dupstring (char **, char const *); |
| 4465 | 4465 | ||
| 4466 | /* Like strcpy but uses known length of a Lisp string. */ | 4466 | /* Make DEST a copy of STRING's data. Return a pointer to DEST's terminating |
| 4467 | null byte. This is like stpcpy, except the source is a Lisp string. */ | ||
| 4467 | 4468 | ||
| 4468 | INLINE char * | 4469 | INLINE char * |
| 4469 | lispstrcpy (const char *dest, Lisp_Object string) | 4470 | lispstpcpy (char *dest, Lisp_Object string) |
| 4470 | { | 4471 | { |
| 4471 | return memcpy ((void *) dest, SSDATA (string), SBYTES (string) + 1); | 4472 | ptrdiff_t len = SBYTES (string); |
| 4473 | memcpy (dest, SDATA (string), len + 1); | ||
| 4474 | return dest + len; | ||
| 4472 | } | 4475 | } |
| 4473 | 4476 | ||
| 4474 | extern void xputenv (const char *); | 4477 | extern void xputenv (const char *); |