# HG changeset patch # User Jan Dj¸«£rv # Date 1087483073 0 # Node ID 6b858fb890338de3aa60addf5f56f29a8f1de9d2 # Parent 5e784b2ea638d4d5afc4376056656c9df56f6c6d * fns.c (string_to_multibyte): Use xmalloc/xfree instead of alloca. diff -r 5e784b2ea638 -r 6b858fb89033 src/ChangeLog --- a/src/ChangeLog Thu Jun 17 13:04:25 2004 +0000 +++ b/src/ChangeLog Thu Jun 17 14:37:53 2004 +0000 @@ -1,5 +1,7 @@ 2004-06-17 Jan Dj,Ad(Brv + * fns.c (string_to_multibyte): Use xmalloc/xfree instead of alloca. + * macfns.c (Fx_display_color_cells): Do not limit return value to 256. * macterm.c (mac_initialize_display_info): Initialize n_planes correctly diff -r 5e784b2ea638 -r 6b858fb89033 src/fns.c --- a/src/fns.c Thu Jun 17 13:04:25 2004 +0000 +++ b/src/fns.c Thu Jun 17 14:37:53 2004 +0000 @@ -1049,16 +1049,24 @@ Lisp_Object string; { unsigned char *buf; + Lisp_Object ret; if (! STRING_MULTIBYTE (string)) return string; - buf = (unsigned char *) alloca (SCHARS (string)); + /* We can not use alloca here, because string might be very long. + For example when selecting megabytes of text and then pasting it to + another application. */ + buf = (unsigned char *) xmalloc (SCHARS (string)); copy_text (SDATA (string), buf, SBYTES (string), 1, 0); - return make_unibyte_string (buf, SCHARS (string)); + ret = make_unibyte_string (buf, SCHARS (string)); + + xfree (buf); + + return ret; } DEFUN ("string-make-multibyte", Fstring_make_multibyte, Sstring_make_multibyte,