25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-30 16:36:29 +01:00

Use driver allocators in expat for reflecting memory in erlang:memory(system)

This commit is contained in:
Evgeniy Khramtsov 2010-07-14 14:19:16 +10:00
parent 42ddc297fe
commit d7930d7f82

View File

@ -41,6 +41,8 @@ typedef struct {
XML_Parser parser; XML_Parser parser;
} expat_data; } expat_data;
static XML_Memory_Handling_Suite ms = {driver_alloc, driver_realloc, driver_free};
void *erlXML_StartElementHandler(expat_data *d, void *erlXML_StartElementHandler(expat_data *d,
const XML_Char *name, const XML_Char *name,
const XML_Char **atts) const XML_Char **atts)
@ -98,7 +100,7 @@ static ErlDrvData expat_erl_start(ErlDrvPort port, char *buff)
{ {
expat_data* d = (expat_data*)driver_alloc(sizeof(expat_data)); expat_data* d = (expat_data*)driver_alloc(sizeof(expat_data));
d->port = port; d->port = port;
d->parser = XML_ParserCreate("UTF-8"); d->parser = XML_ParserCreate_MM("UTF-8", &ms, NULL);
XML_SetUserData(d->parser, d); XML_SetUserData(d->parser, d);
set_port_control_flags(port, PORT_CONTROL_FLAG_BINARY); set_port_control_flags(port, PORT_CONTROL_FLAG_BINARY);