From a97ce570ab693190350886e4e80942851c4d5727 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Tue, 4 Aug 2009 02:10:48 -0400 Subject: [PATCH] [HB] Optimize sanitize() --- src/hb-open-types-private.hh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/hb-open-types-private.hh b/src/hb-open-types-private.hh index 3d57122a..b3d7541a 100644 --- a/src/hb-open-types-private.hh +++ b/src/hb-open-types-private.hh @@ -376,11 +376,12 @@ struct ArrayOf inline bool sanitize (SANITIZE_ARG_DEF) { if (!(SANITIZE (len) && SANITIZE_GET_SIZE())) return false; - /* XXX For non-recursive types, this is too much overhead */ + /* Note; for non-recursive types, this is not much needed unsigned int count = len; for (unsigned int i = 0; i < count; i++) if (!SANITIZE (array[i])) return false; + */ } USHORT len; @@ -403,9 +404,11 @@ struct HeadlessArrayOf inline bool sanitize (SANITIZE_ARG_DEF) { if (!(SANITIZE_SELF () && SANITIZE_GET_SIZE())) return false; unsigned int count = len ? len - 1 : 0; + /* Note; for non-recursive types, this is not much needed for (unsigned int i = 0; i < count; i++) if (!SANITIZE (array[i])) return false; + */ } USHORT len; @@ -427,9 +430,11 @@ struct LongArrayOf inline bool sanitize (SANITIZE_ARG_DEF) { if (!(SANITIZE_SELF () && SANITIZE_GET_SIZE())) return false; unsigned int count = len; + /* Note; for non-recursive types, this is not much needed for (unsigned int i = 0; i < count; i++) if (!SANITIZE (array[i])) return false; + */ } ULONG len; -- GitLab