This PR changes some more calls in various source files from ga_concat() to ga_concat_len() where the length is known or can be calculated.
In addition:
In clientserver.c, in function build_drop_cmd() use a string_T for the strings cdp and wig for use in ga_concat_len().
In list.c, in function list_join_inner() use a string_T for the string s for use in ga_concat_len(). Also, change local struct join_T to use string_T.
Cheers
John
https://github.com/vim/vim/pull/19422
(4 files)
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
You shouldn't have to specify the literal size directly. Use STRLEN_LITERAL().
ga_concat_len(&ga, (char_u *)"<C-\\><C-N>:cd ", STRLEN_LITERAL("<C-\\><C-N>:cd "));
If writing the literal twice is cumbersome, define a macro. like this:
diff --git a/src/clientserver.c b/src/clientserver.c index 6eed68f3c..ceca3cb56 100644 --- a/src/clientserver.c +++ b/src/clientserver.c @@ -716,7 +716,7 @@ build_drop_cmd( return NULL; cdp.length = STRLEN(cdp.string); ga_init2(&ga, 1, 100); - ga_concat_len(&ga, (char_u *)"<C-\\><C-N>:cd ", 14); + GA_CONCAT_LITERAL(&ga, "<C-\\><C-N>:cd "); ga_concat_len(&ga, cdp.string, cdp.length); // reset wildignorecase temporarily ga_concat_len(&ga, (char_u *)wig[0].string, wig[0].length); diff --git a/src/vim.h b/src/vim.h index bd8b4a5d6..2c36e82c6 100644 --- a/src/vim.h +++ b/src/vim.h @@ -3092,4 +3092,6 @@ long elapsed(DWORD start_tick); #define CF_INTERFACE 2 // inside an interface #define CF_ABSTRACT_METHOD 4 // inside an abstract class +#define GA_CONCAT_LITERAL(gap,s) ga_concat_len((gap), (char_u *)(s), STRLEN_LITERAL(s)) + #endif // VIM__H
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()