From 09a75856430c953e217e3333d4df7513f564f4a6 Mon Sep 17 00:00:00 2001 From: Alibek Omarov Date: Tue, 16 Jul 2024 05:11:06 +0300 Subject: [PATCH] engine: soundlib: super micro-optimization, reallocate buffer in Image_Copy rather than allocating and copying --- engine/common/soundlib/snd_utils.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engine/common/soundlib/snd_utils.c b/engine/common/soundlib/snd_utils.c index d6eb6178..28ac3863 100644 --- a/engine/common/soundlib/snd_utils.c +++ b/engine/common/soundlib/snd_utils.c @@ -90,8 +90,8 @@ static byte *Sound_Copy( size_t size ) { byte *out; - out = Mem_Malloc( host.soundpool, size ); - memcpy( out, sound.tempbuffer, size ); + out = Mem_Realloc( host.soundpool, sound.tempbuffer, size ); + sound.tempbuffer = NULL; return out; }