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 | |
| 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')
| -rw-r--r-- | src/ChangeLog | 5 | ||||
| -rw-r--r-- | src/callproc.c | 2 | ||||
| -rw-r--r-- | src/dbusbind.c | 2 | ||||
| -rw-r--r-- | src/doc.c | 2 | ||||
| -rw-r--r-- | src/font.c | 2 | ||||
| -rw-r--r-- | src/frame.c | 4 | ||||
| -rw-r--r-- | src/lisp.h | 9 | ||||
| -rw-r--r-- | src/process.c | 4 | ||||
| -rw-r--r-- | src/w32fns.c | 2 | ||||
| -rw-r--r-- | src/w32proc.c | 2 | ||||
| -rw-r--r-- | src/xfns.c | 2 | ||||
| -rw-r--r-- | src/xfont.c | 2 | ||||
| -rw-r--r-- | src/xsmfns.c | 2 | ||||
| -rw-r--r-- | src/xterm.c | 5 |
14 files changed, 27 insertions, 18 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 7e1768e2cda..7f05f6fe21f 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,5 +1,10 @@ | |||
| 1 | 2014-09-23 Paul Eggert <eggert@cs.ucla.edu> | 1 | 2014-09-23 Paul Eggert <eggert@cs.ucla.edu> |
| 2 | 2 | ||
| 3 | * lisp.h (lispstpcpy): Rename from lispstrcpy, and act like stpcpy. | ||
| 4 | All callers changed. | ||
| 5 | * xterm.c (x_term_init): Use new functionality to avoid two needs | ||
| 6 | to compute a string length. | ||
| 7 | |||
| 3 | * dispextern.h, xdisp.c (window_box_right_offset): Now static. | 8 | * dispextern.h, xdisp.c (window_box_right_offset): Now static. |
| 4 | 9 | ||
| 5 | 2014-09-23 Dmitry Antipov <dmantipov@yandex.ru> | 10 | 2014-09-23 Dmitry Antipov <dmantipov@yandex.ru> |
diff --git a/src/callproc.c b/src/callproc.c index 2fa475e72df..e3dcc7bbcca 100644 --- a/src/callproc.c +++ b/src/callproc.c | |||
| @@ -1235,7 +1235,7 @@ child_setup (int in, int out, int err, char **new_argv, bool set_pgrp, | |||
| 1235 | #endif | 1235 | #endif |
| 1236 | temp = pwd_var + 4; | 1236 | temp = pwd_var + 4; |
| 1237 | memcpy (pwd_var, "PWD=", 4); | 1237 | memcpy (pwd_var, "PWD=", 4); |
| 1238 | lispstrcpy (temp, current_dir); | 1238 | lispstpcpy (temp, current_dir); |
| 1239 | 1239 | ||
| 1240 | #ifndef DOS_NT | 1240 | #ifndef DOS_NT |
| 1241 | /* We can't signal an Elisp error here; we're in a vfork. Since | 1241 | /* We can't signal an Elisp error here; we're in a vfork. Since |
diff --git a/src/dbusbind.c b/src/dbusbind.c index 58302df4927..f81666ba7bd 100644 --- a/src/dbusbind.c +++ b/src/dbusbind.c | |||
| @@ -761,7 +761,7 @@ xd_append_arg (int dtype, Lisp_Object object, DBusMessageIter *iter) | |||
| 761 | && STRINGP (CAR_SAFE (XD_NEXT_VALUE (object))) | 761 | && STRINGP (CAR_SAFE (XD_NEXT_VALUE (object))) |
| 762 | && NILP (CDR_SAFE (XD_NEXT_VALUE (object)))) | 762 | && NILP (CDR_SAFE (XD_NEXT_VALUE (object)))) |
| 763 | { | 763 | { |
| 764 | lispstrcpy (signature, CAR_SAFE (XD_NEXT_VALUE (object))); | 764 | lispstpcpy (signature, CAR_SAFE (XD_NEXT_VALUE (object))); |
| 765 | object = CDR_SAFE (XD_NEXT_VALUE (object)); | 765 | object = CDR_SAFE (XD_NEXT_VALUE (object)); |
| 766 | } | 766 | } |
| 767 | 767 | ||
| @@ -121,7 +121,7 @@ get_doc_string (Lisp_Object filepos, bool unibyte, bool definition) | |||
| 121 | if (minsize < 8) | 121 | if (minsize < 8) |
| 122 | minsize = 8; | 122 | minsize = 8; |
| 123 | name = SAFE_ALLOCA (minsize + SCHARS (file) + 8); | 123 | name = SAFE_ALLOCA (minsize + SCHARS (file) + 8); |
| 124 | lispstrcpy (name, docdir); | 124 | lispstpcpy (name, docdir); |
| 125 | strcat (name, SSDATA (file)); | 125 | strcat (name, SSDATA (file)); |
| 126 | } | 126 | } |
| 127 | else | 127 | else |
diff --git a/src/font.c b/src/font.c index e8a13b7eeda..1324b6e99c2 100644 --- a/src/font.c +++ b/src/font.c | |||
| @@ -4266,7 +4266,7 @@ the consecutive wildcards are folded into one. */) | |||
| 4266 | { | 4266 | { |
| 4267 | if (NILP (fold_wildcards)) | 4267 | if (NILP (fold_wildcards)) |
| 4268 | return font_name; | 4268 | return font_name; |
| 4269 | lispstrcpy (name, font_name); | 4269 | lispstpcpy (name, font_name); |
| 4270 | namelen = SBYTES (font_name); | 4270 | namelen = SBYTES (font_name); |
| 4271 | goto done; | 4271 | goto done; |
| 4272 | } | 4272 | } |
diff --git a/src/frame.c b/src/frame.c index 51bd8fa7cfc..5e2f351d77a 100644 --- a/src/frame.c +++ b/src/frame.c | |||
| @@ -4036,8 +4036,8 @@ xrdb_get_resource (XrmDatabase rdb, Lisp_Object attribute, Lisp_Object class, Li | |||
| 4036 | 4036 | ||
| 4037 | /* Start with emacs.FRAMENAME for the name (the specific one) | 4037 | /* Start with emacs.FRAMENAME for the name (the specific one) |
| 4038 | and with `Emacs' for the class key (the general one). */ | 4038 | and with `Emacs' for the class key (the general one). */ |
| 4039 | lispstrcpy (name_key, Vx_resource_name); | 4039 | lispstpcpy (name_key, Vx_resource_name); |
| 4040 | lispstrcpy (class_key, Vx_resource_class); | 4040 | lispstpcpy (class_key, Vx_resource_class); |
| 4041 | 4041 | ||
| 4042 | strcat (class_key, "."); | 4042 | strcat (class_key, "."); |
| 4043 | strcat (class_key, SSDATA (class)); | 4043 | strcat (class_key, SSDATA (class)); |
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 *); |
diff --git a/src/process.c b/src/process.c index c6140083784..f6484d0370e 100644 --- a/src/process.c +++ b/src/process.c | |||
| @@ -2989,7 +2989,7 @@ usage: (make-network-process &rest ARGS) */) | |||
| 2989 | address_un.sun_family = AF_LOCAL; | 2989 | address_un.sun_family = AF_LOCAL; |
| 2990 | if (sizeof address_un.sun_path <= SBYTES (service)) | 2990 | if (sizeof address_un.sun_path <= SBYTES (service)) |
| 2991 | error ("Service name too long"); | 2991 | error ("Service name too long"); |
| 2992 | lispstrcpy (address_un.sun_path, service); | 2992 | lispstpcpy (address_un.sun_path, service); |
| 2993 | ai.ai_addr = (struct sockaddr *) &address_un; | 2993 | ai.ai_addr = (struct sockaddr *) &address_un; |
| 2994 | ai.ai_addrlen = sizeof address_un; | 2994 | ai.ai_addrlen = sizeof address_un; |
| 2995 | goto open_socket; | 2995 | goto open_socket; |
| @@ -3680,7 +3680,7 @@ network_interface_info (Lisp_Object ifname) | |||
| 3680 | 3680 | ||
| 3681 | if (sizeof rq.ifr_name <= SBYTES (ifname)) | 3681 | if (sizeof rq.ifr_name <= SBYTES (ifname)) |
| 3682 | error ("interface name too long"); | 3682 | error ("interface name too long"); |
| 3683 | lispstrcpy (rq.ifr_name, ifname); | 3683 | lispstpcpy (rq.ifr_name, ifname); |
| 3684 | 3684 | ||
| 3685 | s = socket (AF_INET, SOCK_STREAM | SOCK_CLOEXEC, 0); | 3685 | s = socket (AF_INET, SOCK_STREAM | SOCK_CLOEXEC, 0); |
| 3686 | if (s < 0) | 3686 | if (s < 0) |
diff --git a/src/w32fns.c b/src/w32fns.c index a58a9ced85c..2b77bb737b6 100644 --- a/src/w32fns.c +++ b/src/w32fns.c | |||
| @@ -5339,7 +5339,7 @@ terminate Emacs if we can't open the connection. | |||
| 5339 | { | 5339 | { |
| 5340 | char basename[ MAX_PATH ], *str; | 5340 | char basename[ MAX_PATH ], *str; |
| 5341 | 5341 | ||
| 5342 | lispstrcpy (basename, Vinvocation_name); | 5342 | lispstpcpy (basename, Vinvocation_name); |
| 5343 | str = strrchr (basename, '.'); | 5343 | str = strrchr (basename, '.'); |
| 5344 | if (str) *str = 0; | 5344 | if (str) *str = 0; |
| 5345 | Vinvocation_name = build_string (basename); | 5345 | Vinvocation_name = build_string (basename); |
diff --git a/src/w32proc.c b/src/w32proc.c index 795df31c858..dc91910d9a7 100644 --- a/src/w32proc.c +++ b/src/w32proc.c | |||
| @@ -1647,7 +1647,7 @@ sys_spawnve (int mode, char *cmdname, char **argv, char **envp) | |||
| 1647 | strcpy (cmdname, egetenv ("CMDPROXY")); | 1647 | strcpy (cmdname, egetenv ("CMDPROXY")); |
| 1648 | else | 1648 | else |
| 1649 | { | 1649 | { |
| 1650 | lispstrcpy (cmdname, Vinvocation_directory); | 1650 | lispstpcpy (cmdname, Vinvocation_directory); |
| 1651 | strcat (cmdname, "cmdproxy.exe"); | 1651 | strcat (cmdname, "cmdproxy.exe"); |
| 1652 | } | 1652 | } |
| 1653 | 1653 | ||
diff --git a/src/xfns.c b/src/xfns.c index 7ecd15aea91..c2e39b5c0a6 100644 --- a/src/xfns.c +++ b/src/xfns.c | |||
| @@ -4289,7 +4289,7 @@ select_visual (struct x_display_info *dpyinfo) | |||
| 4289 | int i, class = -1; | 4289 | int i, class = -1; |
| 4290 | XVisualInfo vinfo; | 4290 | XVisualInfo vinfo; |
| 4291 | 4291 | ||
| 4292 | lispstrcpy (s, value); | 4292 | lispstpcpy (s, value); |
| 4293 | dash = strchr (s, '-'); | 4293 | dash = strchr (s, '-'); |
| 4294 | if (dash) | 4294 | if (dash) |
| 4295 | { | 4295 | { |
diff --git a/src/xfont.c b/src/xfont.c index db0449716ab..4dc26bb41bf 100644 --- a/src/xfont.c +++ b/src/xfont.c | |||
| @@ -541,7 +541,7 @@ xfont_list (struct frame *f, Lisp_Object spec) | |||
| 541 | if (STRINGP (XCAR (alter)) | 541 | if (STRINGP (XCAR (alter)) |
| 542 | && ((r - name) + SBYTES (XCAR (alter))) < 256) | 542 | && ((r - name) + SBYTES (XCAR (alter))) < 256) |
| 543 | { | 543 | { |
| 544 | lispstrcpy (r, XCAR (alter)); | 544 | lispstpcpy (r, XCAR (alter)); |
| 545 | list = xfont_list_pattern (display, name, registry, script); | 545 | list = xfont_list_pattern (display, name, registry, script); |
| 546 | if (! NILP (list)) | 546 | if (! NILP (list)) |
| 547 | break; | 547 | break; |
diff --git a/src/xsmfns.c b/src/xsmfns.c index 5efbfaafa8f..ed67a7d8e1f 100644 --- a/src/xsmfns.c +++ b/src/xsmfns.c | |||
| @@ -418,7 +418,7 @@ x_session_initialize (struct x_display_info *dpyinfo) | |||
| 418 | emacs_program[0] = '\0'; | 418 | emacs_program[0] = '\0'; |
| 419 | 419 | ||
| 420 | if (! EQ (Vinvocation_directory, Qnil)) | 420 | if (! EQ (Vinvocation_directory, Qnil)) |
| 421 | lispstrcpy (emacs_program, Vinvocation_directory); | 421 | lispstpcpy (emacs_program, Vinvocation_directory); |
| 422 | strcat (emacs_program, SSDATA (Vinvocation_name)); | 422 | strcat (emacs_program, SSDATA (Vinvocation_name)); |
| 423 | 423 | ||
| 424 | /* The SM protocol says all callbacks are mandatory, so set up all | 424 | /* The SM protocol says all callbacks are mandatory, so set up all |
diff --git a/src/xterm.c b/src/xterm.c index 1b721b042be..e24e86ce412 100644 --- a/src/xterm.c +++ b/src/xterm.c | |||
| @@ -10902,8 +10902,9 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name) | |||
| 10902 | dpyinfo->x_id = ++x_display_id; | 10902 | dpyinfo->x_id = ++x_display_id; |
| 10903 | dpyinfo->x_id_name = xmalloc (SBYTES (Vinvocation_name) | 10903 | dpyinfo->x_id_name = xmalloc (SBYTES (Vinvocation_name) |
| 10904 | + SBYTES (Vsystem_name) + 2); | 10904 | + SBYTES (Vsystem_name) + 2); |
| 10905 | strcat (strcat (lispstrcpy (dpyinfo->x_id_name, Vinvocation_name), "@"), | 10905 | char *nametail = lispstpcpy (dpyinfo->x_id_name, Vinvocation_name); |
| 10906 | SSDATA (Vsystem_name)); | 10906 | *nametail++ = '@'; |
| 10907 | lispstpcpy (nametail, Vsystem_name); | ||
| 10907 | 10908 | ||
| 10908 | /* Figure out which modifier bits mean what. */ | 10909 | /* Figure out which modifier bits mean what. */ |
| 10909 | x_find_modifier_meanings (dpyinfo); | 10910 | x_find_modifier_meanings (dpyinfo); |