patch 9.2.0029: STRLEN() used for a string literal

Problem:  STRLEN() used for a string literal
Solution: Use STRLEN_LITERAL instead (Yasuhiro Matsumoto).

closes: #19450

Signed-off-by: Yasuhiro Matsumoto <mattn.jp@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
Yasuhiro Matsumoto
2026-02-19 16:55:39 +00:00
committed by Christian Brabandt
parent 342ae5f8aa
commit d673411ff2
6 changed files with 18 additions and 16 deletions
+1 -1
View File
@@ -3756,7 +3756,7 @@ ch_close_part_on_error(
// Only send "DETACH" for a netbeans channel.
if (channel->ch_nb_close_cb != NULL)
channel_save(channel, PART_SOCK, (char_u *)DETACH_MSG_RAW,
(int)STRLEN(DETACH_MSG_RAW), FALSE, "PUT ");
(int)STRLEN_LITERAL(DETACH_MSG_RAW), FALSE, "PUT ");
// When reading is not possible close this part of the channel. Don't
// close the channel yet, there may be something to read on another part.
+3 -3
View File
@@ -8185,7 +8185,7 @@ gui_mch_tearoff(
if (submenuWidth != 0)
{
submenuWidth = GetTextWidth(hdc, (char_u *)TEAROFF_SUBMENU_LABEL,
(int)STRLEN(TEAROFF_SUBMENU_LABEL));
(int)STRLEN_LITERAL(TEAROFF_SUBMENU_LABEL));
textWidth += submenuWidth;
}
dlgwidth = GetTextWidthEnc(hdc, title, (int)STRLEN(title));
@@ -8308,7 +8308,7 @@ gui_mch_tearoff(
}
else
{
len += (int)STRLEN(TEAROFF_SUBMENU_LABEL);
len += (int)STRLEN_LITERAL(TEAROFF_SUBMENU_LABEL);
menuID = (WORD)((long_u)(menu->submenu_id) | (DWORD)0x8000);
}
@@ -8333,7 +8333,7 @@ gui_mch_tearoff(
if (menu->children != NULL)
{
STRCPY(text, TEAROFF_SUBMENU_LABEL);
text += STRLEN(TEAROFF_SUBMENU_LABEL);
text += STRLEN_LITERAL(TEAROFF_SUBMENU_LABEL);
}
else
{
+7 -7
View File
@@ -1857,7 +1857,7 @@ prt_open_resource(struct prt_ps_resource_S *resource)
offset = 0;
if (prt_resfile_strncmp(offset, PRT_RESOURCE_HEADER,
(int)STRLEN(PRT_RESOURCE_HEADER)) != 0)
(int)STRLEN_LITERAL(PRT_RESOURCE_HEADER)) != 0)
{
semsg(_(e_file_str_is_not_postscript_resource_file),
resource->filename);
@@ -1865,7 +1865,7 @@ prt_open_resource(struct prt_ps_resource_S *resource)
}
// Skip over any version numbers and following ws
offset += (int)STRLEN(PRT_RESOURCE_HEADER);
offset += (int)STRLEN_LITERAL(PRT_RESOURCE_HEADER);
offset = prt_resfile_skip_nonws(offset);
if (offset == -1)
return FALSE;
@@ -1874,23 +1874,23 @@ prt_open_resource(struct prt_ps_resource_S *resource)
return FALSE;
if (prt_resfile_strncmp(offset, PRT_RESOURCE_RESOURCE,
(int)STRLEN(PRT_RESOURCE_RESOURCE)) != 0)
(int)STRLEN_LITERAL(PRT_RESOURCE_RESOURCE)) != 0)
{
semsg(_(e_file_str_is_not_supported_postscript_resource_file),
resource->filename);
return FALSE;
}
offset += (int)STRLEN(PRT_RESOURCE_RESOURCE);
offset += (int)STRLEN_LITERAL(PRT_RESOURCE_RESOURCE);
// Decide type of resource in the file
if (prt_resfile_strncmp(offset, PRT_RESOURCE_PROCSET,
(int)STRLEN(PRT_RESOURCE_PROCSET)) == 0)
(int)STRLEN_LITERAL(PRT_RESOURCE_PROCSET)) == 0)
resource->type = PRT_RESOURCE_TYPE_PROCSET;
else if (prt_resfile_strncmp(offset, PRT_RESOURCE_ENCODING,
(int)STRLEN(PRT_RESOURCE_ENCODING)) == 0)
(int)STRLEN_LITERAL(PRT_RESOURCE_ENCODING)) == 0)
resource->type = PRT_RESOURCE_TYPE_ENCODING;
else if (prt_resfile_strncmp(offset, PRT_RESOURCE_CMAP,
(int)STRLEN(PRT_RESOURCE_CMAP)) == 0)
(int)STRLEN_LITERAL(PRT_RESOURCE_CMAP)) == 0)
resource->type = PRT_RESOURCE_TYPE_CMAP;
else
{
+2 -2
View File
@@ -583,7 +583,7 @@ staterr:
// if filename is a directory, append the cscope database name to it
if (S_ISDIR(statbuf.st_mode))
{
fname2 = alloc(strlen(CSCOPE_DBFILE) + strlen(fname) + 2);
fname2 = alloc(STRLEN_LITERAL(CSCOPE_DBFILE) + strlen(fname) + 2);
if (fname2 == NULL)
goto add_err;
@@ -2166,7 +2166,7 @@ cs_read_prompt(int i)
}
}
for (n = 0; n < (int)strlen(CSCOPE_PROMPT); ++n)
for (n = 0; n < (int)STRLEN_LITERAL(CSCOPE_PROMPT); ++n)
{
if (n > 0)
ch = getc(csinfo[i].fr_fp);
+1 -1
View File
@@ -881,7 +881,7 @@ SendInit(Display *dpy)
// Make window recognizable as a vim window
XChangeProperty(dpy, commWindow, vimProperty, XA_STRING,
8, PropModeReplace, (char_u *)VIM_VERSION_SHORT,
(int)STRLEN(VIM_VERSION_SHORT) + 1);
(int)STRLEN_LITERAL(VIM_VERSION_SHORT) + 1);
XSync(dpy, False);
(void)XSetErrorHandler(old_handler);
+4 -2
View File
@@ -67,8 +67,8 @@ init_longVersion(void)
# endif
char *msg = _("%s (%s, compiled %s)");
size_t len = strlen(msg)
+ strlen(VIM_VERSION_LONG_ONLY)
+ strlen(VIM_VERSION_DATE_ONLY)
+ STRLEN_LITERAL(VIM_VERSION_LONG_ONLY)
+ STRLEN_LITERAL(VIM_VERSION_DATE_ONLY)
+ strlen(date_time);
longVersion = alloc(len);
@@ -734,6 +734,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
29,
/**/
28,
/**/