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 22 matching lines...) Expand all Loading... |
33 #define HB_SHAPER_IMPLEMENT(name) {#name, _hb_##name##_shape}, | 33 #define HB_SHAPER_IMPLEMENT(name) {#name, _hb_##name##_shape}, |
34 #include "hb-shaper-list.hh" | 34 #include "hb-shaper-list.hh" |
35 #undef HB_SHAPER_IMPLEMENT | 35 #undef HB_SHAPER_IMPLEMENT |
36 }; | 36 }; |
37 | 37 |
38 | 38 |
39 /* Thread-safe, lock-free, shapers */ | 39 /* Thread-safe, lock-free, shapers */ |
40 | 40 |
41 static const hb_shaper_pair_t *static_shapers; | 41 static const hb_shaper_pair_t *static_shapers; |
42 | 42 |
43 static inline | 43 #ifdef HB_USE_ATEXIT |
| 44 static |
44 void free_static_shapers (void) | 45 void free_static_shapers (void) |
45 { | 46 { |
46 if (unlikely (static_shapers != all_shapers)) | 47 if (unlikely (static_shapers != all_shapers)) |
47 free ((void *) static_shapers); | 48 free ((void *) static_shapers); |
48 } | 49 } |
| 50 #endif |
49 | 51 |
50 const hb_shaper_pair_t * | 52 const hb_shaper_pair_t * |
51 _hb_shapers_get (void) | 53 _hb_shapers_get (void) |
52 { | 54 { |
53 retry: | 55 retry: |
54 hb_shaper_pair_t *shapers = (hb_shaper_pair_t *) hb_atomic_ptr_get (&static_sh
apers); | 56 hb_shaper_pair_t *shapers = (hb_shaper_pair_t *) hb_atomic_ptr_get (&static_sh
apers); |
55 | 57 |
56 if (unlikely (!shapers)) | 58 if (unlikely (!shapers)) |
57 { | 59 { |
58 char *env = getenv ("HB_SHAPER_LIST"); | 60 char *env = getenv ("HB_SHAPER_LIST"); |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 goto retry; | 102 goto retry; |
101 } | 103 } |
102 | 104 |
103 #ifdef HB_USE_ATEXIT | 105 #ifdef HB_USE_ATEXIT |
104 atexit (free_static_shapers); /* First person registers atexit() callback. *
/ | 106 atexit (free_static_shapers); /* First person registers atexit() callback. *
/ |
105 #endif | 107 #endif |
106 } | 108 } |
107 | 109 |
108 return shapers; | 110 return shapers; |
109 } | 111 } |
OLD | NEW |