From 9bab398462fa598047f34fd6d23e07a91305b1b3 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Mon, 22 Apr 2019 15:16:35 -0400 Subject: [PATCH] Simplify propagate_error() --- src/hb-serialize.hh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/hb-serialize.hh b/src/hb-serialize.hh index 311eacfe4..612a26a1e 100644 --- a/src/hb-serialize.hh +++ b/src/hb-serialize.hh @@ -120,12 +120,12 @@ struct hb_serialize_context_t this->packed.push (nullptr); } - bool propagate_error (bool e) - { return this->successful = this->successful && e; } - template bool propagate_error (const T &obj) - { return this->successful = this->successful && !obj.in_error (); } - template bool propagate_error (const T *obj) - { return this->successful = this->successful && !obj->in_error (); } + bool propagate_error (bool success) + { return this->successful = this->successful && success; } + + template bool propagate_error (T &&obj) + { return propagate_error (!hb_deref_pointer (obj).in_error ()); } + template bool propagate_error (T1 &&o1, T2 &&o2) { return propagate_error (o1) && propagate_error (o2); } template