Inline unneeded indirection for mbstring memory management

All memory allocation and deallocation for mbstring bounces through a table of
function pointers before going to emalloc/efree/etc. But this is unnecessary.
The allocators are never swapped out. Better to just call them directly.
This commit is contained in:
Alex Dowad 2020-06-27 17:00:17 +02:00
parent dc98c1346d
commit d4ef7ef11d
14 changed files with 51 additions and 213 deletions

View File

@ -167,7 +167,6 @@ AC_DEFUN([PHP_MBSTRING_SETUP_LIBMBFL], [
libmbfl/mbfl/mbfl_language.c
libmbfl/mbfl/mbfl_memory_device.c
libmbfl/mbfl/mbfl_string.c
libmbfl/mbfl/mbfl_allocators.c
libmbfl/nls/nls_de.c
libmbfl/nls/nls_en.c
libmbfl/nls/nls_ja.c
@ -181,7 +180,7 @@ AC_DEFUN([PHP_MBSTRING_SETUP_LIBMBFL], [
libmbfl/nls/nls_ua.c
])
PHP_MBSTRING_ADD_CFLAG([-DHAVE_CONFIG_H])
PHP_MBSTRING_ADD_INSTALL_HEADERS([libmbfl/config.h libmbfl/mbfl/eaw_table.h libmbfl/mbfl/mbfilter.h libmbfl/mbfl/mbfilter_8bit.h libmbfl/mbfl/mbfilter_pass.h libmbfl/mbfl/mbfilter_wchar.h libmbfl/mbfl/mbfl_allocators.h libmbfl/mbfl/mbfl_consts.h libmbfl/mbfl/mbfl_convert.h libmbfl/mbfl/mbfl_defs.h libmbfl/mbfl/mbfl_encoding.h libmbfl/mbfl/mbfl_filter_output.h libmbfl/mbfl/mbfl_ident.h libmbfl/mbfl/mbfl_language.h libmbfl/mbfl/mbfl_memory_device.h libmbfl/mbfl/mbfl_string.h])
PHP_MBSTRING_ADD_INSTALL_HEADERS([libmbfl/config.h libmbfl/mbfl/eaw_table.h libmbfl/mbfl/mbfilter.h libmbfl/mbfl/mbfilter_8bit.h libmbfl/mbfl/mbfilter_pass.h libmbfl/mbfl/mbfilter_wchar.h libmbfl/mbfl/mbfl_consts.h libmbfl/mbfl/mbfl_convert.h libmbfl/mbfl/mbfl_defs.h libmbfl/mbfl/mbfl_encoding.h libmbfl/mbfl/mbfl_filter_output.h libmbfl/mbfl/mbfl_ident.h libmbfl/mbfl/mbfl_language.h libmbfl/mbfl/mbfl_memory_device.h libmbfl/mbfl/mbfl_string.h])
])
dnl

View File

