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 <basilisk@internode.on.net>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
John Marriott
2026-05-12 17:58:21 +00:00
committed by Christian Brabandt
parent 3a9e1bb7e2
commit 8aecd377f0
2 changed files with 10 additions and 16 deletions
+8 -16
View File
@@ -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);
+2
View File
@@ -729,6 +729,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
478,
/**/
477,
/**/