diff options
author | Campbell Barton <ideasman42@gmail.com> | 2020-11-06 04:30:59 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2020-11-06 04:32:54 +0300 |
commit | aa3a4973a30ff668a62447e18ac41f6c916b4a8b (patch) | |
tree | 1b24cc55995ba8b3d72aaabd9400a3e1e030d540 /source/blender/editors/space_text | |
parent | 7cb20d841da16d0bffb63154403267500e9941f5 (diff) |
Cleanup: use ELEM macro
Diffstat (limited to 'source/blender/editors/space_text')
7 files changed, 12 insertions, 12 deletions
diff --git a/source/blender/editors/space_text/text_draw.c b/source/blender/editors/space_text/text_draw.c index d3e6fd8f79c..2c9ea1d6afa 100644 --- a/source/blender/editors/space_text/text_draw.c +++ b/source/blender/editors/space_text/text_draw.c @@ -285,7 +285,7 @@ void wrap_offset( end += max; chop = 1; } - else if (ch == ' ' || ch == '-') { + else if (ELEM(ch, ' ', '-')) { end = i + 1; chop = 0; if (linep == linein && i >= cursin) { @@ -362,7 +362,7 @@ void wrap_offset_in_line( end += max; chop = 1; } - else if (ch == ' ' || ch == '-') { + else if (ELEM(ch, ' ', '-')) { end = i + 1; chop = 0; if (i >= cursin) { @@ -483,7 +483,7 @@ static int text_draw_wrapped(const SpaceText *st, break; } } - else if (str[mi] == ' ' || str[mi] == '-') { + else if (ELEM(str[mi], ' ', '-')) { wrap = i + 1; mend = mi + 1; } @@ -820,7 +820,7 @@ int text_get_visible_lines(const SpaceText *st, ARegion *region, const char *str start = MIN2(end, i); end += max; } - else if (ch == ' ' || ch == '-') { + else if (ELEM(ch, ' ', '-')) { end = i + 1; } diff --git a/source/blender/editors/space_text/text_format_lua.c b/source/blender/editors/space_text/text_format_lua.c index 4f6d91451e0..16eb66624ce 100644 --- a/source/blender/editors/space_text/text_format_lua.c +++ b/source/blender/editors/space_text/text_format_lua.c @@ -271,7 +271,7 @@ static void txtfmt_lua_format_line(SpaceText *st, TextLine *line, const bool do_ else if (*str == '-' && *(str + 1) == '-') { text_format_fill(&str, &fmt, FMT_TYPE_COMMENT, len - (int)(fmt - line->format)); } - else if (*str == '"' || *str == '\'') { + else if (ELEM(*str, '"', '\'')) { /* Strings */ find = *str; cont = (*str == '"') ? FMT_CONT_QUOTEDOUBLE : FMT_CONT_QUOTESINGLE; diff --git a/source/blender/editors/space_text/text_format_osl.c b/source/blender/editors/space_text/text_format_osl.c index b205996d1d2..1a024779a83 100644 --- a/source/blender/editors/space_text/text_format_osl.c +++ b/source/blender/editors/space_text/text_format_osl.c @@ -292,7 +292,7 @@ static void txtfmt_osl_format_line(SpaceText *st, TextLine *line, const bool do_ str++; *fmt = FMT_TYPE_COMMENT; } - else if (*str == '"' || *str == '\'') { + else if (ELEM(*str, '"', '\'')) { /* Strings */ find = *str; cont = (*str == '"') ? FMT_CONT_QUOTEDOUBLE : FMT_CONT_QUOTESINGLE; diff --git a/source/blender/editors/space_text/text_format_pov.c b/source/blender/editors/space_text/text_format_pov.c index 96d9c234a40..a68632c0d56 100644 --- a/source/blender/editors/space_text/text_format_pov.c +++ b/source/blender/editors/space_text/text_format_pov.c @@ -864,7 +864,7 @@ static void txtfmt_pov_format_line(SpaceText *st, TextLine *line, const bool do_ else if (*str == '/' && *(str + 1) == '/') { text_format_fill(&str, &fmt, FMT_TYPE_COMMENT, len - (int)(fmt - line->format)); } - else if (*str == '"' || *str == '\'') { + else if (ELEM(*str, '"', '\'')) { /* Strings */ find = *str; cont = (*str == '"') ? FMT_CONT_QUOTEDOUBLE : FMT_CONT_QUOTESINGLE; diff --git a/source/blender/editors/space_text/text_format_pov_ini.c b/source/blender/editors/space_text/text_format_pov_ini.c index 8d6b877d3f7..1c6a93d2d7a 100644 --- a/source/blender/editors/space_text/text_format_pov_ini.c +++ b/source/blender/editors/space_text/text_format_pov_ini.c @@ -442,7 +442,7 @@ static void txtfmt_pov_ini_format_line(SpaceText *st, TextLine *line, const bool if (*str == ';') { text_format_fill(&str, &fmt, FMT_TYPE_COMMENT, len - (int)(fmt - line->format)); } - else if (*str == '"' || *str == '\'') { + else if (ELEM(*str, '"', '\'')) { /* Strings */ find = *str; cont = (*str == '"') ? FMT_CONT_QUOTEDOUBLE : FMT_CONT_QUOTESINGLE; diff --git a/source/blender/editors/space_text/text_format_py.c b/source/blender/editors/space_text/text_format_py.c index 39985438462..31177c53d6a 100644 --- a/source/blender/editors/space_text/text_format_py.c +++ b/source/blender/editors/space_text/text_format_py.c @@ -224,7 +224,7 @@ static uint txtfmt_py_numeral_string_count_hexadecimal(const char *string) /* Zeros. */ static bool txtfmt_py_numeral_char_is_zero(const char c) { - return (c == '0') || (c == '_'); + return (ELEM(c, '0', '_')); } static uint txtfmt_py_numeral_string_count_zeros(const char *string) { @@ -408,7 +408,7 @@ static void txtfmt_py_format_line(SpaceText *st, TextLine *line, const bool do_n /* fill the remaining line */ text_format_fill(&str, &fmt, FMT_TYPE_COMMENT, len - (int)(fmt - line->format)); } - else if (*str == '"' || *str == '\'') { + else if (ELEM(*str, '"', '\'')) { /* Strings */ find = *str; cont = (*str == '"') ? FMT_CONT_QUOTEDOUBLE : FMT_CONT_QUOTESINGLE; diff --git a/source/blender/editors/space_text/text_ops.c b/source/blender/editors/space_text/text_ops.c index 7c592519384..1814846c76f 100644 --- a/source/blender/editors/space_text/text_ops.c +++ b/source/blender/editors/space_text/text_ops.c @@ -1722,7 +1722,7 @@ static int text_get_cursor_rel( loop = 0; break; } - else if (ch == ' ' || ch == '-') { + else if (ELEM(ch, ' ', '-')) { if (found) { loop = 0; break; @@ -1987,7 +1987,7 @@ static void txt_wrap_move_eol(SpaceText *st, ARegion *region, const bool sel) loop = 0; break; } - else if (ch == ' ' || ch == '-') { + else if (ELEM(ch, ' ', '-')) { end = i + 1; endj = j; chop = 0; |