From dd88dae8a9f140c6bbc44d3efd44a37acc71c0c4 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sat, 19 Nov 2022 15:22:39 -0700 Subject: [PATCH] [unicode] Simplify set_funcs a bit more --- src/hb-unicode.cc | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/hb-unicode.cc b/src/hb-unicode.cc index d1ecef97c..9a6471e52 100644 --- a/src/hb-unicode.cc +++ b/src/hb-unicode.cc @@ -384,21 +384,18 @@ hb_unicode_funcs_set_##name##_func (hb_unicode_funcs_t *ufuncs, \ if (destroy) \ destroy (user_data); \ destroy = nullptr; \ - user_data = nullptr; \ + user_data = ufuncs->parent->user_data.name; \ } \ \ if (ufuncs->destroy.name) \ ufuncs->destroy.name (ufuncs->user_data.name); \ \ - if (func) { \ + if (func) \ ufuncs->func.name = func; \ - ufuncs->user_data.name = user_data; \ - ufuncs->destroy.name = destroy; \ - } else { \ + else \ ufuncs->func.name = ufuncs->parent->func.name; \ - ufuncs->user_data.name = ufuncs->parent->user_data.name; \ - ufuncs->destroy.name = nullptr; \ - } \ + ufuncs->user_data.name = user_data; \ + ufuncs->destroy.name = destroy; \ return; \ \ fail: \