Commit 5fc49aa2 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

scrrun: Use CRT allocation functions.

parent b5a3848e
...@@ -30,7 +30,6 @@ ...@@ -30,7 +30,6 @@
#include "scrrun_private.h" #include "scrrun_private.h"
#include "wine/debug.h" #include "wine/debug.h"
#include "wine/heap.h"
#include "wine/list.h" #include "wine/list.h"
WINE_DEFAULT_DEBUG_CHANNEL(scrrun); WINE_DEFAULT_DEBUG_CHANNEL(scrrun);
...@@ -177,8 +176,7 @@ static HRESULT add_keyitem_pair(dictionary *dict, VARIANT *key, VARIANT *item) ...@@ -177,8 +176,7 @@ static HRESULT add_keyitem_pair(dictionary *dict, VARIANT *key, VARIANT *item)
if (FAILED(hr)) if (FAILED(hr))
return hr; return hr;
pair = heap_alloc(sizeof(*pair)); if (!(pair = malloc(sizeof(*pair))))
if (!pair)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
pair->hash = V_I4(&hash); pair->hash = V_I4(&hash);
...@@ -207,7 +205,7 @@ static HRESULT add_keyitem_pair(dictionary *dict, VARIANT *key, VARIANT *item) ...@@ -207,7 +205,7 @@ static HRESULT add_keyitem_pair(dictionary *dict, VARIANT *key, VARIANT *item)
failed: failed:
VariantClear(&pair->key); VariantClear(&pair->key);
VariantClear(&pair->item); VariantClear(&pair->item);
heap_free(pair); free(pair);
return hr; return hr;
} }
...@@ -215,7 +213,7 @@ static void free_keyitem_pair(struct keyitem_pair *pair) ...@@ -215,7 +213,7 @@ static void free_keyitem_pair(struct keyitem_pair *pair)
{ {
VariantClear(&pair->key); VariantClear(&pair->key);
VariantClear(&pair->item); VariantClear(&pair->item);
heap_free(pair); free(pair);
} }
static HRESULT WINAPI dict_enum_QueryInterface(IEnumVARIANT *iface, REFIID riid, void **obj) static HRESULT WINAPI dict_enum_QueryInterface(IEnumVARIANT *iface, REFIID riid, void **obj)
...@@ -251,10 +249,11 @@ static ULONG WINAPI dict_enum_Release(IEnumVARIANT *iface) ...@@ -251,10 +249,11 @@ static ULONG WINAPI dict_enum_Release(IEnumVARIANT *iface)
TRACE("(%p)->(%u)\n", This, ref); TRACE("(%p)->(%u)\n", This, ref);
if (!ref) { if (!ref)
{
list_remove(&This->notify); list_remove(&This->notify);
IDictionary_Release(&This->dict->IDictionary_iface); IDictionary_Release(&This->dict->IDictionary_iface);
heap_free(This); free(This);
} }
return ref; return ref;
...@@ -338,22 +337,22 @@ static const IEnumVARIANTVtbl dictenumvtbl = { ...@@ -338,22 +337,22 @@ static const IEnumVARIANTVtbl dictenumvtbl = {
static HRESULT create_dict_enum(dictionary *dict, IUnknown **ret) static HRESULT create_dict_enum(dictionary *dict, IUnknown **ret)
{ {
struct dictionary_enum *This; struct dictionary_enum *object;
*ret = NULL; *ret = NULL;
This = heap_alloc(sizeof(*This)); if (!(object = calloc(1, sizeof(*object))))
if (!This)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
This->IEnumVARIANT_iface.lpVtbl = &dictenumvtbl; object->IEnumVARIANT_iface.lpVtbl = &dictenumvtbl;
This->ref = 1; object->ref = 1;
This->cur = list_head(&dict->pairs); object->cur = list_head(&dict->pairs);
list_add_tail(&dict->notifier, &This->notify); list_add_tail(&dict->notifier, &object->notify);
This->dict = dict; object->dict = dict;
IDictionary_AddRef(&dict->IDictionary_iface); IDictionary_AddRef(&dict->IDictionary_iface);
*ret = (IUnknown*)&This->IEnumVARIANT_iface; *ret = (IUnknown *)&object->IEnumVARIANT_iface;
return S_OK; return S_OK;
} }
...@@ -423,14 +422,15 @@ static ULONG WINAPI dictionary_AddRef(IDictionary *iface) ...@@ -423,14 +422,15 @@ static ULONG WINAPI dictionary_AddRef(IDictionary *iface)
static ULONG WINAPI dictionary_Release(IDictionary *iface) static ULONG WINAPI dictionary_Release(IDictionary *iface)
{ {
dictionary *This = impl_from_IDictionary(iface); dictionary *dictionary = impl_from_IDictionary(iface);
ULONG ref = InterlockedDecrement(&This->ref); ULONG ref = InterlockedDecrement(&dictionary->ref);
TRACE("(%p)->(%u)\n", This, ref); TRACE("%p, refcount %u.\n", iface, ref);
if (!ref) { if (!ref)
{
IDictionary_RemoveAll(iface); IDictionary_RemoveAll(iface);
heap_free(This); free(dictionary);
} }
return ref; return ref;
...@@ -885,27 +885,26 @@ static const struct IDictionaryVtbl dictionary_vtbl = ...@@ -885,27 +885,26 @@ static const struct IDictionaryVtbl dictionary_vtbl =
dictionary_get_HashVal dictionary_get_HashVal
}; };
HRESULT WINAPI Dictionary_CreateInstance(IClassFactory *factory,IUnknown *outer,REFIID riid, void **obj) HRESULT WINAPI Dictionary_CreateInstance(IClassFactory *factory, IUnknown *outer, REFIID riid, void **ret)
{ {
dictionary *This; dictionary *object;
TRACE("(%p, %p, %s, %p)\n", factory, outer, debugstr_guid(riid), obj); TRACE("(%p, %p, %s, %p)\n", factory, outer, debugstr_guid(riid), ret);
*obj = NULL; *ret = NULL;
if (!(object = calloc(1, sizeof(*object))))
return E_OUTOFMEMORY;
This = heap_alloc(sizeof(*This)); object->IDictionary_iface.lpVtbl = &dictionary_vtbl;
if(!This) return E_OUTOFMEMORY; object->ref = 1;
object->method = BinaryCompare;
list_init(&object->pairs);
list_init(&object->notifier);
This->IDictionary_iface.lpVtbl = &dictionary_vtbl; init_classinfo(&CLSID_Dictionary, (IUnknown *)&object->IDictionary_iface, &object->classinfo);
This->ref = 1;
This->method = BinaryCompare;
This->count = 0;
list_init(&This->pairs);
list_init(&This->notifier);
memset(This->buckets, 0, sizeof(This->buckets));
init_classinfo(&CLSID_Dictionary, (IUnknown *)&This->IDictionary_iface, &This->classinfo); *ret = &object->IDictionary_iface;
*obj = &This->IDictionary_iface;
return S_OK; return S_OK;
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment