diff options
| author | Dmitry Antipov | 2013-08-09 16:25:34 +0400 |
|---|---|---|
| committer | Dmitry Antipov | 2013-08-09 16:25:34 +0400 |
| commit | 309f24d1ec07646fb1a090ee10fe456e79aea097 (patch) | |
| tree | 19ba0104e3713ee963113a52f9b38107a3740b2a /src/alloc.c | |
| parent | 55902276706ea2db832ad5748a18ab392a0873f1 (diff) | |
| download | emacs-309f24d1ec07646fb1a090ee10fe456e79aea097.tar.gz emacs-309f24d1ec07646fb1a090ee10fe456e79aea097.zip | |
Use xstrdup and build_unibyte_string where applicable.
* alloc.c (xstrdup): Tiny cleanup. Add eassert.
* xfns.c (x_window):
* xrdb.c (x_get_customization_string):
* xterm.c (xim_initialize):
* w32fns.c (w32_window): Use xstrdup.
(w32_display_monitor_attributes_list):
* emacs.c (init_cmdargs):
* keyboard.c (PUSH_C_STR):
* nsfont.m (nsfont_open):
* sysdep.c (system_process_attributes):
* w32.c (system_process_attributes):
* xdisp.c (message1, message1_nolog): Use build_unibyte_string.
Diffstat (limited to 'src/alloc.c')
| -rw-r--r-- | src/alloc.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/alloc.c b/src/alloc.c index c8141d22f95..19418bd6686 100644 --- a/src/alloc.c +++ b/src/alloc.c | |||
| @@ -796,10 +796,8 @@ xpalloc (void *pa, ptrdiff_t *nitems, ptrdiff_t nitems_incr_min, | |||
| 796 | char * | 796 | char * |
| 797 | xstrdup (const char *s) | 797 | xstrdup (const char *s) |
| 798 | { | 798 | { |
| 799 | size_t len = strlen (s) + 1; | 799 | eassert (s); |
| 800 | char *p = xmalloc (len); | 800 | return strcpy (xmalloc (strlen (s) + 1), s); |
| 801 | memcpy (p, s, len); | ||
| 802 | return p; | ||
| 803 | } | 801 | } |
| 804 | 802 | ||
| 805 | /* Like putenv, but (1) use the equivalent of xmalloc and (2) the | 803 | /* Like putenv, but (1) use the equivalent of xmalloc and (2) the |