From face7cf55d4895ffca314c8448c0a749a26cc182 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Tue, 29 May 2018 16:39:03 -0700 Subject: [PATCH] [map] Return bool from set() --- src/hb-map-private.hh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/hb-map-private.hh b/src/hb-map-private.hh index 6aaf4c417..563773949 100644 --- a/src/hb-map-private.hh +++ b/src/hb-map-private.hh @@ -118,10 +118,10 @@ struct hb_map_t return true; } - inline void set (hb_codepoint_t key, hb_codepoint_t value) + inline bool set (hb_codepoint_t key, hb_codepoint_t value) { - if (unlikely (in_error)) return; - if ((occupancy + occupancy / 2) > mask && !resize ()) return; + if (unlikely (in_error)) return false; + if ((occupancy + occupancy / 2) > mask && !resize ()) return false; unsigned int i = bucket_for (key); if (items[i].key != key) { @@ -130,6 +130,7 @@ struct hb_map_t items[i].key = key; } items[i].value = value; + return true; } inline hb_codepoint_t get (hb_codepoint_t key) const {