@ -42,13 +42,13 @@ if (PHP_MBSTRING != "no") {
ADD_SOURCES("ext/mbstring/libmbfl/mbfl", "mbfilter.c mbfilter_8bit.c \
mbfilter_pass.c mbfilter_wchar.c mbfl_convert.c mbfl_encoding.c \
mbfl_filter_output.c mbfl_ident.c mbfl_language.c mbfl_memory_device.c \
mbfl_string.c mbfl_allocators.c", "mbstring");
mbfl_string.c", "mbstring");
ADD_SOURCES("ext/mbstring/libmbfl/nls", "nls_de.c nls_en.c nls_ja.c \
nls_kr.c nls_neutral.c nls_ru.c nls_uni.c nls_zh.c nls_hy.c \
nls_ua.c nls_tr.c", "mbstring");
PHP_INSTALL_HEADERS("ext/mbstring", "mbstring.h libmbfl/config.h libmbfl/mbfl/eaw_table.h libmbfl/mbfl/mbfilter.h libmbfl/mbfl/mbfilter_8bit.h libmbfl/mbfl/mbfilter_pass.h libmbfl/mbfl/mbfilter_wchar.h libmbfl/mbfl/mbfl_allocators.h libmbfl/mbfl/mbfl_consts.h libmbfl/mbfl/mbfl_convert.h libmbfl/mbfl/mbfl_defs.h libmbfl/mbfl/mbfl_encoding.h libmbfl/mbfl/mbfl_filter_output.h libmbfl/mbfl/mbfl_ident.h libmbfl/mbfl/mbfl_language.h libmbfl/mbfl/mbfl_memory_device.h libmbfl/mbfl/mbfl_string.h");
PHP_INSTALL_HEADERS("ext/mbstring", "mbstring.h libmbfl/config.h libmbfl/mbfl/eaw_table.h libmbfl/mbfl/mbfilter.h libmbfl/mbfl/mbfilter_8bit.h libmbfl/mbfl/mbfilter_pass.h libmbfl/mbfl/mbfilter_wchar.h libmbfl/mbfl/mbfl_consts.h libmbfl/mbfl/mbfl_convert.h libmbfl/mbfl/mbfl_defs.h libmbfl/mbfl/mbfl_encoding.h libmbfl/mbfl/mbfl_filter_output.h libmbfl/mbfl/mbfl_ident.h libmbfl/mbfl/mbfl_language.h libmbfl/mbfl/mbfl_memory_device.h libmbfl/mbfl/mbfl_string.h");
AC_DEFINE('HAVE_MBSTRING', 1, 'Have mbstring support');

View File

@ -587,7 +587,7 @@ mbfl_filt_conv_wchar_cp50220_ctor(mbfl_convert_filter *filt)
mbfl_filt_conv_common_ctor(filt);
ctx = mbfl_malloc(sizeof(mbfl_filt_conv_wchar_cp50220_ctx));
ctx = emalloc(sizeof(mbfl_filt_conv_wchar_cp50220_ctx));
ctx->tl_param.mode = MBFL_FILT_TL_HAN2ZEN_KATAKANA | MBFL_FILT_TL_HAN2ZEN_GLUE;
ctx->last = *filt;
@ -608,7 +608,7 @@ mbfl_filt_conv_wchar_cp50220_copy(mbfl_convert_filter *src, mbfl_convert_filter
mbfl_filt_conv_wchar_cp50220_ctx *ctx;
*dest = *src;
ctx = mbfl_malloc(sizeof(mbfl_filt_conv_wchar_cp50220_ctx));
ctx = emalloc(sizeof(mbfl_filt_conv_wchar_cp50220_ctx));
dest->opaque = ctx;
dest->data = &ctx->last;
}
@ -619,7 +619,7 @@ mbfl_filt_conv_wchar_cp50220_dtor(mbfl_convert_filter *filt)
vtbl_tl_jisx0201_jisx0208.filter_dtor(filt);
if (filt->opaque != NULL) {
mbfl_free(filt->opaque);
efree(filt->opaque);
}
mbfl_filt_conv_common_dtor(filt);

View File

@ -161,7 +161,7 @@ static const char html_entity_chars[] = "#0123456789abcdefghijklmnopqrstuvwxyzAB
void mbfl_filt_conv_html_dec_ctor(mbfl_convert_filter *filter)
{
filter->status = 0;
filter->opaque = mbfl_malloc(html_enc_buffer_size+1);
filter->opaque = emalloc(html_enc_buffer_size+1);
}
void mbfl_filt_conv_html_dec_dtor(mbfl_convert_filter *filter)
@ -169,7 +169,7 @@ void mbfl_filt_conv_html_dec_dtor(mbfl_convert_filter *filter)
filter->status = 0;
if (filter->opaque)
{
mbfl_free((void*)filter->opaque);
efree((void*)filter->opaque);
}
filter->opaque = NULL;
}
@ -310,6 +310,6 @@ int mbfl_filt_conv_html_dec_flush(mbfl_convert_filter *filter)
void mbfl_filt_conv_html_dec_copy(mbfl_convert_filter *src, mbfl_convert_filter *dest)
{
*dest = *src;
dest->opaque = mbfl_malloc(html_enc_buffer_size+1);
dest->opaque = emalloc(html_enc_buffer_size+1);
memcpy(dest->opaque, src->opaque, html_enc_buffer_size+1);
}

View File

@ -22,7 +22,6 @@
*
*/
#include "mbfl_allocators.h"
#include "mbfilter_tl_jisx0201_jisx0208.h"
#include "translit_kana_jisx0201_jisx0208.h"

View File

