aboutsummaryrefslogtreecommitdiffstats
path: root/src/lisp.h
diff options
context:
space:
mode:
authorPaul Eggert2014-09-23 10:03:48 -0700
committerPaul Eggert2014-09-23 10:03:48 -0700
commit97914756e8de76b8e83550eab2e12e5dfcb87754 (patch)
tree81c4f9d262e1cce19a6294658231bf854a4d8029 /src/lisp.h
parentccc7be94d73afce4295b6ee7eaa388d1cd930926 (diff)
downloademacs-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.h9
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;
4463extern char *xlispstrdup (Lisp_Object) ATTRIBUTE_MALLOC; 4463extern char *xlispstrdup (Lisp_Object) ATTRIBUTE_MALLOC;
4464extern void dupstring (char **, char const *); 4464extern 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
4468INLINE char * 4469INLINE char *
4469lispstrcpy (const char *dest, Lisp_Object string) 4470lispstpcpy (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
4474extern void xputenv (const char *); 4477extern void xputenv (const char *);