[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] trunk r113791: Minor string-length refactoring.
From: |
Paul Eggert |
Subject: |
[Emacs-diffs] trunk r113791: Minor string-length refactoring. |
Date: |
Sat, 10 Aug 2013 15:42:12 +0000 |
User-agent: |
Bazaar (2.6b2) |
------------------------------------------------------------
revno: 113791
revision-id: address@hidden
parent: address@hidden
committer: Paul Eggert <address@hidden>
branch nick: trunk
timestamp: Sat 2013-08-10 08:42:08 -0700
message:
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.
modified:
src/ChangeLog changelog-20091113204419-o5vbwnq5f7feedwu-1438
src/alloc.c alloc.c-20091113204419-o5vbwnq5f7feedwu-252
src/frame.c frame.c-20091113204419-o5vbwnq5f7feedwu-243
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog 2013-08-10 09:16:37 +0000
+++ b/src/ChangeLog 2013-08-10 15:42:08 +0000
@@ -1,3 +1,10 @@
+2013-08-10 Paul Eggert <address@hidden>
+
+ 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 <address@hidden>
* xterm.c (x_error_handler): Also ignore BadWindow for X_SetInputFocus,
=== modified file 'src/alloc.c'
--- a/src/alloc.c 2013-08-09 12:25:34 +0000
+++ b/src/alloc.c 2013-08-10 15:42:08 +0000
@@ -796,8 +796,10 @@
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
=== modified file 'src/frame.c'
--- a/src/frame.c 2013-08-08 04:42:40 +0000
+++ b/src/frame.c 2013-08-10 15:42:08 +0000
@@ -725,7 +725,7 @@
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 @@
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);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] trunk r113791: Minor string-length refactoring.,
Paul Eggert <=