changeset 56190:f7711455b84f

(Fstring): Use SAFE_ALLOCA.
author Kim F. Storm <storm@cua.dk>
date Mon, 21 Jun 2004 21:52:46 +0000
parents d2086c9c0507
children 75f56340b4f9
files src/charset.c
diffstat 1 files changed, 12 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/charset.c	Mon Jun 21 21:52:28 2004 +0000
+++ b/src/charset.c	Mon Jun 21 21:52:46 2004 +0000
@@ -1645,11 +1645,16 @@
      int n;
      Lisp_Object *args;
 {
-  int i;
-  unsigned char *buf = (unsigned char *) alloca (MAX_MULTIBYTE_LENGTH * n);
-  unsigned char *p = buf;
+  int i, bufsize;
+  unsigned char *buf, *p;
   int c;
   int multibyte = 0;
+  Lisp_Object ret;
+  USE_SAFE_ALLOCA;
+
+  bufsize = MAX_MULTIBYTE_LENGTH * n;
+  SAFE_ALLOCA (buf, unsigned char *, bufsize);
+  p = buf;
 
   for (i = 0; i < n; i++)
     {
@@ -1667,7 +1672,10 @@
 	*p++ = c;
     }
 
-  return make_string_from_bytes (buf, n, p - buf);
+  ret = make_string_from_bytes (buf, n, p - buf);
+  SAFE_FREE (bufsize);
+
+  return ret;
 }
 
 #endif /* emacs */