Mercurial > vim
diff src/vim9type.c @ 35032:eeab9c4c801b v9.1.0367
patch 9.1.0367: compile_def_function is too long
Commit: https://github.com/vim/vim/commit/a16f251333e324c94ca8e3e92d1fcf3193dfa382
Author: Yegappan Lakshmanan <yegappan@yahoo.com>
Date: Tue Apr 23 20:14:46 2024 +0200
patch 9.1.0367: compile_def_function is too long
Problem: compile_def_function is too long
Solution: Move out the code to compile the body of a function
(Yegappan Lakshmanan)
closes: #14622
Signed-off-by: Yegappan Lakshmanan <yegappan@yahoo.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Tue, 23 Apr 2024 20:30:09 +0200 |
parents | 6dca41acb99c |
children | 30cc85d355c1 |
line wrap: on
line diff
--- a/src/vim9type.c +++ b/src/vim9type.c @@ -1894,14 +1894,12 @@ type_name_list_or_dict(char *name, type_ size_t len = STRLEN(name) + STRLEN(member_name) + 3; *tofree = alloc(len); - if (*tofree != NULL) - { - vim_snprintf(*tofree, len, "%s<%s>", name, member_name); - vim_free(member_free); - return *tofree; - } + if (*tofree == NULL) + return name; - return name; + vim_snprintf(*tofree, len, "%s<%s>", name, member_name); + vim_free(member_free); + return *tofree; } /* @@ -1924,17 +1922,15 @@ type_name_class_or_obj(char *name, type_ size_t len = STRLEN(name) + STRLEN(class_name) + 3; *tofree = alloc(len); - if (*tofree != NULL) - { - vim_snprintf(*tofree, len, "%s<%s>", name, class_name); - return *tofree; - } + if (*tofree == NULL) + return name; - return name; + vim_snprintf(*tofree, len, "%s<%s>", name, class_name); + return *tofree; } /* - * Return the type name of a functio. + * Return the type name of a function. * The result may be in allocated memory, in which case "tofree" is set. */ static char *