changeset 56188:7997f11a2377

(casify_object): Use SAFE_ALLOCA.
author Kim F. Storm <storm@cua.dk>
date Mon, 21 Jun 2004 21:52:03 +0000
parents e3720731abbb
children d2086c9c0507
files src/casefiddle.c
diffstat 1 files changed, 7 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/casefiddle.c	Mon Jun 21 21:51:50 2004 +0000
+++ b/src/casefiddle.c	Mon Jun 21 21:52:03 2004 +0000
@@ -110,8 +110,12 @@
 	      /* The work is not yet finished because of a multibyte
 		 character just encountered.  */
 	      int fromlen, j_byte = i;
-	      char *buf
-		= (char *) alloca ((len - i) * MAX_MULTIBYTE_LENGTH + i);
+	      char *buf;
+	      int bufsize;
+	      USE_SAFE_ALLOCA;
+
+	      bufsize = (len - i) * MAX_MULTIBYTE_LENGTH + i;
+	      SAFE_ALLOCA (buf, char *, bufsize);
 
 	      /* Copy data already handled.  */
 	      bcopy (SDATA (obj), buf, i);
@@ -133,6 +137,7 @@
 		}
 	      obj = make_multibyte_string (buf, SCHARS (obj),
 					   j_byte);
+	      SAFE_FREE (bufsize);
 	    }
 	  return obj;
 	}