patch 9.2.0478: channel: redundant str/length assignments in channel_part_info()
Commit:
https://github.com/vim/vim/commit/8aecd377f08e9fbdf0092478ab7ec3ce5e0f04ec
Author: John Marriott <
basi...@internode.on.net>
Date: Tue May 12 17:58:21 2026 +0000
patch 9.2.0478: channel: redundant str/length assignments in channel_part_info()
Problem: channel: redundant str/length assignments in channel_part_info
Solution: Use the STR_LITERAL_SET() macro (John Marriott)
closes: #20199
Signed-off-by: John Marriott <
basi...@internode.on.net>
Signed-off-by: Christian Brabandt <
c...@256bit.org>
diff --git a/src/channel.c b/src/channel.c
index e703a8208..579087b37 100644
--- a/src/channel.c
+++ b/src/channel.c
@@ -3708,35 +3708,27 @@ channel_part_info(channel_T *channel, dict_T *dict, char *name, ch_part_T part)
STRCPY(namebuf + tail, "io");
if (part == PART_SOCK)
- {
- s.string = (char_u *)"socket";
- s.length = STRLEN_LITERAL("socket");
- }
+ STR_LITERAL_SET(s, "socket");
else switch (chanpart->ch_io)
{
case JIO_NULL:
- s.string = (char_u *)"null";
- s.length = STRLEN_LITERAL("null");
+ STR_LITERAL_SET(s, "null");
break;
case JIO_PIPE:
- s.string = (char_u *)"pipe";
- s.length = STRLEN_LITERAL("pipe");
+ STR_LITERAL_SET(s, "pipe");
break;
case JIO_FILE:
- s.string = (char_u *)"file";
- s.length = STRLEN_LITERAL("file");
+ STR_LITERAL_SET(s, "file");
break;
case JIO_BUFFER:
- s.string = (char_u *)"buffer";
- s.length = STRLEN_LITERAL("buffer");
+ STR_LITERAL_SET(s, "buffer");
break;
case JIO_OUT:
- s.string = (char_u *)"out";
- s.length = STRLEN_LITERAL("out");
+ STR_LITERAL_SET(s, "out");
break;
default:
- s.string = (char_u *)"";
- s.length = 0;
+ STR_LITERAL_SET(s, "");
+ break;
}
dict_add_string_len(dict, namebuf, s.string, (int)s.length);
diff --git a/src/version.c b/src/version.c
index d52a2c468..8f46a438d 100644
--- a/src/version.c
+++ b/src/version.c
@@ -729,6 +729,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 478,
/**/
477,
/**/