OLD | NEW |
1 /* | 1 /* |
2 * Copyright © 2009,2010 Red Hat, Inc. | 2 * Copyright © 2009,2010 Red Hat, Inc. |
3 * Copyright © 2011,2012 Google, Inc. | 3 * Copyright © 2011,2012 Google, Inc. |
4 * | 4 * |
5 * This is part of HarfBuzz, a text shaping library. | 5 * This is part of HarfBuzz, a text shaping library. |
6 * | 6 * |
7 * Permission is hereby granted, without written agreement and without | 7 * Permission is hereby granted, without written agreement and without |
8 * license or royalty fees, to use, copy, modify, and distribute this | 8 * license or royalty fees, to use, copy, modify, and distribute this |
9 * software and its documentation for any purpose, provided that the | 9 * software and its documentation for any purpose, provided that the |
10 * above copyright notice and the following two paragraphs appear in | 10 * above copyright notice and the following two paragraphs appear in |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 } | 227 } |
228 | 228 |
229 void finish (void) { free ((void *) lang); } | 229 void finish (void) { free ((void *) lang); } |
230 }; | 230 }; |
231 | 231 |
232 | 232 |
233 /* Thread-safe lock-free language list */ | 233 /* Thread-safe lock-free language list */ |
234 | 234 |
235 static hb_language_item_t *langs; | 235 static hb_language_item_t *langs; |
236 | 236 |
237 #ifdef HAVE_ATEXIT | 237 #ifdef HB_USE_ATEXIT |
238 static inline | 238 static inline |
239 void free_langs (void) | 239 void free_langs (void) |
240 { | 240 { |
241 while (langs) { | 241 while (langs) { |
242 hb_language_item_t *next = langs->next; | 242 hb_language_item_t *next = langs->next; |
243 langs->finish (); | 243 langs->finish (); |
244 free (langs); | 244 free (langs); |
245 langs = next; | 245 langs = next; |
246 } | 246 } |
247 } | 247 } |
(...skipping 14 matching lines...) Expand all Loading... |
262 if (unlikely (!lang)) | 262 if (unlikely (!lang)) |
263 return NULL; | 263 return NULL; |
264 lang->next = first_lang; | 264 lang->next = first_lang; |
265 *lang = key; | 265 *lang = key; |
266 | 266 |
267 if (!hb_atomic_ptr_cmpexch (&langs, first_lang, lang)) { | 267 if (!hb_atomic_ptr_cmpexch (&langs, first_lang, lang)) { |
268 free (lang); | 268 free (lang); |
269 goto retry; | 269 goto retry; |
270 } | 270 } |
271 | 271 |
272 #ifdef HAVE_ATEXIT | 272 #ifdef HB_USE_ATEXIT |
273 if (!first_lang) | 273 if (!first_lang) |
274 atexit (free_langs); /* First person registers atexit() callback. */ | 274 atexit (free_langs); /* First person registers atexit() callback. */ |
275 #endif | 275 #endif |
276 | 276 |
277 return lang; | 277 return lang; |
278 } | 278 } |
279 | 279 |
280 | 280 |
281 /** | 281 /** |
282 * hb_language_from_string: | 282 * hb_language_from_string: |
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
580 * | 580 * |
581 * Since: 1.0 | 581 * Since: 1.0 |
582 **/ | 582 **/ |
583 hb_bool_t | 583 hb_bool_t |
584 hb_version_atleast (unsigned int major, | 584 hb_version_atleast (unsigned int major, |
585 unsigned int minor, | 585 unsigned int minor, |
586 unsigned int micro) | 586 unsigned int micro) |
587 { | 587 { |
588 return HB_VERSION_ATLEAST (major, minor, micro); | 588 return HB_VERSION_ATLEAST (major, minor, micro); |
589 } | 589 } |
OLD | NEW |