Branch: refs/heads/master Author: Nick Treleaven ntrel002@gmail.com Committer: GitHub noreply@github.com Date: Thu, 27 Apr 2023 15:39:36 UTC Commit: 5c98161a33055c7632e0937e5d830ebf47fdb8fd https://github.com/geany/geany/commit/5c98161a33055c7632e0937e5d830ebf47fdb8...
Log Message: ----------- Refactor tm_parser_format_function: merge double `switch (lang)` (#3463)
* [tm_parser_format_function] Merge double `switch (lang)`
* Update src/tagmanager/tm_parser.c
Co-authored-by: Colomban Wendling lists.ban@herbesfolles.org
---------
Co-authored-by: Colomban Wendling lists.ban@herbesfolles.org
Modified Paths: -------------- src/tagmanager/tm_parser.c
Modified: src/tagmanager/tm_parser.c 47 lines changed, 23 insertions(+), 24 deletions(-) =================================================================== @@ -1555,38 +1555,37 @@ gchar *tm_parser_format_function(TMParserType lang, const gchar *fname, const gc
if (retval) { + const gchar *sep = NULL; + switch (lang) { - case TM_PARSER_GDSCRIPT: - case TM_PARSER_GO: + /* retval after function */ case TM_PARSER_PASCAL: + sep = ": "; + break; + case TM_PARSER_GDSCRIPT: case TM_PARSER_PYTHON: - { - /* retval after function */ - const gchar *sep; - switch (lang) - { - case TM_PARSER_PASCAL: - sep = ": "; - break; - case TM_PARSER_GDSCRIPT: - case TM_PARSER_PYTHON: - sep = " -> "; - break; - default: - sep = " "; - break; - } - g_string_append(str, sep); - g_string_append(str, retval); + sep = " -> "; + break; + case TM_PARSER_GO: + sep = " "; break; - } default: - /* retval before function */ - g_string_prepend_c(str, ' '); - g_string_prepend(str, retval); break; } + + if (sep) + { + /* retval after function */ + g_string_append(str, sep); + g_string_append(str, retval); + } + else + { + /* retval before function */ + g_string_prepend_c(str, ' '); + g_string_prepend(str, retval); + } }
return g_string_free(str, FALSE);
-------------- This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).