xmllite: Use CRT allocation functions.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
f859e8b2eb
commit
dbd4f9e91d
|
@ -3632,11 +3632,7 @@ HRESULT WINAPI CreateXmlReader(REFIID riid, void **obj, IMalloc *imalloc)
|
|||
|
||||
TRACE("(%s, %p, %p)\n", wine_dbgstr_guid(riid), obj, imalloc);
|
||||
|
||||
if (imalloc)
|
||||
reader = IMalloc_Alloc(imalloc, sizeof(*reader));
|
||||
else
|
||||
reader = heap_alloc(sizeof(*reader));
|
||||
if (!reader)
|
||||
if (!(reader = m_alloc(imalloc, sizeof(*reader))))
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
memset(reader, 0, sizeof(*reader));
|
||||
|
@ -3682,21 +3678,17 @@ HRESULT WINAPI CreateXmlReaderInputWithEncodingName(IUnknown *stream,
|
|||
|
||||
if (!stream || !ppInput) return E_INVALIDARG;
|
||||
|
||||
if (imalloc)
|
||||
readerinput = IMalloc_Alloc(imalloc, sizeof(*readerinput));
|
||||
else
|
||||
readerinput = heap_alloc(sizeof(*readerinput));
|
||||
if(!readerinput) return E_OUTOFMEMORY;
|
||||
if (!(readerinput = m_alloc(imalloc, sizeof(*readerinput))))
|
||||
return E_OUTOFMEMORY;
|
||||
memset(readerinput, 0, sizeof(*readerinput));
|
||||
|
||||
readerinput->IXmlReaderInput_iface.lpVtbl = &xmlreaderinputvtbl;
|
||||
readerinput->ref = 1;
|
||||
readerinput->imalloc = imalloc;
|
||||
readerinput->stream = NULL;
|
||||
if (imalloc) IMalloc_AddRef(imalloc);
|
||||
readerinput->encoding = parse_encoding_name(encoding, -1);
|
||||
readerinput->hint = hint;
|
||||
readerinput->baseuri = readerinput_strdupW(readerinput, base_uri);
|
||||
readerinput->pending = 0;
|
||||
|
||||
hr = alloc_input_buffer(readerinput);
|
||||
if (hr != S_OK)
|
||||
|
|
|
@ -1865,13 +1865,8 @@ HRESULT WINAPI CreateXmlWriter(REFIID riid, void **obj, IMalloc *imalloc)
|
|||
|
||||
TRACE("(%s, %p, %p)\n", wine_dbgstr_guid(riid), obj, imalloc);
|
||||
|
||||
if (imalloc)
|
||||
writer = IMalloc_Alloc(imalloc, sizeof(*writer));
|
||||
else
|
||||
writer = heap_alloc(sizeof(*writer));
|
||||
if (!writer)
|
||||
if (!(writer = m_alloc(imalloc, sizeof(*writer))))
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
memset(writer, 0, sizeof(*writer));
|
||||
|
||||
writer->IXmlWriter_iface.lpVtbl = &xmlwriter_vtbl;
|
||||
|
@ -1899,12 +1894,9 @@ static HRESULT create_writer_output(IUnknown *stream, IMalloc *imalloc, xml_enco
|
|||
|
||||
*out = NULL;
|
||||
|
||||
if (imalloc)
|
||||
writeroutput = IMalloc_Alloc(imalloc, sizeof(*writeroutput));
|
||||
else
|
||||
writeroutput = heap_alloc(sizeof(*writeroutput));
|
||||
if (!writeroutput)
|
||||
if (!(writeroutput = m_alloc(imalloc, sizeof(*writeroutput))))
|
||||
return E_OUTOFMEMORY;
|
||||
memset(writeroutput, 0, sizeof(*writeroutput));
|
||||
|
||||
writeroutput->IXmlWriterOutput_iface.lpVtbl = &xmlwriteroutputvtbl;
|
||||
writeroutput->ref = 1;
|
||||
|
@ -1912,21 +1904,18 @@ static HRESULT create_writer_output(IUnknown *stream, IMalloc *imalloc, xml_enco
|
|||
if (imalloc)
|
||||
IMalloc_AddRef(imalloc);
|
||||
writeroutput->encoding = encoding;
|
||||
writeroutput->stream = NULL;
|
||||
hr = init_output_buffer(writeroutput);
|
||||
if (FAILED(hr)) {
|
||||
IUnknown_Release(&writeroutput->IXmlWriterOutput_iface);
|
||||
return hr;
|
||||
}
|
||||
|
||||
if (encoding_name) {
|
||||
if (encoding_name)
|
||||
{
|
||||
unsigned int size = (lstrlenW(encoding_name) + 1) * sizeof(WCHAR);
|
||||
writeroutput->encoding_name = writeroutput_alloc(writeroutput, size);
|
||||
memcpy(writeroutput->encoding_name, encoding_name, size);
|
||||
}
|
||||
else
|
||||
writeroutput->encoding_name = NULL;
|
||||
writeroutput->written = 0;
|
||||
|
||||
IUnknown_QueryInterface(stream, &IID_IUnknown, (void**)&writeroutput->output);
|
||||
|
||||
|
|
|
@ -21,14 +21,12 @@
|
|||
#ifndef __XMLLITE_PRIVATE__
|
||||
#define __XMLLITE_PRIVATE__
|
||||
|
||||
#include "wine/heap.h"
|
||||
|
||||
static inline void *m_alloc(IMalloc *imalloc, size_t len)
|
||||
{
|
||||
if (imalloc)
|
||||
return IMalloc_Alloc(imalloc, len);
|
||||
else
|
||||
return heap_alloc(len);
|
||||
return malloc(len);
|
||||
}
|
||||
|
||||
static inline void *m_realloc(IMalloc *imalloc, void *mem, size_t len)
|
||||
|
@ -36,7 +34,7 @@ static inline void *m_realloc(IMalloc *imalloc, void *mem, size_t len)
|
|||
if (imalloc)
|
||||
return IMalloc_Realloc(imalloc, mem, len);
|
||||
else
|
||||
return heap_realloc(mem, len);
|
||||
return realloc(mem, len);
|
||||
}
|
||||
|
||||
static inline void m_free(IMalloc *imalloc, void *mem)
|
||||
|
@ -44,7 +42,7 @@ static inline void m_free(IMalloc *imalloc, void *mem)
|
|||
if (imalloc)
|
||||
IMalloc_Free(imalloc, mem);
|
||||
else
|
||||
heap_free(mem);
|
||||
free(mem);
|
||||
}
|
||||
|
||||
typedef enum
|
||||
|
|
Loading…
Reference in New Issue