[shape-plan] Simplify macro

This commit is contained in:
Behdad Esfahbod 2014-08-12 17:03:27 -04:00
parent 29e25550ce
commit e956c65bf7

View File

@ -418,27 +418,21 @@ hb_shape_plan_create_cached (hb_face_t *face,
}; };
if (shaper_list) { if (shaper_list) {
/* Choose shaper. Adapted from hb_shape_plan_plan(). */ /* Choose shaper. Adapted from hb_shape_plan_plan().
#define HB_SHAPER_PLAN(shaper) \ * Must choose shaper exactly the same way as that function. */
{ \
if (hb_##shaper##_shaper_face_data_ensure (face)) \
{ \
proposal.shaper_func = _hb_##shaper##_shape; \
break; \
} \
}
for (const char * const *shaper_item = shaper_list; *shaper_item; shaper_item++) for (const char * const *shaper_item = shaper_list; *shaper_item; shaper_item++)
if (0) if (0)
; ;
#define HB_SHAPER_IMPLEMENT(shaper) \ #define HB_SHAPER_IMPLEMENT(shaper) \
else if (0 == strcmp (*shaper_item, #shaper)) \ else if (0 == strcmp (*shaper_item, #shaper) && \
HB_SHAPER_PLAN (shaper) hb_##shaper##_shaper_face_data_ensure (face)) \
{ \
proposal.shaper_func = _hb_##shaper##_shape; \
break; \
}
#include "hb-shaper-list.hh" #include "hb-shaper-list.hh"
#undef HB_SHAPER_IMPLEMENT #undef HB_SHAPER_IMPLEMENT
#undef HB_SHAPER_PLAN
if (unlikely (!proposal.shaper_list)) if (unlikely (!proposal.shaper_list))
return hb_shape_plan_get_empty (); return hb_shape_plan_get_empty ();
} }