Minor string-length refactoring.
* alloc.c (xstrdup): Use memcpy, not strcpy, since the length's known. * frame.c (make_monitor_attribute_list): Prefer build_string to strlen + make_string.
This commit is contained in:
parent
45fdb48240
commit
9acc107445
3 changed files with 12 additions and 4 deletions
|
@ -1,3 +1,10 @@
|
|||
2013-08-10 Paul Eggert <eggert@cs.ucla.edu>
|
||||
|
||||
Minor string-length refactoring.
|
||||
* alloc.c (xstrdup): Use memcpy, not strcpy, since the length's known.
|
||||
* frame.c (make_monitor_attribute_list):
|
||||
Prefer build_string to strlen + make_string.
|
||||
|
||||
2013-08-10 Jan Djärv <jan.h.d@swipnet.se>
|
||||
|
||||
* xterm.c (x_error_handler): Also ignore BadWindow for X_SetInputFocus,
|
||||
|
|
|
@ -796,8 +796,10 @@ xpalloc (void *pa, ptrdiff_t *nitems, ptrdiff_t nitems_incr_min,
|
|||
char *
|
||||
xstrdup (const char *s)
|
||||
{
|
||||
ptrdiff_t size;
|
||||
eassert (s);
|
||||
return strcpy (xmalloc (strlen (s) + 1), s);
|
||||
size = strlen (s) + 1;
|
||||
return memcpy (xmalloc (size), s, size);
|
||||
}
|
||||
|
||||
/* Like putenv, but (1) use the equivalent of xmalloc and (2) the
|
||||
|
|
|
@ -725,7 +725,7 @@ affects all frames on the same terminal device. */)
|
|||
XSETFRAME (frame, f);
|
||||
|
||||
store_in_alist (&parms, Qtty_type, build_string (t->display_info.tty->type));
|
||||
store_in_alist (&parms, Qtty,
|
||||
store_in_alist (&parms, Qtty,
|
||||
(t->display_info.tty->name
|
||||
? build_string (t->display_info.tty->name)
|
||||
: Qnil));
|
||||
|
@ -4203,8 +4203,7 @@ make_monitor_attribute_list (struct MonitorInfo *monitors,
|
|||
mi->work.width, mi->work.height);
|
||||
geometry = list4i (mi->geom.x, mi->geom.y,
|
||||
mi->geom.width, mi->geom.height);
|
||||
attributes = Fcons (Fcons (Qsource,
|
||||
make_string (source, strlen (source))),
|
||||
attributes = Fcons (Fcons (Qsource, build_string (source)),
|
||||
attributes);
|
||||
attributes = Fcons (Fcons (Qframes, AREF (monitor_frames, i)),
|
||||
attributes);
|
||||
|
|
Loading…
Add table
Reference in a new issue