aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKim F. Storm2004-06-21 21:52:46 +0000
committerKim F. Storm2004-06-21 21:52:46 +0000
commit4894eddd88a9f761a2f3f8d8831680cdd45f8838 (patch)
tree5fbc3812eaecf965b06280d5b4f2b45f5a9b24db /src
parent143b8c2731a5a2dca7fb321a013230380ed0dbb2 (diff)
downloademacs-4894eddd88a9f761a2f3f8d8831680cdd45f8838.tar.gz
emacs-4894eddd88a9f761a2f3f8d8831680cdd45f8838.zip
(Fstring): Use SAFE_ALLOCA.
Diffstat (limited to 'src')
-rw-r--r--src/charset.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/charset.c b/src/charset.c
index 57a12b2398d..8eeddd51c92 100644
--- a/src/charset.c
+++ b/src/charset.c
@@ -1645,11 +1645,16 @@ usage: (string &rest CHARACTERS) */)
1645 int n; 1645 int n;
1646 Lisp_Object *args; 1646 Lisp_Object *args;
1647{ 1647{
1648 int i; 1648 int i, bufsize;
1649 unsigned char *buf = (unsigned char *) alloca (MAX_MULTIBYTE_LENGTH * n); 1649 unsigned char *buf, *p;
1650 unsigned char *p = buf;
1651 int c; 1650 int c;
1652 int multibyte = 0; 1651 int multibyte = 0;
1652 Lisp_Object ret;
1653 USE_SAFE_ALLOCA;
1654
1655 bufsize = MAX_MULTIBYTE_LENGTH * n;
1656 SAFE_ALLOCA (buf, unsigned char *, bufsize);
1657 p = buf;
1653 1658
1654 for (i = 0; i < n; i++) 1659 for (i = 0; i < n; i++)
1655 { 1660 {
@@ -1667,7 +1672,10 @@ usage: (string &rest CHARACTERS) */)
1667 *p++ = c; 1672 *p++ = c;
1668 } 1673 }
1669 1674
1670 return make_string_from_bytes (buf, n, p - buf); 1675 ret = make_string_from_bytes (buf, n, p - buf);
1676 SAFE_FREE (bufsize);
1677
1678 return ret;
1671} 1679}
1672 1680
1673#endif /* emacs */ 1681#endif /* emacs */