diff --git a/src/bin/xmoji/valuetypes.h b/src/bin/xmoji/valuetypes.h index 0241f58..b05fd40 100644 --- a/src/bin/xmoji/valuetypes.h +++ b/src/bin/xmoji/valuetypes.h @@ -5,17 +5,11 @@ typedef uint32_t Color; -#define priv_Color_xcbr(x) (x)->red -#define priv_Color_xcbg(x) (x)->green -#define priv_Color_xcbb(x) (x)->blue -#define priv_Color_xcba(x) (x)->alpha -#define priv_Color_comp(c,a,s) _Generic(c, \ - Color *: ((*(c) >> s) & 0xffU), \ - xcb_render_color_t *: ((a((xcb_render_color_t *)c) + 0x80U) >> 8)) -#define Color_red(c) priv_Color_comp(&(c), priv_Color_xcbr, 24) -#define Color_green(c) priv_Color_comp(&(c), priv_Color_xcbg, 16) -#define Color_blue(c) priv_Color_comp(&(c), priv_Color_xcbb, 8) -#define Color_alpha(c) priv_Color_comp(&(c), priv_Color_xcba, 0) +#define priv_Color_comp(c,s) (((c) >> s) & 0xffU) +#define Color_red(c) priv_Color_comp(c, 24) +#define Color_green(c) priv_Color_comp(c, 16) +#define Color_blue(c) priv_Color_comp(c, 8) +#define Color_alpha(c) priv_Color_comp(c, 0) #define priv_Color_16(c) ((c) << 8 | (c)) #define Color_red16(c) priv_Color_16(Color_red(c)) diff --git a/tools/emojigen/src/emojigen.c b/tools/emojigen/src/emojigen.c index 30232ae..c3f0b97 100644 --- a/tools/emojigen/src/emojigen.c +++ b/tools/emojigen/src/emojigen.c @@ -170,8 +170,8 @@ int main(void) if (!groupsize || !emojisize) goto done; group->len = emojisize - group->start; - puts("static const EmojiGroup groups[];\n" - "static const Emoji emojis[] = {"); + printf("static const EmojiGroup groups[%zu];\n" + "static const Emoji emojis[] = {\n", groupsize); for (size_t i = 0; i < emojisize; ++i) {