src/java.desktop/share/native/libfontmanager/harfbuzz/hb-shaper.cc
changeset 48274 51772bf1fb0c
parent 47216 71c04702a3d5
child 50826 f5b95be8b6e2
equal deleted inserted replaced
48273:e2065f7505eb 48274:51772bf1fb0c
    57 
    57 
    58   if (unlikely (!shapers))
    58   if (unlikely (!shapers))
    59   {
    59   {
    60     char *env = getenv ("HB_SHAPER_LIST");
    60     char *env = getenv ("HB_SHAPER_LIST");
    61     if (!env || !*env) {
    61     if (!env || !*env) {
    62       (void) hb_atomic_ptr_cmpexch (&static_shapers, NULL, &all_shapers[0]);
    62       (void) hb_atomic_ptr_cmpexch (&static_shapers, nullptr, &all_shapers[0]);
    63       return (const hb_shaper_pair_t *) all_shapers;
    63       return (const hb_shaper_pair_t *) all_shapers;
    64     }
    64     }
    65 
    65 
    66     /* Not found; allocate one. */
    66     /* Not found; allocate one. */
    67     shapers = (hb_shaper_pair_t *) calloc (1, sizeof (all_shapers));
    67     shapers = (hb_shaper_pair_t *) calloc (1, sizeof (all_shapers));
    68     if (unlikely (!shapers)) {
    68     if (unlikely (!shapers)) {
    69       (void) hb_atomic_ptr_cmpexch (&static_shapers, NULL, &all_shapers[0]);
    69       (void) hb_atomic_ptr_cmpexch (&static_shapers, nullptr, &all_shapers[0]);
    70       return (const hb_shaper_pair_t *) all_shapers;
    70       return (const hb_shaper_pair_t *) all_shapers;
    71     }
    71     }
    72 
    72 
    73     memcpy (shapers, all_shapers, sizeof (all_shapers));
    73     memcpy (shapers, all_shapers, sizeof (all_shapers));
    74 
    74 
    95         break;
    95         break;
    96       else
    96       else
    97         p = end + 1;
    97         p = end + 1;
    98     }
    98     }
    99 
    99 
   100     if (!hb_atomic_ptr_cmpexch (&static_shapers, NULL, shapers)) {
   100     if (!hb_atomic_ptr_cmpexch (&static_shapers, nullptr, shapers)) {
   101       free (shapers);
   101       free (shapers);
   102       goto retry;
   102       goto retry;
   103     }
   103     }
   104 
   104 
   105 #ifdef HB_USE_ATEXIT
   105 #ifdef HB_USE_ATEXIT