]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.2.0286: still some unnecessary (int) casts in alloc() v9.2.0286
authorYasuhiro Matsumoto <mattn.jp@gmail.com>
Fri, 3 Apr 2026 08:39:11 +0000 (08:39 +0000)
committerChristian Brabandt <cb@256bit.org>
Fri, 3 Apr 2026 08:39:11 +0000 (08:39 +0000)
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 <mattn.jp@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
src/netbeans.c
src/version.c
src/vim9script.c

index 976a2574a1a73a672bccc9e2865633fd9cbe6fd6..66f563c6cb13fa92d77174c91ccf648cb33c589f 100644 (file)
@@ -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;
 
index ce87898c7f4b79b9607d10f50fdbcf682f368eed..65518999e52075214f03e6137b83994c61b16f7c 100644 (file)
@@ -734,6 +734,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    286,
 /**/
     285,
 /**/
index f9868ee0e68864079fcad488774858dedbf0d4ba..4babbeea2a52f9d4eb46580036528bdfcbcbf0fc 100644 (file)
@@ -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);