diff options
| author | Dmitry Antipov | 2013-08-14 20:36:16 +0400 |
|---|---|---|
| committer | Dmitry Antipov | 2013-08-14 20:36:16 +0400 |
| commit | 5b71542de3ef7f08b7c30e93340502d7cc120910 (patch) | |
| tree | dfb9bee6c19bf4467852500cf6b53771652e3d84 /src/alloc.c | |
| parent | d48d97ee4ab07e0c3e8c1a63efcfb707eef1b352 (diff) | |
| download | emacs-5b71542de3ef7f08b7c30e93340502d7cc120910.tar.gz emacs-5b71542de3ef7f08b7c30e93340502d7cc120910.zip | |
Utility function and macro to copy Lisp string to C string.
* lisp.h (xlispstrdupa): New macro.
(xlispstrdup): New prototype.
* alloc.c (xlispstrdup): New function.
* callint.c (Fcall_interactively):
* fileio.c (Ffile_name_directory, Fexpand_file_name)
(Fsubstitute_in_file_name):
* frame.c (Fmake_terminal_frame): Use xlispstrdupa.
* image.c (x_create_bitmap_from_file):
* w32term.c (w32_term_init):
* xterm.c (x_term_init): Use xlispstrdup.
Diffstat (limited to 'src/alloc.c')
| -rw-r--r-- | src/alloc.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/alloc.c b/src/alloc.c index 2c2232601cb..c0d8c32b440 100644 --- a/src/alloc.c +++ b/src/alloc.c | |||
| @@ -802,6 +802,15 @@ xstrdup (const char *s) | |||
| 802 | return memcpy (xmalloc (size), s, size); | 802 | return memcpy (xmalloc (size), s, size); |
| 803 | } | 803 | } |
| 804 | 804 | ||
| 805 | /* Like above, but duplicates Lisp string to C string. */ | ||
| 806 | |||
| 807 | char * | ||
| 808 | xlispstrdup (Lisp_Object string) | ||
| 809 | { | ||
| 810 | ptrdiff_t size = SBYTES (string) + 1; | ||
| 811 | return memcpy (xmalloc (size), SSDATA (string), size); | ||
| 812 | } | ||
| 813 | |||
| 805 | /* Like putenv, but (1) use the equivalent of xmalloc and (2) the | 814 | /* Like putenv, but (1) use the equivalent of xmalloc and (2) the |
| 806 | argument is a const pointer. */ | 815 | argument is a const pointer. */ |
| 807 | 816 | ||