All callers changed.
* xterm.c (x_term_init): Use new functionality to avoid two needs
to compute a string length.
2014-09-23 Paul Eggert <eggert@cs.ucla.edu>
+ * 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.
+
* dispextern.h, xdisp.c (window_box_right_offset): Now static.
2014-09-23 Dmitry Antipov <dmantipov@yandex.ru>
#endif
temp = pwd_var + 4;
memcpy (pwd_var, "PWD=", 4);
- lispstrcpy (temp, current_dir);
+ lispstpcpy (temp, current_dir);
#ifndef DOS_NT
/* We can't signal an Elisp error here; we're in a vfork. Since
&& STRINGP (CAR_SAFE (XD_NEXT_VALUE (object)))
&& NILP (CDR_SAFE (XD_NEXT_VALUE (object))))
{
- lispstrcpy (signature, CAR_SAFE (XD_NEXT_VALUE (object)));
+ lispstpcpy (signature, CAR_SAFE (XD_NEXT_VALUE (object)));
object = CDR_SAFE (XD_NEXT_VALUE (object));
}
if (minsize < 8)
minsize = 8;
name = SAFE_ALLOCA (minsize + SCHARS (file) + 8);
- lispstrcpy (name, docdir);
+ lispstpcpy (name, docdir);
strcat (name, SSDATA (file));
}
else
{
if (NILP (fold_wildcards))
return font_name;
- lispstrcpy (name, font_name);
+ lispstpcpy (name, font_name);
namelen = SBYTES (font_name);
goto done;
}
/* Start with emacs.FRAMENAME for the name (the specific one)
and with `Emacs' for the class key (the general one). */
- lispstrcpy (name_key, Vx_resource_name);
- lispstrcpy (class_key, Vx_resource_class);
+ lispstpcpy (name_key, Vx_resource_name);
+ lispstpcpy (class_key, Vx_resource_class);
strcat (class_key, ".");
strcat (class_key, SSDATA (class));
extern char *xlispstrdup (Lisp_Object) ATTRIBUTE_MALLOC;
extern void dupstring (char **, char const *);
-/* Like strcpy but uses known length of a Lisp string. */
+/* Make DEST a copy of STRING's data. Return a pointer to DEST's terminating
+ null byte. This is like stpcpy, except the source is a Lisp string. */
INLINE char *
-lispstrcpy (const char *dest, Lisp_Object string)
+lispstpcpy (char *dest, Lisp_Object string)
{
- return memcpy ((void *) dest, SSDATA (string), SBYTES (string) + 1);
+ ptrdiff_t len = SBYTES (string);
+ memcpy (dest, SDATA (string), len + 1);
+ return dest + len;
}
extern void xputenv (const char *);
address_un.sun_family = AF_LOCAL;
if (sizeof address_un.sun_path <= SBYTES (service))
error ("Service name too long");
- lispstrcpy (address_un.sun_path, service);
+ lispstpcpy (address_un.sun_path, service);
ai.ai_addr = (struct sockaddr *) &address_un;
ai.ai_addrlen = sizeof address_un;
goto open_socket;
if (sizeof rq.ifr_name <= SBYTES (ifname))
error ("interface name too long");
- lispstrcpy (rq.ifr_name, ifname);
+ lispstpcpy (rq.ifr_name, ifname);
s = socket (AF_INET, SOCK_STREAM | SOCK_CLOEXEC, 0);
if (s < 0)
{
char basename[ MAX_PATH ], *str;
- lispstrcpy (basename, Vinvocation_name);
+ lispstpcpy (basename, Vinvocation_name);
str = strrchr (basename, '.');
if (str) *str = 0;
Vinvocation_name = build_string (basename);
strcpy (cmdname, egetenv ("CMDPROXY"));
else
{
- lispstrcpy (cmdname, Vinvocation_directory);
+ lispstpcpy (cmdname, Vinvocation_directory);
strcat (cmdname, "cmdproxy.exe");
}
int i, class = -1;
XVisualInfo vinfo;
- lispstrcpy (s, value);
+ lispstpcpy (s, value);
dash = strchr (s, '-');
if (dash)
{
if (STRINGP (XCAR (alter))
&& ((r - name) + SBYTES (XCAR (alter))) < 256)
{
- lispstrcpy (r, XCAR (alter));
+ lispstpcpy (r, XCAR (alter));
list = xfont_list_pattern (display, name, registry, script);
if (! NILP (list))
break;
emacs_program[0] = '\0';
if (! EQ (Vinvocation_directory, Qnil))
- lispstrcpy (emacs_program, Vinvocation_directory);
+ lispstpcpy (emacs_program, Vinvocation_directory);
strcat (emacs_program, SSDATA (Vinvocation_name));
/* The SM protocol says all callbacks are mandatory, so set up all
dpyinfo->x_id = ++x_display_id;
dpyinfo->x_id_name = xmalloc (SBYTES (Vinvocation_name)
+ SBYTES (Vsystem_name) + 2);
- strcat (strcat (lispstrcpy (dpyinfo->x_id_name, Vinvocation_name), "@"),
- SSDATA (Vsystem_name));
+ char *nametail = lispstpcpy (dpyinfo->x_id_name, Vinvocation_name);
+ *nametail++ = '@';
+ lispstpcpy (nametail, Vsystem_name);
/* Figure out which modifier bits mean what. */
x_find_modifier_meanings (dpyinfo);