From b2070a509c6aabc5a275749979d140f8d78206e6 Mon Sep 17 00:00:00 2001 From: Khaled Hosny Date: Thu, 3 Jun 2021 10:50:46 +0200 Subject: [PATCH] =?UTF-8?q?[hb-directwrite]=20Don=E2=80=99t=20override=20n?= =?UTF-8?q?ew/delete?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is a testing shaper, we don’t care for overridden malloc/free here. Use malloc/free in the code called from hb_directwrite_face_create(). --- src/hb-directwrite.cc | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/src/hb-directwrite.cc b/src/hb-directwrite.cc index f8e9fa221..de0c5f300 100644 --- a/src/hb-directwrite.cc +++ b/src/hb-directwrite.cc @@ -49,16 +49,6 @@ typedef HRESULT (* WINAPI t_DWriteCreateFactory)( IUnknown **factory ); -/* - * hb-directwrite uses new/delete syntatically but as we let users - * to override malloc/free, we will redefine new/delete so users - * won't need to do that by their own. - */ -void* operator new (size_t size) { return malloc (size); } -void* operator new [] (size_t size) { return malloc (size); } -void operator delete (void* pointer) { free (pointer); } -void operator delete [] (void* pointer) { free (pointer); } - /* * DirectWrite font stream helpers @@ -801,7 +791,7 @@ _hb_directwrite_table_data_release (void *data) { _hb_directwrite_font_table_context *context = (_hb_directwrite_font_table_context *) data; context->face->ReleaseFontTable (context->table_context); - delete context; + free (context); } static hb_blob_t * @@ -822,7 +812,7 @@ _hb_directwrite_reference_table (hb_face_t *face HB_UNUSED, hb_tag_t tag, void * return nullptr; } - _hb_directwrite_font_table_context *context = new _hb_directwrite_font_table_context; + _hb_directwrite_font_table_context *context = (_hb_directwrite_font_table_context *) malloc (sizeof (_hb_directwrite_font_table_context)); context->face = dw_face; context->table_context = table_context;