Mercurial > emacs
comparison src/casefiddle.c @ 56188:7997f11a2377
(casify_object): Use SAFE_ALLOCA.
author | Kim F. Storm <storm@cua.dk> |
---|---|
date | Mon, 21 Jun 2004 21:52:03 +0000 |
parents | 5407da499273 |
children | 66e97a54985f |
comparison
equal
deleted
inserted
replaced
56187:e3720731abbb | 56188:7997f11a2377 |
---|---|
108 if (i < len) | 108 if (i < len) |
109 { | 109 { |
110 /* The work is not yet finished because of a multibyte | 110 /* The work is not yet finished because of a multibyte |
111 character just encountered. */ | 111 character just encountered. */ |
112 int fromlen, j_byte = i; | 112 int fromlen, j_byte = i; |
113 char *buf | 113 char *buf; |
114 = (char *) alloca ((len - i) * MAX_MULTIBYTE_LENGTH + i); | 114 int bufsize; |
115 USE_SAFE_ALLOCA; | |
116 | |
117 bufsize = (len - i) * MAX_MULTIBYTE_LENGTH + i; | |
118 SAFE_ALLOCA (buf, char *, bufsize); | |
115 | 119 |
116 /* Copy data already handled. */ | 120 /* Copy data already handled. */ |
117 bcopy (SDATA (obj), buf, i); | 121 bcopy (SDATA (obj), buf, i); |
118 | 122 |
119 /* From now on, I counts bytes. */ | 123 /* From now on, I counts bytes. */ |
131 if ((int) flag >= (int) CASE_CAPITALIZE) | 135 if ((int) flag >= (int) CASE_CAPITALIZE) |
132 inword = SYNTAX (c) == Sword; | 136 inword = SYNTAX (c) == Sword; |
133 } | 137 } |
134 obj = make_multibyte_string (buf, SCHARS (obj), | 138 obj = make_multibyte_string (buf, SCHARS (obj), |
135 j_byte); | 139 j_byte); |
140 SAFE_FREE (bufsize); | |
136 } | 141 } |
137 return obj; | 142 return obj; |
138 } | 143 } |
139 obj = wrong_type_argument (Qchar_or_string_p, obj); | 144 obj = wrong_type_argument (Qchar_or_string_p, obj); |
140 } | 145 } |