mirror of
https://github.com/neovim/neovim.git
synced 2025-09-19 09:48:19 +00:00
refactor: add function xstrnsave
xstrnsave is a clone of vim_strnsave that uses char* instead of char_u*. Its purpose short-term is to help reduce the number of casts and for long-term to replace vim_strnsave as the need to use char_u is eliminated.
This commit is contained in:
@@ -388,12 +388,12 @@ char *get_exception_string(void *value, except_type_T type, char_u *cmdname, int
|
||||
mesg = ((struct msglist *)value)->throw_msg;
|
||||
if (cmdname != NULL && *cmdname != NUL) {
|
||||
size_t cmdlen = STRLEN(cmdname);
|
||||
ret = (char *)vim_strnsave((char_u *)"Vim(", 4 + cmdlen + 2 + STRLEN(mesg));
|
||||
ret = xstrnsave("Vim(", 4 + cmdlen + 2 + STRLEN(mesg));
|
||||
STRCPY(&ret[4], cmdname);
|
||||
STRCPY(&ret[4 + cmdlen], "):");
|
||||
val = ret + 4 + cmdlen + 2;
|
||||
} else {
|
||||
ret = (char *)vim_strnsave((char_u *)"Vim:", 4 + STRLEN(mesg));
|
||||
ret = xstrnsave("Vim:", 4 + STRLEN(mesg));
|
||||
val = ret + 4;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user