OLD | NEW |
1 /* | 1 /* |
2 * Copyright © 2012 Google, Inc. | 2 * Copyright © 2012 Google, Inc. |
3 * | 3 * |
4 * This is part of HarfBuzz, a text shaping library. | 4 * This is part of HarfBuzz, a text shaping library. |
5 * | 5 * |
6 * Permission is hereby granted, without written agreement and without | 6 * Permission is hereby granted, without written agreement and without |
7 * license or royalty fees, to use, copy, modify, and distribute this | 7 * license or royalty fees, to use, copy, modify, and distribute this |
8 * software and its documentation for any purpose, provided that the | 8 * software and its documentation for any purpose, provided that the |
9 * above copyright notice and the following two paragraphs appear in | 9 * above copyright notice and the following two paragraphs appear in |
10 * all copies of this software. | 10 * all copies of this software. |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 static inline bool \ | 88 static inline bool \ |
89 hb_##shaper##_shaper_##object##_data_ensure (hb_##object##_t *object) \ | 89 hb_##shaper##_shaper_##object##_data_ensure (hb_##object##_t *object) \ |
90 {\ | 90 {\ |
91 retry: \ | 91 retry: \ |
92 HB_SHAPER_DATA_TYPE (shaper, object) *data = (HB_SHAPER_DATA_TYPE (shaper, obj
ect) *) hb_atomic_ptr_get (&HB_SHAPER_DATA (shaper, object)); \ | 92 HB_SHAPER_DATA_TYPE (shaper, object) *data = (HB_SHAPER_DATA_TYPE (shaper, obj
ect) *) hb_atomic_ptr_get (&HB_SHAPER_DATA (shaper, object)); \ |
93 if (unlikely (!data)) { \ | 93 if (unlikely (!data)) { \ |
94 data = HB_SHAPER_DATA_CREATE_FUNC (shaper, object) (object); \ | 94 data = HB_SHAPER_DATA_CREATE_FUNC (shaper, object) (object); \ |
95 if (unlikely (!data)) \ | 95 if (unlikely (!data)) \ |
96 data = (HB_SHAPER_DATA_TYPE (shaper, object) *) HB_SHAPER_DATA_INVALID; \ | 96 data = (HB_SHAPER_DATA_TYPE (shaper, object) *) HB_SHAPER_DATA_INVALID; \ |
97 if (!hb_atomic_ptr_cmpexch (&HB_SHAPER_DATA (shaper, object), NULL, data)) {
\ | 97 if (!hb_atomic_ptr_cmpexch (&HB_SHAPER_DATA (shaper, object), NULL, data)) {
\ |
98 HB_SHAPER_DATA_DESTROY_FUNC (shaper, object) (data); \ | 98 if (data && \ |
| 99 » data != HB_SHAPER_DATA_INVALID && \ |
| 100 » data != HB_SHAPER_DATA_SUCCEEDED) \ |
| 101 » HB_SHAPER_DATA_DESTROY_FUNC (shaper, object) (data); \ |
99 goto retry; \ | 102 goto retry; \ |
100 } \ | 103 } \ |
101 } \ | 104 } \ |
102 return data != NULL && !HB_SHAPER_DATA_IS_INVALID (data); \ | 105 return data != NULL && !HB_SHAPER_DATA_IS_INVALID (data); \ |
103 } | 106 } |
104 | 107 |
105 | 108 |
106 #endif /* HB_SHAPER_PRIVATE_HH */ | 109 #endif /* HB_SHAPER_PRIVATE_HH */ |
OLD | NEW |