[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[freetype2] master 7c6b2f20b: [pshinter] Revise the hint table handling.
From: |
Werner Lemberg |
Subject: |
[freetype2] master 7c6b2f20b: [pshinter] Revise the hint table handling. |
Date: |
Tue, 8 Feb 2022 09:37:45 -0500 (EST) |
branch: master
commit 7c6b2f20b08a33b78b9e95cd77fda68aeedca02d
Author: Alexei Podtelezhnikov <apodtele@gmail.com>
Commit: Alexei Podtelezhnikov <apodtele@gmail.com>
[pshinter] Revise the hint table handling.
* src/pshinter/pshrec.c (ps_hint_table_ensure): Remove redundant size
check; avoid array zeroing because it is fully initialized when used.
(ps_hint_table_alloc): Fix off-by-one comparison and remove another
zeroing of the array elements.
---
src/pshinter/pshrec.c | 21 ++++++++-------------
1 file changed, 8 insertions(+), 13 deletions(-)
diff --git a/src/pshinter/pshrec.c b/src/pshinter/pshrec.c
index a007724f5..eae6e401b 100644
--- a/src/pshinter/pshrec.c
+++ b/src/pshinter/pshrec.c
@@ -63,16 +63,14 @@
{
FT_UInt old_max = table->max_hints;
FT_UInt new_max = count;
- FT_Error error = FT_Err_Ok;
+ FT_Error error;
- if ( new_max > old_max )
- {
- /* try to grow the table */
- new_max = FT_PAD_CEIL( new_max, 8 );
- if ( !FT_RENEW_ARRAY( table->hints, old_max, new_max ) )
- table->max_hints = new_max;
- }
+ /* try to grow the table */
+ new_max = FT_PAD_CEIL( new_max, 8 );
+ if ( !FT_QRENEW_ARRAY( table->hints, old_max, new_max ) )
+ table->max_hints = new_max;
+
return error;
}
@@ -90,17 +88,14 @@
count = table->num_hints;
count++;
- if ( count >= table->max_hints )
+ if ( count > table->max_hints )
{
error = ps_hint_table_ensure( table, count, memory );
if ( error )
goto Exit;
}
- hint = table->hints + count - 1;
- hint->pos = 0;
- hint->len = 0;
- hint->flags = 0;
+ hint = table->hints + count - 1; /* initialized upstream */
table->num_hints = count;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [freetype2] master 7c6b2f20b: [pshinter] Revise the hint table handling.,
Werner Lemberg <=