diff options
| author | Jan Djärv | 2004-06-17 14:37:53 +0000 |
|---|---|---|
| committer | Jan Djärv | 2004-06-17 14:37:53 +0000 |
| commit | a6cb6b787e03344d28e93bef1cce5a7930854158 (patch) | |
| tree | 09d95d4705935a7a8ac11e6159e642cac869d215 | |
| parent | f303762dc1885b861fe9e9a9a6a5ec618c23ef31 (diff) | |
| download | emacs-a6cb6b787e03344d28e93bef1cce5a7930854158.tar.gz emacs-a6cb6b787e03344d28e93bef1cce5a7930854158.zip | |
* fns.c (string_to_multibyte): Use xmalloc/xfree instead of alloca.
| -rw-r--r-- | src/ChangeLog | 2 | ||||
| -rw-r--r-- | src/fns.c | 12 |
2 files changed, 12 insertions, 2 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 15cd195b4ed..298e2a5808d 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,5 +1,7 @@ | |||
| 1 | 2004-06-17 Jan Dj,Ad(Brv <jan.h.d@swipnet.se> | 1 | 2004-06-17 Jan Dj,Ad(Brv <jan.h.d@swipnet.se> |
| 2 | 2 | ||
| 3 | * fns.c (string_to_multibyte): Use xmalloc/xfree instead of alloca. | ||
| 4 | |||
| 3 | * macfns.c (Fx_display_color_cells): Do not limit return value to 256. | 5 | * macfns.c (Fx_display_color_cells): Do not limit return value to 256. |
| 4 | 6 | ||
| 5 | * macterm.c (mac_initialize_display_info): Initialize n_planes correctly | 7 | * macterm.c (mac_initialize_display_info): Initialize n_planes correctly |
| @@ -1049,16 +1049,24 @@ string_make_unibyte (string) | |||
| 1049 | Lisp_Object string; | 1049 | Lisp_Object string; |
| 1050 | { | 1050 | { |
| 1051 | unsigned char *buf; | 1051 | unsigned char *buf; |
| 1052 | Lisp_Object ret; | ||
| 1052 | 1053 | ||
| 1053 | if (! STRING_MULTIBYTE (string)) | 1054 | if (! STRING_MULTIBYTE (string)) |
| 1054 | return string; | 1055 | return string; |
| 1055 | 1056 | ||
| 1056 | buf = (unsigned char *) alloca (SCHARS (string)); | 1057 | /* We can not use alloca here, because string might be very long. |
| 1058 | For example when selecting megabytes of text and then pasting it to | ||
| 1059 | another application. */ | ||
| 1060 | buf = (unsigned char *) xmalloc (SCHARS (string)); | ||
| 1057 | 1061 | ||
| 1058 | copy_text (SDATA (string), buf, SBYTES (string), | 1062 | copy_text (SDATA (string), buf, SBYTES (string), |
| 1059 | 1, 0); | 1063 | 1, 0); |
| 1060 | 1064 | ||
| 1061 | return make_unibyte_string (buf, SCHARS (string)); | 1065 | ret = make_unibyte_string (buf, SCHARS (string)); |
| 1066 | |||
| 1067 | xfree (buf); | ||
| 1068 | |||
| 1069 | return ret; | ||
| 1062 | } | 1070 | } |
| 1063 | 1071 | ||
| 1064 | DEFUN ("string-make-multibyte", Fstring_make_multibyte, Sstring_make_multibyte, | 1072 | DEFUN ("string-make-multibyte", Fstring_make_multibyte, Sstring_make_multibyte, |