patch 9.2.0286: still some unnecessary (int) casts in alloc()
Commit:
https://github.com/vim/vim/commit/28e75c5f3151a900db8bd91744aa4c7f4deb38e9
Author: Yasuhiro Matsumoto <[email protected]>
Date: Fri Apr 3 08:39:11 2026 +0000
patch 9.2.0286: still some unnecessary (int) casts in alloc()
Problem: still some unnecessary (int) casts in alloc()
Solution: Remove more unnecessary (int) casts before alloc() calls
(Yasuhiro Matsumoto).
Follow-up to patch 9.2.0283. Remove remaining (int) casts in
vim9script.c and netbeans.c.
vim9script.c: lengths are derived from STRLEN() on file paths,
bounded by PATH_MAX. netbeans.c: all operands are already int,
so the (int) cast is redundant and no truncation can occur.
related: #19888
closes: #19893
Signed-off-by: Yasuhiro Matsumoto <[email protected]>
Signed-off-by: Christian Brabandt <[email protected]>
diff --git a/src/netbeans.c b/src/netbeans.c
index 976a2574a..66f563c6c 100644
--- a/src/netbeans.c
+++ b/src/netbeans.c
@@ -937,7 +937,7 @@ nb_partialremove(linenr_T lnum, colnr_T first, colnr_T last)
return;
if (lastbyte >= oldlen)
lastbyte = oldlen - 1;
- newtext = alloc(oldlen - (int)(lastbyte - first));
+ newtext = alloc(oldlen - (lastbyte - first));
if (newtext == NULL)
return;
diff --git a/src/version.c b/src/version.c
index ce87898c7..65518999e 100644
--- a/src/version.c
+++ b/src/version.c
@@ -734,6 +734,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 286,
/**/
285,
/**/
diff --git a/src/vim9script.c b/src/vim9script.c
index f9868ee0e..4babbeea2 100644
--- a/src/vim9script.c
+++ b/src/vim9script.c
@@ -460,7 +460,7 @@ handle_import(
{
// Relative to current script: "./name.vim", "../../name.vim".
len = STRLEN(si->sn_name) - STRLEN(tail) + STRLEN(tv.vval.v_string)
+ 2;
- from_name = alloc((int)len);
+ from_name = alloc(len);
if (from_name == NULL)
goto erret;
vim_strncpy(from_name, si->sn_name, tail - si->sn_name);
@@ -485,7 +485,7 @@ handle_import(
char_u *from_name;
// Find file in "autoload" subdirs in 'runtimepath'.
- from_name = alloc((int)len);
+ from_name = alloc(len);
if (from_name == NULL)
goto erret;
vim_snprintf((char *)from_name, len, "autoload/%s", tv.vval.v_string);
@@ -512,7 +512,7 @@ handle_import(
char_u *from_name;
// Find file in "import" subdirs in 'runtimepath'.
- from_name = alloc((int)len);
+ from_name = alloc(len);
if (from_name == NULL)
goto erret;
vim_snprintf((char *)from_name, len, "import/%s", tv.vval.v_string);
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion visit
https://groups.google.com/d/msgid/vim_dev/E1w8a9K-001qex-3j%40256bit.org.