From: Tony Cook Date: Wed, 2 Jan 2019 08:08:57 +0000 (+1100) Subject: avoid an unneeded EXTEND() call when the FT2 has_chars() implementation returns 0. X-Git-Tag: v1.009~22 X-Git-Url: http://git.imager.perl.org/imager.git/commitdiff_plain/e7772cea943a428cd923bdd908ea9c006954067c avoid an unneeded EXTEND() call when the FT2 has_chars() implementation returns 0. --- diff --git a/Changes b/Changes index 0fa06a20..dc885fa9 100644 --- a/Changes +++ b/Changes @@ -72,6 +72,9 @@ High severity: - avoid dead code in i_ft2_glyph_name(), which is the implementation of glyph_names() for FT2. CID 185342. + - avoid an unneeded EXTEND() call when the FT2 has_chars() + implementation returns 0. CID 185292. + Imager 1.008 - 31 Dec 2018 ============ diff --git a/FT2/Changes b/FT2/Changes index 8d6b5e1c..4a874dec 100644 --- a/FT2/Changes +++ b/FT2/Changes @@ -4,6 +4,9 @@ Imager-Font-FT2 0.95 - avoid dead code in i_ft2_glyph_name(), which is the implementation of glyph_names(). CID 185342. + - avoid an unneeded EXTEND() call when the FT2 has_chars() + implementation returns 0. CID 185292. + Imager-Font-FT2 0.94 ==================== diff --git a/FT2/FT2.xs b/FT2/FT2.xs index dd934427..e1c4de44 100644 --- a/FT2/FT2.xs +++ b/FT2/FT2.xs @@ -243,10 +243,12 @@ i_ft2_has_chars(handle, text_sv, utf8) work = mymalloc(len); count = i_ft2_has_chars(handle, text, len, utf8, work); if (GIMME_V == G_ARRAY) { - EXTEND(SP, count); - for (i = 0; i < count; ++i) { - PUSHs(boolSV(work[i])); - } + if (count) { + EXTEND(SP, count); + for (i = 0; i < count; ++i) { + PUSHs(boolSV(work[i])); + } + } } else { EXTEND(SP, 1);