Skip to content

Commit 79e47aa

Browse files
committed
fix C89 compat
1 parent 0c9324e commit 79e47aa

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

ext/mbstring/libmbfl/mbfl/mbfl_memory_device.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -239,11 +239,12 @@ mbfl_memory_device_strcat(mbfl_memory_device *device, const char *psrc)
239239
if ((device->pos + len) >= device->length) {
240240
/* reallocate buffer */
241241
int newlen = device->length + (len + MBFL_MEMORY_DEVICE_ALLOC_SIZE)*sizeof(unsigned char);
242+
unsigned char *tmp;
242243
if (newlen <= 0) {
243244
/* overflow */
244245
return -1;
245246
}
246-
unsigned char *tmp = (unsigned char *)mbfl_realloc((void *)device->buffer, newlen*sizeof(unsigned char));
247+
tmp = (unsigned char *)mbfl_realloc((void *)device->buffer, newlen*sizeof(unsigned char));
247248
if (tmp == NULL) {
248249
return -1;
249250
}
@@ -270,11 +271,12 @@ mbfl_memory_device_strncat(mbfl_memory_device *device, const char *psrc, int len
270271
if ((device->pos + len) >= device->length) {
271272
/* reallocate buffer */
272273
int newlen = device->length + len + MBFL_MEMORY_DEVICE_ALLOC_SIZE;
274+
unsigned char *tmp;
273275
if (newlen <= 0) {
274276
/* overflow */
275277
return -1;
276278
}
277-
unsigned char *tmp = (unsigned char *)mbfl_realloc((void *)device->buffer, newlen*sizeof(unsigned char));
279+
tmp = (unsigned char *)mbfl_realloc((void *)device->buffer, newlen*sizeof(unsigned char));
278280
if (tmp == NULL) {
279281
return -1;
280282
}
@@ -301,11 +303,12 @@ mbfl_memory_device_devcat(mbfl_memory_device *dest, mbfl_memory_device *src)
301303
if ((dest->pos + src->pos) >= dest->length) {
302304
/* reallocate buffer */
303305
int newlen = dest->length + src->pos + MBFL_MEMORY_DEVICE_ALLOC_SIZE;
306+
unsigned char *tmp;
304307
if (newlen <= 0) {
305308
/* overflow */
306309
return -1;
307310
}
308-
unsigned char *tmp = (unsigned char *)mbfl_realloc((void *)dest->buffer, newlen*sizeof(unsigned char));
311+
tmp = (unsigned char *)mbfl_realloc((void *)dest->buffer, newlen*sizeof(unsigned char));
309312
if (tmp == NULL) {
310313
return -1;
311314
}

0 commit comments

Comments
 (0)