From 4d7dad2a798bab34d7fc0da8e06196c4310b2945 Mon Sep 17 00:00:00 2001 From: Koichi Murase Date: Fri, 4 Mar 2022 23:26:11 +0900 Subject: [PATCH] *.{h,c}: do not use the C reserved identifiers for macro names/params --- src/bin/colors.c | 52 ++++++++++++++++++++--------------------- src/bin/config.c | 8 +++---- src/bin/options_mouse.c | 36 ++++++++++++++-------------- src/bin/sb.h | 4 ++-- src/bin/termpty.h | 4 ++-- src/bin/win.c | 16 ++++++------- 6 files changed, 60 insertions(+), 60 deletions(-) diff --git a/src/bin/colors.c b/src/bin/colors.c index 5001741c..b2006e7c 100644 --- a/src/bin/colors.c +++ b/src/bin/colors.c @@ -460,18 +460,18 @@ colors_term_init(Evas_Object *textgrid, if (!cs) cs = &default_colorscheme; -#define CS_SET_INVISIBLE(_c) do { \ +#define CS_SET_INVISIBLE(c_) do { \ evas_object_textgrid_palette_set( \ - textgrid, EVAS_TEXTGRID_PALETTE_STANDARD, _c, \ + textgrid, EVAS_TEXTGRID_PALETTE_STANDARD, c_, \ 0, 0, 0, 0); \ } while(0) -#define CS_SET(_c, _F) do { \ - r = cs->_F.r; \ - g = cs->_F.g; \ - b = cs->_F.b; \ - a = cs->_F.a; \ +#define CS_SET(c_, F_) do { \ + r = cs->F_.r; \ + g = cs->F_.g; \ + b = cs->F_.b; \ + a = cs->F_.a; \ evas_object_textgrid_palette_set( \ - textgrid, EVAS_TEXTGRID_PALETTE_STANDARD, _c, \ + textgrid, EVAS_TEXTGRID_PALETTE_STANDARD, c_, \ r, g, b, a); \ } while (0) @@ -532,13 +532,13 @@ colors_term_init(Evas_Object *textgrid, CS_SET(47 /* inverse bg */, faint.inverse_bg); #undef CS_SET -#define CS_SET(_c, _F) do { \ - r = cs->_F.r; \ - g = cs->_F.g; \ - b = cs->_F.b; \ - a = cs->_F.a; \ +#define CS_SET(c_, F_) do { \ + r = cs->F_.r; \ + g = cs->F_.g; \ + b = cs->F_.b; \ + a = cs->F_.a; \ evas_object_textgrid_palette_set( \ - textgrid, EVAS_TEXTGRID_PALETTE_EXTENDED, _c, \ + textgrid, EVAS_TEXTGRID_PALETTE_EXTENDED, c_, \ r, g, b, a); \ } while (0) @@ -608,24 +608,24 @@ color_scheme_apply(Evas_Object *edje, { EINA_SAFETY_ON_NULL_RETURN(cs); -#define CS_SET(_K, _F) do {\ - if (edje_object_color_class_set(edje, _K, \ - cs->_F.r, cs->_F.g, cs->_F.b, cs->_F.a, \ - cs->_F.r, cs->_F.g, cs->_F.b, cs->_F.a, \ - cs->_F.r, cs->_F.g, cs->_F.b, cs->_F.a) \ +#define CS_SET(K_, F_) do {\ + if (edje_object_color_class_set(edje, K_, \ + cs->F_.r, cs->F_.g, cs->F_.b, cs->F_.a, \ + cs->F_.r, cs->F_.g, cs->F_.b, cs->F_.a, \ + cs->F_.r, cs->F_.g, cs->F_.b, cs->F_.a) \ != EINA_TRUE) \ { \ - ERR("error setting color class '%s' on object %p", _K, edje); \ + ERR("error setting color class '%s' on object %p", K_, edje); \ } \ } while (0) -#define CS_SET_MANY(_K, _F1, _F2, _F3) do { \ - if (edje_object_color_class_set(edje, _K, \ - cs->_F1.r, cs->_F1.g, cs->_F1.b, cs->_F1.a, \ - cs->_F2.r, cs->_F2.g, cs->_F2.b, cs->_F2.a, \ - cs->_F3.r, cs->_F3.g, cs->_F3.b, cs->_F3.a) \ +#define CS_SET_MANY(K_, F1_, F2_, F3_) do { \ + if (edje_object_color_class_set(edje, K_, \ + cs->F1_.r, cs->F1_.g, cs->F1_.b, cs->F1_.a, \ + cs->F2_.r, cs->F2_.g, cs->F2_.b, cs->F2_.a, \ + cs->F3_.r, cs->F3_.g, cs->F3_.b, cs->F3_.a) \ != EINA_TRUE) \ { \ - ERR("error setting color class '%s' on object %p", _K, edje); \ + ERR("error setting color class '%s' on object %p", K_, edje); \ } \ } while (0) diff --git a/src/bin/config.c b/src/bin/config.c index 7a9ef6bc..5f3813b9 100644 --- a/src/bin/config.c +++ b/src/bin/config.c @@ -751,15 +751,15 @@ config_load(void) EINA_FALLTHROUGH; /*pass through*/ case 25: - #define THEME_TO_COLORSCHEME(_Theme, _Base, _ColorSheme) \ + #define THEME_TO_COLORSCHEME(Theme_, Base_, ColorSheme_) \ do { \ - if (!strncmp(config->theme, _Theme, sizeof(_Theme)-1)) \ + if (!strncmp(config->theme, Theme_, sizeof(Theme_)-1)) \ { \ eina_stringshare_replace(&config->theme, \ - _Base); \ + Base_); \ eina_stringshare_replace( \ &config->color_scheme_name, \ - _ColorSheme); \ + ColorSheme_); \ } \ } while (0) diff --git a/src/bin/options_mouse.c b/src/bin/options_mouse.c index 534e74e9..c9022a07 100644 --- a/src/bin/options_mouse.c +++ b/src/bin/options_mouse.c @@ -39,9 +39,9 @@ _cb_op_helper_inline_chg(void *data, config_save(config); } -#define _CB(_CFG, _NAME) \ +#define CB_(CFG_, NAME_) \ static void \ -_cb_op_##_NAME(void *data, \ +_cb_op_##NAME_(void *data, \ Evas_Object *obj, \ void *_event EINA_UNUSED) \ { \ @@ -50,15 +50,15 @@ _cb_op_##_NAME(void *data, \ Evas_Object *term = ctx->term; \ char *txt; \ \ - if (config->_CFG) \ + if (config->CFG_) \ { \ - eina_stringshare_del(config->_CFG); \ - config->_CFG = NULL; \ + eina_stringshare_del(config->CFG_); \ + config->CFG_ = NULL; \ } \ txt = elm_entry_markup_to_utf8(elm_object_text_get(obj)); \ if (txt) \ { \ - config->_CFG = eina_stringshare_add(txt); \ + config->CFG_ = eina_stringshare_add(txt); \ free(txt); \ } \ termio_config_update(term); \ @@ -66,14 +66,14 @@ _cb_op_##_NAME(void *data, \ config_save(config); \ } -_CB(helper.email, helper_email); -_CB(helper.url.image, helper_url_image); -_CB(helper.url.video, helper_url_video); -_CB(helper.url.general, helper_url_general); -_CB(helper.local.image, helper_local_image); -_CB(helper.local.video, helper_local_video); -_CB(helper.local.general, helper_local_general); -#undef _CB +CB_(helper.email, helper_email); +CB_(helper.url.image, helper_url_image); +CB_(helper.url.video, helper_url_video); +CB_(helper.url.general, helper_url_general); +CB_(helper.local.image, helper_local_image); +CB_(helper.local.video, helper_local_video); +CB_(helper.local.general, helper_local_general); +#undef CB_ static void _cb_op_hide_cursor_changed(void *data, @@ -227,7 +227,7 @@ options_mouse(Evas_Object *opbox, Evas_Object *term) OPTIONS_SEPARATOR; -#define HELPERS_LINE(_TXT, _CFG, _NAME) \ +#define HELPERS_LINE(TXT_, CFG_, NAME_) \ do { \ hbx = o = elm_box_add(opbox); \ evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, 0.0); \ @@ -239,7 +239,7 @@ options_mouse(Evas_Object *opbox, Evas_Object *term) o = elm_label_add(hbx); \ evas_object_size_hint_weight_set(o, 0.0, 0.0); \ evas_object_size_hint_align_set(o, 0.0, 0.5); \ - elm_object_text_set(o, _TXT); \ + elm_object_text_set(o, TXT_); \ elm_box_pack_end(hbx, o); \ evas_object_show(o); \ \ @@ -250,7 +250,7 @@ options_mouse(Evas_Object *opbox, Evas_Object *term) elm_entry_scrollable_set(o, EINA_TRUE); \ elm_scroller_policy_set(o, ELM_SCROLLER_POLICY_OFF, \ ELM_SCROLLER_POLICY_OFF); \ - txt = elm_entry_utf8_to_markup(config->_CFG); \ + txt = elm_entry_utf8_to_markup(config->CFG_); \ if (txt) \ { \ elm_object_text_set(o, txt); \ @@ -259,7 +259,7 @@ options_mouse(Evas_Object *opbox, Evas_Object *term) elm_box_pack_end(hbx, o); \ evas_object_show(o); \ evas_object_smart_callback_add(o, "changed", \ - _cb_op_##_NAME, ctx); \ + _cb_op_##NAME_, ctx); \ } while(0) HELPERS_LINE(_("E-mail:"), helper.email, helper_email); diff --git a/src/bin/sb.h b/src/bin/sb.h index 0a9f4db9..aa438a0a 100644 --- a/src/bin/sb.h +++ b/src/bin/sb.h @@ -11,11 +11,11 @@ struct ty_sb { }; int ty_sb_add(struct ty_sb *sb, const char *s, size_t len); -#define TY_SB_ADD(_SB, _S) ty_sb_add(_SB, _S, strlen(_S)) +#define TY_SB_ADD(SB_, S_) ty_sb_add(SB_, S_, strlen(S_)) void ty_sb_spaces_rtrim(struct ty_sb *sb); void ty_sb_spaces_ltrim(struct ty_sb *sb); int ty_sb_prepend(struct ty_sb *sb, const char *s, size_t len); -#define TY_SB_PREPEND(_SB, _S) ty_sb_prepend(_SB, _S, strlen(_S)) +#define TY_SB_PREPEND(SB_, S_) ty_sb_prepend(SB_, S_, strlen(S_)) char *ty_sb_steal_buf(struct ty_sb *sb); void ty_sb_lskip(struct ty_sb *sb, size_t len); void ty_sb_rskip(struct ty_sb *sb, size_t len); diff --git a/src/bin/termpty.h b/src/bin/termpty.h index 0d739332..175e5809 100644 --- a/src/bin/termpty.h +++ b/src/bin/termpty.h @@ -283,8 +283,8 @@ Termcell *termpty_cellrow_get(Termpty *ty, int y, ssize_t *wret); Termcell * termpty_cell_get(Termpty *ty, int y_requested, int x_requested); ssize_t termpty_row_length(Termpty *ty, int y); -#define TERMPTY_WRITE_STR(_S) \ - termpty_write(ty, _S, strlen(_S)) +#define TERMPTY_WRITE_STR(S_) \ + termpty_write(ty, S_, strlen(S_)) void termpty_write(Termpty *ty, const char *input, int len); void termpty_resize(Termpty *ty, int new_w, int new_h); diff --git a/src/bin/win.c b/src/bin/win.c index d35ac951..bd8c64e4 100644 --- a/src/bin/win.c +++ b/src/bin/win.c @@ -5688,13 +5688,13 @@ _media_http_head_complete(void *data, headers = ecore_con_url_response_headers_get(ev->url_con); EINA_LIST_FOREACH(headers, l, str) { -#define _CONTENT_TYPE_HDR "Content-Type: " -#define _LOCATION_HDR "Location: " - if (!strncmp(str, _LOCATION_HDR, strlen(_LOCATION_HDR))) +#define CONTENT_TYPE_HDR_ "Content-Type: " +#define LOCATION_HDR_ "Location: " + if (!strncmp(str, LOCATION_HDR_, strlen(LOCATION_HDR_))) { unsigned int len; - str += strlen(_LOCATION_HDR); + str += strlen(LOCATION_HDR_); if (*str != '/') { eina_stringshare_del(ty_head->src); @@ -5709,9 +5709,9 @@ _media_http_head_complete(void *data, goto error; } } - else if (!strncmp(str, _CONTENT_TYPE_HDR, strlen(_CONTENT_TYPE_HDR))) + else if (!strncmp(str, CONTENT_TYPE_HDR_, strlen(CONTENT_TYPE_HDR_))) { - str += strlen(_CONTENT_TYPE_HDR); + str += strlen(CONTENT_TYPE_HDR_); if (!strncmp(str, "image/", strlen("image/"))) { type = MEDIA_TYPE_IMG; @@ -5726,8 +5726,8 @@ _media_http_head_complete(void *data, break; } } -#undef _CONTENT_TYPE_HDR -#undef _LOCATION_HDR +#undef CONTENT_TYPE_HDR_ +#undef LOCATION_HDR_ } if (type == MEDIA_TYPE_UNKNOWN) goto error;