@ -124,7 +124,7 @@ mbfl_buffer_converter_new(
const mbfl_encoding *to,
size_t buf_initsz)
{
mbfl_buffer_converter *convd = mbfl_malloc(sizeof(mbfl_buffer_converter));
mbfl_buffer_converter *convd = emalloc(sizeof(mbfl_buffer_converter));
convd->from = from;
convd->to = to;
@ -147,7 +147,7 @@ mbfl_buffer_converter_new(
}
}
if (convd->filter1 == NULL) {
mbfl_free(convd);
efree(convd);
return NULL;
}
@ -168,7 +168,7 @@ mbfl_buffer_converter_delete(mbfl_buffer_converter *convd)
mbfl_convert_filter_delete(convd->filter2);
}
mbfl_memory_device_clear(&convd->device);
mbfl_free((void*)convd);
efree((void*)convd);
}
}
@ -368,8 +368,8 @@ mbfl_encoding_detector_new(const mbfl_encoding **elist, int elistsz, int strict)
}
/* allocate */
identd = mbfl_malloc(sizeof(mbfl_encoding_detector));
identd->filter_list = mbfl_calloc(elistsz, sizeof(mbfl_identify_filter *));
identd = emalloc(sizeof(mbfl_encoding_detector));
identd->filter_list = ecalloc(elistsz, sizeof(mbfl_identify_filter *));
/* create filters */
i = 0;
@ -403,9 +403,9 @@ mbfl_encoding_detector_delete(mbfl_encoding_detector *identd)
i--;
mbfl_identify_filter_delete(identd->filter_list[i]);
}
mbfl_free((void *)identd->filter_list);
efree((void *)identd->filter_list);
}
mbfl_free((void *)identd);
efree((void *)identd);
}
}
@ -557,7 +557,7 @@ mbfl_identify_encoding(mbfl_string *string, const mbfl_encoding **elist, int eli
const mbfl_encoding *encoding;
/* flist is an array of mbfl_identify_filter instances */
flist = mbfl_calloc(elistsz, sizeof(mbfl_identify_filter));
flist = ecalloc(elistsz, sizeof(mbfl_identify_filter));
num = 0;
if (elist != NULL) {
@ -624,7 +624,7 @@ mbfl_identify_encoding(mbfl_string *string, const mbfl_encoding **elist, int eli
mbfl_identify_filter_cleanup(&flist[i]);
}
mbfl_free((void *)flist);
efree((void *)flist);
return encoding;
}
@ -1108,7 +1108,7 @@ mbfl_substr(
/* allocate memory and copy */
n = end - start;
result->len = 0;
result->val = w = (unsigned char*)mbfl_malloc(n + 1);
result->val = w = (unsigned char*)emalloc(n + 1);
result->len = n;
memcpy(w, string->val + start, n);
w[n] = '\0';
@ -1256,7 +1256,7 @@ mbfl_strcut(
/* allocate memory and copy string */
sz = end - start;
w = mbfl_calloc(sz + 8, sizeof(unsigned char));
w = ecalloc(sz + 8, sizeof(unsigned char));
memcpy(w, start, sz);
w[sz] = '\0';
@ -1686,7 +1686,7 @@ mbfl_ja_jp_hantozen(
}
next_filter = decoder;
param = mbfl_malloc(sizeof(mbfl_filt_tl_jisx0201_jisx0208_param));
param = emalloc(sizeof(mbfl_filt_tl_jisx0201_jisx0208_param));
param->mode = mode;
tl_filter = mbfl_convert_filter_new2(
@ -1695,7 +1695,7 @@ mbfl_ja_jp_hantozen(
(int(*)(void*))next_filter->filter_flush,
next_filter);
if (tl_filter == NULL) {
mbfl_free(param);
efree(param);
goto out;
}
@ -1729,7 +1729,7 @@ mbfl_ja_jp_hantozen(
out:
if (tl_filter != NULL) {
if (tl_filter->opaque != NULL) {
mbfl_free(tl_filter->opaque);
efree(tl_filter->opaque);
}
mbfl_convert_filter_delete(tl_filter);
}
@ -1922,7 +1922,7 @@ mime_header_encoder_new(
return NULL;
}
pe = mbfl_malloc(sizeof(struct mime_header_encoder_data));
pe = emalloc(sizeof(struct mime_header_encoder_data));
mbfl_memory_device_init(&pe->outdev, 0, 0);
mbfl_memory_device_init(&pe->tmpdev, 0, 0);
pe->prevpos = 0;
@ -2003,7 +2003,7 @@ mime_header_encoder_delete(struct mime_header_encoder_data *pe)
mbfl_convert_filter_delete(pe->encod_filter_backup);
mbfl_memory_device_clear(&pe->outdev);
mbfl_memory_device_clear(&pe->tmpdev);
mbfl_free((void*)pe);
efree((void*)pe);
}
}
@ -2265,7 +2265,7 @@ mime_header_decoder_result(struct mime_header_decoder_data *pd, mbfl_string *res
struct mime_header_decoder_data*
mime_header_decoder_new(const mbfl_encoding *outcode)
{
struct mime_header_decoder_data *pd = mbfl_malloc(sizeof(struct mime_header_decoder_data));
struct mime_header_decoder_data *pd = emalloc(sizeof(struct mime_header_decoder_data));
mbfl_memory_device_init(&pd->outdev, 0, 0);
mbfl_memory_device_init(&pd->tmpdev, 0, 0);
@ -2297,7 +2297,7 @@ mime_header_decoder_delete(struct mime_header_decoder_data *pd)
mbfl_convert_filter_delete(pd->deco_filter);
mbfl_memory_device_clear(&pd->outdev);
mbfl_memory_device_clear(&pd->tmpdev);
mbfl_free((void*)pd);
efree((void*)pd);
}
}

View File

@ -85,9 +85,10 @@
#ifndef MBFL_MBFILTER_H
#define MBFL_MBFILTER_H
#include "zend.h"
#include "mbfl_defs.h"
#include "mbfl_consts.h"
#include "mbfl_allocators.h"
#include "mbfl_encoding.h"
#include "mbfl_language.h"
#include "mbfl_string.h"

View File

@ -1,73 +0,0 @@
/*
* "streamable kanji code filter and converter"
* Copyright (c) 1998-2002 HappySize, Inc. All rights reserved.
*
* LICENSE NOTICES
*
* This file is part of "streamable kanji code filter and converter",
* which is distributed under the terms of GNU Lesser General Public
* License (version 2) as published by the Free Software Foundation.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with "streamable kanji code filter and converter";
* if not, write to the Free Software Foundation, Inc., 59 Temple Place,
* Suite 330, Boston, MA 02111-1307 USA
*
* The author of this file:
*
*/
/*
* The source code included in this files was separated from mbfilter.c
* by Moriyoshi Koizumi <moriyoshi@php.net> on 20 Dec 2002. The file
* mbfilter.c is included in this package .
*
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <stdlib.h>
#include <string.h>
#include <stddef.h>
#include "mbfl_allocators.h"
static void *__mbfl__malloc(size_t);
static void *__mbfl__realloc(void *, size_t);
static void *__mbfl__calloc(size_t, size_t);
static void __mbfl__free(void *);
static mbfl_allocators default_allocators = {
__mbfl__malloc,
__mbfl__realloc,
__mbfl__calloc,
__mbfl__free,
};
mbfl_allocators *__mbfl_allocators = &default_allocators;
static void *__mbfl__malloc(size_t sz)
{
return malloc(sz);
}
static void *__mbfl__realloc(void *ptr, size_t sz)
{
return realloc(ptr, sz);
}
static void *__mbfl__calloc(size_t nelems, size_t szelem)
{
return calloc(nelems, szelem);
}
static void __mbfl__free(void *ptr)
{
free(ptr);
}

View File

@ -1,54 +0,0 @@
/*
* "streamable kanji code filter and converter"
* Copyright (c) 1998-2002 HappySize, Inc. All rights reserved.
*
* LICENSE NOTICES
*
* This file is part of "streamable kanji code filter and converter",
* which is distributed under the terms of GNU Lesser General Public
* License (version 2) as published by the Free Software Foundation.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with "streamable kanji code filter and converter";
* if not, write to the Free Software Foundation, Inc., 59 Temple Place,
* Suite 330, Boston, MA 02111-1307 USA
*
* The author of this file:
*
*/
/*
* The source code included in this files was separated from mbfilter.h
* by Moriyoshi Koizumi <moriyoshi@php.net> on 20 Dec 2002. The file
* mbfilter.h is included in this package .
*
*/
#ifndef MBFL_ALLOCATORS_H
#define MBFL_ALLOCATORS_H
#include <stddef.h>
#include "mbfl_defs.h"
/* All allocation functions are required to be infallible.
* That is, they must never return NULL. */
typedef struct _mbfl_allocators {
void *(*malloc)(size_t);
void *(*realloc)(void *, size_t);
void *(*calloc)(size_t, size_t);
void (*free)(void *);
} mbfl_allocators;
MBFLAPI extern mbfl_allocators *__mbfl_allocators;
#define mbfl_malloc (__mbfl_allocators->malloc)
#define mbfl_realloc (__mbfl_allocators->realloc)
#define mbfl_calloc (__mbfl_allocators->calloc)
#define mbfl_free (__mbfl_allocators->free)
#endif /* MBFL_ALLOCATORS_H */

View File

@ -35,7 +35,6 @@
#include <stddef.h>
#include "mbfl_encoding.h"
#include "mbfl_allocators.h"
#include "mbfl_filter_output.h"
#include "mbfilter_pass.h"
#include "mbfilter_8bit.h"
@ -173,11 +172,11 @@ mbfl_convert_filter_new(
return NULL;
}
filter = mbfl_malloc(sizeof(mbfl_convert_filter));
filter = emalloc(sizeof(mbfl_convert_filter));
if (mbfl_convert_filter_common_init(filter, from, to, vtbl,
output_function, flush_function, data)) {
mbfl_free(filter);
efree(filter);
return NULL;
}
@ -201,11 +200,11 @@ mbfl_convert_filter_new2(
from_encoding = mbfl_no2encoding(vtbl->from);
to_encoding = mbfl_no2encoding(vtbl->to);
filter = mbfl_malloc(sizeof(mbfl_convert_filter));
filter = emalloc(sizeof(mbfl_convert_filter));
if (mbfl_convert_filter_common_init(filter, from_encoding, to_encoding, vtbl,
output_function, flush_function, data)) {
mbfl_free(filter);
efree(filter);
return NULL;
}
@ -217,7 +216,7 @@ mbfl_convert_filter_delete(mbfl_convert_filter *filter)
{
if (filter) {
(*filter->filter_dtor)(filter);
mbfl_free((void*)filter);
efree((void*)filter);
}
}

View File

@ -35,7 +35,6 @@
#include <stddef.h>
#include "mbfl_ident.h"
#include "mbfl_allocators.h"
#include "mbfilter_pass.h"
#include "mbfilter_8bit.h"
#include "mbfilter_wchar.h"
@ -191,9 +190,9 @@ const struct mbfl_identify_vtbl * mbfl_identify_filter_get_vtbl(enum mbfl_no_enc
mbfl_identify_filter *mbfl_identify_filter_new(enum mbfl_no_encoding encoding)
{
mbfl_identify_filter *filter = mbfl_malloc(sizeof(mbfl_identify_filter));
mbfl_identify_filter *filter = emalloc(sizeof(mbfl_identify_filter));
if (mbfl_identify_filter_init(filter, encoding)) {
mbfl_free(filter);
efree(filter);
return NULL;
}
@ -202,9 +201,9 @@ mbfl_identify_filter *mbfl_identify_filter_new(enum mbfl_no_encoding encoding)
mbfl_identify_filter *mbfl_identify_filter_new2(const mbfl_encoding *encoding)
{
mbfl_identify_filter *filter = mbfl_malloc(sizeof(mbfl_identify_filter));
mbfl_identify_filter *filter = emalloc(sizeof(mbfl_identify_filter));
if (mbfl_identify_filter_init2(filter, encoding)) {
mbfl_free(filter);
efree(filter);
return NULL;
}
@ -251,7 +250,7 @@ void mbfl_identify_filter_delete(mbfl_identify_filter *filter)
}
mbfl_identify_filter_cleanup(filter);
mbfl_free((void*)filter);
efree((void*)filter);
}
void mbfl_identify_filter_cleanup(mbfl_identify_filter *filter)

View File

@ -33,9 +33,9 @@
#endif
#include <stddef.h>
#include <string.h>
#include "mbfl_allocators.h"
#include "zend.h"
#include "mbfl_string.h"
#include "mbfl_memory_device.h"
@ -49,7 +49,7 @@ mbfl_memory_device_init(mbfl_memory_device *device, size_t initsz, size_t allocs
device->length = 0;
device->buffer = NULL;
if (initsz > 0) {
device->buffer = mbfl_malloc(initsz);
device->buffer = emalloc(initsz);
device->length = initsz;
}
device->pos = 0;
@ -66,7 +66,7 @@ mbfl_memory_device_realloc(mbfl_memory_device *device, size_t initsz, size_t all
{
if (device) {
if (initsz > device->length) {
device->buffer = mbfl_realloc(device->buffer, initsz);
device->buffer = erealloc(device->buffer, initsz);
device->length = initsz;
}
if (allocsz > MBFL_MEMORY_DEVICE_ALLOC_SIZE) {
@ -82,7 +82,7 @@ mbfl_memory_device_clear(mbfl_memory_device *device)
{
if (device) {
if (device->buffer) {
mbfl_free(device->buffer);
efree(device->buffer);
}
device->buffer = NULL;
device->length = 0;
@ -142,7 +142,7 @@ mbfl_memory_device_output(int c, void *data)
}
newlen = device->length + device->allocsz;
device->buffer = mbfl_realloc(device->buffer, newlen);
device->buffer = erealloc(device->buffer, newlen);
device->length = newlen;
}
@ -165,7 +165,7 @@ mbfl_memory_device_output2(int c, void *data)
}
newlen = device->length + device->allocsz;
device->buffer = mbfl_realloc(device->buffer, newlen);
device->buffer = erealloc(device->buffer, newlen);
device->length = newlen;
}
@ -190,7 +190,7 @@ mbfl_memory_device_output4(int c, void* data)
}
newlen = device->length + device->allocsz;
device->buffer = mbfl_realloc(device->buffer, newlen);
device->buffer = erealloc(device->buffer, newlen);
device->length = newlen;
}
@ -224,7 +224,7 @@ mbfl_memory_device_strncat(mbfl_memory_device *device, const char *psrc, size_t
}
newlen = device->length + len + MBFL_MEMORY_DEVICE_ALLOC_SIZE;
device->buffer = mbfl_realloc(device->buffer, newlen);
device->buffer = erealloc(device->buffer, newlen);
device->length = newlen;
}
@ -257,7 +257,7 @@ mbfl_wchar_device_clear(mbfl_wchar_device *device)
{
if (device) {
if (device->buffer) {
mbfl_free(device->buffer);
efree(device->buffer);
}
device->buffer = NULL;
device->length = 0;
@ -285,7 +285,7 @@ mbfl_wchar_device_output(int c, void *data)
return -1;
}
device->buffer = mbfl_realloc(device->buffer, newlen*sizeof(int));
device->buffer = erealloc(device->buffer, newlen*sizeof(int));
device->length = newlen;
}

View File

@ -34,7 +34,6 @@
#include <stddef.h>
#include "mbfl_allocators.h"
#include "mbfl_string.h"
#include "mbfilter_pass.h"
@ -61,7 +60,7 @@ void
mbfl_string_clear(mbfl_string *string)
{
if (string->val != (unsigned char*)NULL) {
mbfl_free(string->val);
efree(string->val);
}
string->val = (unsigned char*)NULL;
string->len = 0;

View File

@ -33,7 +33,6 @@
#include "main/php_output.h"
#include "ext/standard/info.h"
#include "libmbfl/mbfl/mbfl_allocators.h"
#include "libmbfl/mbfl/mbfilter_8bit.h"
#include "libmbfl/mbfl/mbfilter_pass.h"
#include "libmbfl/mbfl/mbfilter_wchar.h"
@ -216,35 +215,6 @@ ZEND_TSRMLS_CACHE_DEFINE()
ZEND_GET_MODULE(mbstring)
#endif
/* {{{ allocators */
static void *_php_mb_allocators_malloc(size_t sz)
{
return emalloc(sz);
}
static void *_php_mb_allocators_realloc(void *ptr, size_t sz)
{
return erealloc(ptr, sz);
}
static void *_php_mb_allocators_calloc(size_t nelems, size_t szelem)
{
return ecalloc(nelems, szelem);
}
static void _php_mb_allocators_free(void *ptr)
{
efree(ptr);
}
static const mbfl_allocators _php_mb_allocators = {
_php_mb_allocators_malloc,
_php_mb_allocators_realloc,
_php_mb_allocators_calloc,
_php_mb_allocators_free,
};
/* }}} */
/* {{{ static sapi_post_entry mbstr_post_entries[] */
static const sapi_post_entry mbstr_post_entries[] = {
{ DEFAULT_POST_CONTENT_TYPE, sizeof(DEFAULT_POST_CONTENT_TYPE)-1, sapi_read_standard_form_data, php_mb_post_handler },
@ -1151,7 +1121,6 @@ PHP_MINIT_FUNCTION(mbstring)
#if defined(COMPILE_DL_MBSTRING) && defined(ZTS)
ZEND_TSRMLS_CACHE_UPDATE();
#endif
__mbfl_allocators = (mbfl_allocators*)&_php_mb_allocators;
REGISTER_INI_ENTRIES();