From 2515556673d9ce4bb811b60ce19eee03e8499d6b Mon Sep 17 00:00:00 2001 From: Daniel Kolesa Date: Fri, 14 Oct 2016 15:31:23 +0200 Subject: [PATCH] eolian gen: better checks for whether to add space after type --- src/bin/eolian/headers.c | 2 +- src/bin/eolian/sources.c | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/bin/eolian/headers.c b/src/bin/eolian/headers.c index febc11a..3a04572 100644 --- a/src/bin/eolian/headers.c +++ b/src/bin/eolian/headers.c @@ -131,7 +131,7 @@ _gen_func(const Eolian_Function *fid, Eolian_Function_Type ftype, if (!first) eina_strbuf_append(buf, ", "); eina_strbuf_append(buf, prtn); - if (!strchr(prtn, '*')) + if (prtn[strlen(prtn) - 1] != '*') eina_strbuf_append_char(buf, ' '); eina_strbuf_append(buf, _get_add_star(ftype, eolian_parameter_direction_get(pr))); diff --git a/src/bin/eolian/sources.c b/src/bin/eolian/sources.c index 0b15d79..6989238 100644 --- a/src/bin/eolian/sources.c +++ b/src/bin/eolian/sources.c @@ -135,7 +135,7 @@ _gen_func(const Eolian_Class *cl, const Eolian_Function *fid, eina_strbuf_append_printf(params_full, ", %s", ptn); eina_strbuf_append_printf(params_full_imp, ", %s", ptn); - if (!strchr(ptn, '*')) + if (ptn[strlen(ptn) - 1] != '*') { eina_strbuf_append_char(params_full, ' '); eina_strbuf_append_char(params_full_imp, ' '); @@ -167,7 +167,7 @@ _gen_func(const Eolian_Class *cl, const Eolian_Function *fid, const Eolian_Type *pt = eolian_parameter_type_get(pr); Eina_Stringshare *ptn = eolian_type_c_type_get(pt); - Eina_Bool had_star = !!strchr(ptn, '*'); + Eina_Bool had_star = ptn[strlen(ptn) - 1] == '*'; const char *add_star = _get_add_star(ftype, pd); if (eina_strbuf_length_get(params)) @@ -267,7 +267,7 @@ _gen_func(const Eolian_Class *cl, const Eolian_Function *fid, { /* T _class_name[_orig_class]_func_name_suffix */ eina_strbuf_append(buf, rtpn); - if (!strchr(rtpn, '*')) + if (rtpn[strlen(rtpn) - 1] != '*') eina_strbuf_append_char(buf, ' '); eina_strbuf_append_char(buf, '_'); eina_strbuf_append(buf, cnamel); @@ -296,7 +296,7 @@ _gen_func(const Eolian_Class *cl, const Eolian_Function *fid, /* generation of intermediate __eolian_... */ eina_strbuf_append(buf, "static "); eina_strbuf_append(buf, rtpn); - if (!strchr(rtpn, '*')) + if (rtpn[strlen(rtpn) - 1] != '*') eina_strbuf_append_char(buf, ' '); eina_strbuf_append(buf, "__eolian_"); eina_strbuf_append(buf, cnamel); @@ -794,7 +794,7 @@ _gen_params(const Eolian_Function *fid, Eolian_Function_Type ftype, eina_strbuf_append(params, prn); eina_strbuf_append_printf(params_full, ", %s", ptn); - if (!strchr(ptn, '*')) + if (ptn[strlen(ptn) - 1] != '*') eina_strbuf_append_char(params_full, ' '); eina_strbuf_append(params_full, prn); @@ -819,7 +819,7 @@ _gen_params(const Eolian_Function *fid, Eolian_Function_Type ftype, const Eolian_Type *pt = eolian_parameter_type_get(pr); Eina_Stringshare *ptn = eolian_type_c_type_get(pt); - Eina_Bool had_star = !!strchr(ptn, '*'); + Eina_Bool had_star = ptn[strlen(ptn) - 1] == '*'; const char *add_star = _get_add_star(ftype, pd); eina_strbuf_append(params, ", "); -- 2.7.4