diff options
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 | ||