Module: wine Branch: master Commit: 8f26aaf2ba7fc7889c3ec6c5841741a21bc12973 URL: https://gitlab.winehq.org/wine/wine/-/commit/8f26aaf2ba7fc7889c3ec6c5841741a...
Author: Alex Henrie alexhenrie24@gmail.com Date: Thu Nov 16 00:23:51 2023 -0700
sapi: Use CRT allocation functions.
---
dlls/sapi/async.c | 5 ++--- dlls/sapi/automation.c | 4 ++-- dlls/sapi/mmaudio.c | 22 +++++++++++----------- dlls/sapi/resource.c | 4 ++-- dlls/sapi/sapi_private.h | 1 - dlls/sapi/stream.c | 4 ++-- dlls/sapi/tts.c | 24 ++++++++++++------------ 7 files changed, 31 insertions(+), 33 deletions(-)
diff --git a/dlls/sapi/async.c b/dlls/sapi/async.c index 61b99019abe..69f962d5502 100644 --- a/dlls/sapi/async.c +++ b/dlls/sapi/async.c @@ -24,7 +24,6 @@ #include "winbase.h" #include "objbase.h"
-#include "wine/heap.h" #include "wine/list.h" #include "wine/debug.h"
@@ -58,7 +57,7 @@ void async_empty_queue(struct async_queue *queue) LIST_FOR_EACH_ENTRY_SAFE(task, next, &queue->tasks, struct async_task, entry) { list_remove(&task->entry); - heap_free(task); + free(task); } LeaveCriticalSection(&queue->cs);
@@ -87,7 +86,7 @@ static void CALLBACK async_worker(TP_CALLBACK_INSTANCE *instance, void *ctx) { ResetEvent(queue->empty); task->proc(task); - heap_free(task); + free(task); if (WaitForSingleObject(queue->cancel, 0) == WAIT_OBJECT_0) goto cancel; } diff --git a/dlls/sapi/automation.c b/dlls/sapi/automation.c index 8a0e0203198..6292a5119fa 100644 --- a/dlls/sapi/automation.c +++ b/dlls/sapi/automation.c @@ -95,7 +95,7 @@ static ULONG WINAPI file_stream_Release(ISpeechFileStream *iface)
if (!ref) { - heap_free(This); + free(This); }
return ref; @@ -375,7 +375,7 @@ const static ISpStreamVtbl spstream_vtbl =
HRESULT file_stream_create(IUnknown *outer, REFIID iid, void **obj) { - struct file_stream *This = heap_alloc(sizeof(*This)); + struct file_stream *This = malloc(sizeof(*This)); HRESULT hr;
if (!This) return E_OUTOFMEMORY; diff --git a/dlls/sapi/mmaudio.c b/dlls/sapi/mmaudio.c index 7452d9a7257..0369157acbc 100644 --- a/dlls/sapi/mmaudio.c +++ b/dlls/sapi/mmaudio.c @@ -381,12 +381,12 @@ static ULONG WINAPI mmsysaudio_Release(ISpMMSysAudio *iface) async_cancel_queue(&This->queue);
if (This->token) ISpObjectToken_Release(This->token); - heap_free(This->wfx); + free(This->wfx); CloseHandle(This->event); DeleteCriticalSection(&This->pending_cs); DeleteCriticalSection(&This->cs);
- heap_free(This); + free(This); }
return ref; @@ -421,7 +421,7 @@ static HRESULT WINAPI mmsysaudio_Write(ISpMMSysAudio *iface, const void *pv, ULO return SP_AUDIO_STOPPED; }
- if (!(buf = heap_alloc(sizeof(WAVEHDR) + cb))) + if (!(buf = malloc(sizeof(WAVEHDR) + cb))) { LeaveCriticalSection(&This->cs); return E_OUTOFMEMORY; @@ -434,7 +434,7 @@ static HRESULT WINAPI mmsysaudio_Write(ISpMMSysAudio *iface, const void *pv, ULO if (waveOutPrepareHeader(This->hwave.out, buf, sizeof(WAVEHDR)) != MMSYSERR_NOERROR) { LeaveCriticalSection(&This->cs); - heap_free(buf); + free(buf); return E_FAIL; }
@@ -562,7 +562,7 @@ static void free_out_buf_proc(struct async_task *task) TRACE("(%p).\n", task);
waveOutUnprepareHeader(fbt->audio->hwave.out, fbt->buf, sizeof(WAVEHDR)); - heap_free(fbt->buf); + free(fbt->buf);
EnterCriticalSection(&fbt->audio->pending_cs); buf_count = --fbt->audio->pending_buf_count; @@ -582,7 +582,7 @@ static void CALLBACK wave_out_proc(HWAVEOUT hwo, UINT msg, DWORD_PTR instance, D switch (msg) { case WOM_DONE: - if (!(task = heap_alloc(sizeof(*task)))) + if (!(task = malloc(sizeof(*task)))) { ERR("failed to allocate free_buf_task.\n"); break; @@ -685,13 +685,13 @@ static HRESULT WINAPI mmsysaudio_SetFormat(ISpMMSysAudio *iface, const GUID *gui return res == WAVERR_BADFORMAT ? SPERR_UNSUPPORTED_FORMAT : SPERR_GENERIC_MMSYS_ERROR; }
- if (!(new_wfx = heap_alloc(sizeof(*wfx) + wfx->cbSize))) + if (!(new_wfx = malloc(sizeof(*wfx) + wfx->cbSize))) { LeaveCriticalSection(&This->cs); return E_OUTOFMEMORY; } memcpy(new_wfx, wfx, sizeof(*wfx) + wfx->cbSize); - heap_free(This->wfx); + free(This->wfx); This->wfx = new_wfx;
LeaveCriticalSection(&This->cs); @@ -874,7 +874,7 @@ static HRESULT mmaudio_create(IUnknown *outer, REFIID iid, void **obj, enum flow return E_NOTIMPL; }
- if (!(This = heap_alloc_zero(sizeof(*This)))) + if (!(This = calloc(1, sizeof(*This)))) return E_OUTOFMEMORY; This->ISpEventSource_iface.lpVtbl = &event_source_vtbl; This->ISpEventSink_iface.lpVtbl = &event_sink_vtbl; @@ -887,9 +887,9 @@ static HRESULT mmaudio_create(IUnknown *outer, REFIID iid, void **obj, enum flow This->device_id = WAVE_MAPPER; This->state = SPAS_CLOSED;
- if (!(This->wfx = heap_alloc(sizeof(*This->wfx)))) + if (!(This->wfx = malloc(sizeof(*This->wfx)))) { - heap_free(This); + free(This); return E_OUTOFMEMORY; } This->wfx->wFormatTag = WAVE_FORMAT_PCM; diff --git a/dlls/sapi/resource.c b/dlls/sapi/resource.c index 8db833b3b39..5fea496979f 100644 --- a/dlls/sapi/resource.c +++ b/dlls/sapi/resource.c @@ -84,7 +84,7 @@ static ULONG WINAPI resource_manager_Release(ISpResourceManager *iface)
if (!ref) { - heap_free(This); + free(This); }
return ref; @@ -126,7 +126,7 @@ const static ISpResourceManagerVtbl resource_manager_vtbl =
HRESULT resource_manager_create(IUnknown *outer, REFIID iid, void **obj) { - struct resource_manager *This = heap_alloc(sizeof(*This)); + struct resource_manager *This = malloc(sizeof(*This)); HRESULT hr;
if (!This) return E_OUTOFMEMORY; diff --git a/dlls/sapi/sapi_private.h b/dlls/sapi/sapi_private.h index 3cdb59b36a8..f6a5e966461 100644 --- a/dlls/sapi/sapi_private.h +++ b/dlls/sapi/sapi_private.h @@ -18,7 +18,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */
-#include "wine/heap.h" #include "wine/list.h"
struct async_task diff --git a/dlls/sapi/stream.c b/dlls/sapi/stream.c index 6df2768b5cc..5cd64125ade 100644 --- a/dlls/sapi/stream.c +++ b/dlls/sapi/stream.c @@ -84,7 +84,7 @@ static ULONG WINAPI spstream_Release(ISpStream *iface)
if (!ref) { - heap_free(This); + free(This); }
return ref; @@ -235,7 +235,7 @@ const static ISpStreamVtbl spstream_vtbl =
HRESULT speech_stream_create(IUnknown *outer, REFIID iid, void **obj) { - struct spstream *This = heap_alloc(sizeof(*This)); + struct spstream *This = malloc(sizeof(*This)); HRESULT hr;
if (!This) return E_OUTOFMEMORY; diff --git a/dlls/sapi/tts.c b/dlls/sapi/tts.c index b1c90627d5e..410a57b4bfc 100644 --- a/dlls/sapi/tts.c +++ b/dlls/sapi/tts.c @@ -166,7 +166,7 @@ static ULONG WINAPI speech_voice_Release(ISpeechVoice *iface) if (This->engine) ISpTTSEngine_Release(This->engine); DeleteCriticalSection(&This->cs);
- heap_free(This); + free(This); }
return ref; @@ -822,7 +822,7 @@ done: } CoTaskMemFree(wfx); if (engine) ISpTTSEngine_Release(engine); - heap_free(speak_task->frag_list); + free(speak_task->frag_list); ISpTTSEngineSite_Release(speak_task->site);
if (speak_task->result) @@ -898,7 +898,7 @@ static HRESULT WINAPI spvoice_Speak(ISpVoice *iface, const WCHAR *contents, DWOR return hr; }
- if (!(frag = heap_alloc(sizeof(*frag) + contents_size))) + if (!(frag = malloc(sizeof(*frag) + contents_size))) return E_OUTOFMEMORY; memset(frag, 0, sizeof(*frag)); memcpy(frag + 1, contents, contents_size); @@ -915,7 +915,7 @@ static HRESULT WINAPI spvoice_Speak(ISpVoice *iface, const WCHAR *contents, DWOR goto fail; }
- speak_task = heap_alloc(sizeof(*speak_task)); + speak_task = malloc(sizeof(*speak_task));
speak_task->task.proc = speak_proc; speak_task->result = NULL; @@ -926,7 +926,7 @@ static HRESULT WINAPI spvoice_Speak(ISpVoice *iface, const WCHAR *contents, DWOR
if (!(flags & SPF_ASYNC)) { - if (!(result = heap_alloc(sizeof(*result)))) + if (!(result = malloc(sizeof(*result)))) { hr = E_OUTOFMEMORY; goto fail; @@ -952,18 +952,18 @@ static HRESULT WINAPI spvoice_Speak(ISpVoice *iface, const WCHAR *contents, DWOR WaitForSingleObject(result->done, INFINITE); hr = result->hr; CloseHandle(result->done); - heap_free(result); + free(result); return hr; }
fail: if (site) ISpTTSEngineSite_Release(site); - heap_free(frag); - heap_free(speak_task); + free(frag); + free(speak_task); if (result) { CloseHandle(result->done); - heap_free(result); + free(result); } return hr; } @@ -1210,7 +1210,7 @@ static ULONG WINAPI ttsenginesite_Release(ISpTTSEngineSite *iface) { if (This->voice) ISpeechVoice_Release(&This->voice->ISpeechVoice_iface); - heap_free(This); + free(This); }
return ref; @@ -1315,7 +1315,7 @@ const static ISpTTSEngineSiteVtbl ttsenginesite_vtbl =
static HRESULT ttsenginesite_create(struct speech_voice *voice, ULONG stream_num, ISpTTSEngineSite **site) { - struct tts_engine_site *This = heap_alloc(sizeof(*This)); + struct tts_engine_site *This = malloc(sizeof(*This));
if (!This) return E_OUTOFMEMORY;
@@ -1387,7 +1387,7 @@ const static IConnectionPointContainerVtbl container_vtbl =
HRESULT speech_voice_create(IUnknown *outer, REFIID iid, void **obj) { - struct speech_voice *This = heap_alloc(sizeof(*This)); + struct speech_voice *This = malloc(sizeof(*This)); HRESULT hr;
if (!This) return E_OUTOFMEMORY;