To: vim_dev@googlegroups.com Subject: Patch 8.2.0967 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.0967 Problem: Unnecessary type casts for vim_strnsave(). Solution: Remove the type casts. Files: src/evalvars.c, src/ex_cmds.c, src/ex_eval.c, src/fileio.c, src/filepath.c, src/findfile.c, src/highlight.c, src/if_ruby.c, src/insexpand.c, src/json.c, src/mark.c, src/memline.c, src/menu.c, src/misc1.c, src/ops.c, src/os_win32.c, src/regexp.c, src/regexp_bt.c, src/regexp_nfa.c, src/register.c, src/search.c, src/sign.c, src/syntax.c, src/term.c, src/terminal.c, src/undo.c, src/usercmd.c, src/userfunc.c, src/vim9compile.c, src/if_perl.xs *** ../vim-8.2.0966/src/evalvars.c 2020-06-11 23:10:42.122363543 +0200 --- src/evalvars.c 2020-06-12 22:43:38.886018320 +0200 *************** *** 2534,2540 **** } else { ! p = vim_strnsave(name, (int)len); if (p == NULL) return NULL; } --- 2534,2540 ---- } else { ! p = vim_strnsave(name, len); if (p == NULL) return NULL; } *** ../vim-8.2.0966/src/ex_cmds.c 2020-06-10 14:16:30.098988403 +0200 --- src/ex_cmds.c 2020-06-12 22:43:54.237950680 +0200 *************** *** 3221,3227 **** p = vim_strchr(eap->nextcmd, NL); if (p == NULL) p = eap->nextcmd + STRLEN(eap->nextcmd); ! theline = vim_strnsave(eap->nextcmd, (int)(p - eap->nextcmd)); if (*p != NUL) ++p; eap->nextcmd = p; --- 3221,3227 ---- p = vim_strchr(eap->nextcmd, NL); if (p == NULL) p = eap->nextcmd + STRLEN(eap->nextcmd); ! theline = vim_strnsave(eap->nextcmd, p - eap->nextcmd); if (*p != NUL) ++p; eap->nextcmd = p; *** ../vim-8.2.0966/src/ex_eval.c 2020-05-25 22:36:46.629735032 +0200 --- src/ex_eval.c 2020-06-12 22:44:40.325747230 +0200 *************** *** 439,445 **** { cmdlen = (int)STRLEN(cmdname); ret = (char *)vim_strnsave((char_u *)"Vim(", ! 4 + cmdlen + 2 + (int)STRLEN(mesg)); if (ret == NULL) return ret; STRCPY(&ret[4], cmdname); --- 439,445 ---- { cmdlen = (int)STRLEN(cmdname); ret = (char *)vim_strnsave((char_u *)"Vim(", ! 4 + cmdlen + 2 + STRLEN(mesg)); if (ret == NULL) return ret; STRCPY(&ret[4], cmdname); *************** *** 448,454 **** } else { ! ret = (char *)vim_strnsave((char_u *)"Vim:", 4 + (int)STRLEN(mesg)); if (ret == NULL) return ret; val = ret + 4; --- 448,454 ---- } else { ! ret = (char *)vim_strnsave((char_u *)"Vim:", 4 + STRLEN(mesg)); if (ret == NULL) return ret; val = ret + 4; *************** *** 806,812 **** if (pending & CSTP_THROW) { vim_snprintf((char *)IObuff, IOSIZE, mesg, _("Exception")); ! mesg = (char *)vim_strnsave(IObuff, (int)STRLEN(IObuff) + 4); STRCAT(mesg, ": %s"); s = (char *)((except_T *)value)->value; } --- 806,812 ---- if (pending & CSTP_THROW) { vim_snprintf((char *)IObuff, IOSIZE, mesg, _("Exception")); ! mesg = (char *)vim_strnsave(IObuff, STRLEN(IObuff) + 4); STRCAT(mesg, ": %s"); s = (char *)((except_T *)value)->value; } *** ../vim-8.2.0966/src/fileio.c 2020-06-12 22:30:57.629228449 +0200 --- src/fileio.c 2020-06-12 22:44:48.513711024 +0200 *************** *** 2724,2730 **** } else { ! r = vim_strnsave(*pp, (int)(p - *pp)); *pp = p + 1; if (r != NULL) { --- 2724,2730 ---- } else { ! r = vim_strnsave(*pp, p - *pp); *pp = p + 1; if (r != NULL) { *** ../vim-8.2.0966/src/filepath.c 2020-06-10 13:12:25.071026049 +0200 --- src/filepath.c 2020-06-12 22:45:50.457436608 +0200 *************** *** 389,395 **** if (mch_isdir(*fnamep)) { // Make room for one or two extra characters. ! *fnamep = vim_strnsave(*fnamep, (int)STRLEN(*fnamep) + 2); vim_free(*bufp); // free any allocated file name *bufp = *fnamep; if (*fnamep == NULL) --- 389,395 ---- if (mch_isdir(*fnamep)) { // Make room for one or two extra characters. ! *fnamep = vim_strnsave(*fnamep, STRLEN(*fnamep) + 2); vim_free(*bufp); // free any allocated file name *bufp = *fnamep; if (*fnamep == NULL) *************** *** 655,661 **** p = vim_strchr(s, sep); if (p != NULL) { ! pat = vim_strnsave(s, (int)(p - s)); if (pat != NULL) { s = p + 1; --- 655,661 ---- p = vim_strchr(s, sep); if (p != NULL) { ! pat = vim_strnsave(s, p - s); if (pat != NULL) { s = p + 1; *************** *** 663,669 **** p = vim_strchr(s, sep); if (p != NULL) { ! sub = vim_strnsave(s, (int)(p - s)); str = vim_strnsave(*fnamep, *fnamelen); if (sub != NULL && str != NULL) { --- 663,669 ---- p = vim_strchr(s, sep); if (p != NULL) { ! sub = vim_strnsave(s, p - s); str = vim_strnsave(*fnamep, *fnamelen); if (sub != NULL && str != NULL) { *************** *** 1296,1302 **** return OK; // If the directory exists we're done. Otherwise: create it. ! updir = vim_strnsave(dir, (int)(p - dir)); if (updir == NULL) return FAIL; if (mch_isdir(updir)) --- 1296,1302 ---- return OK; // If the directory exists we're done. Otherwise: create it. ! updir = vim_strnsave(dir, p - dir); if (updir == NULL) return FAIL; if (mch_isdir(updir)) *************** *** 1594,1600 **** --prevlen; } if (prevlen == 0) ! s = vim_strnsave(start, (int)len); else { // Change "prev" buffer to be the right size. This way --- 1594,1600 ---- --prevlen; } if (prevlen == 0) ! s = vim_strnsave(start, len); else { // Change "prev" buffer to be the right size. This way *************** *** 3037,3043 **** int i; // Create the command: lop off the backticks. ! cmd = vim_strnsave(pat + 1, (int)STRLEN(pat) - 2); if (cmd == NULL) return -1; --- 3037,3043 ---- int i; // Create the command: lop off the backticks. ! cmd = vim_strnsave(pat + 1, STRLEN(pat) - 2); if (cmd == NULL) return -1; *** ../vim-8.2.0966/src/findfile.c 2020-04-12 19:37:13.510297280 +0200 --- src/findfile.c 2020-06-12 22:46:16.317321784 +0200 *************** *** 451,457 **** if (walker) { search_ctx->ffsc_stopdirs_v[dircount-1] = ! vim_strnsave(helper, (int)(walker - helper)); walker++; } else --- 451,457 ---- if (walker) { search_ctx->ffsc_stopdirs_v[dircount-1] = ! vim_strnsave(helper, walker - helper); walker++; } else *************** *** 484,490 **** char *errpt; // save the fix part of the path ! search_ctx->ffsc_fix_path = vim_strnsave(path, (int)(wc_part - path)); /* * copy wc_path and add restricts to the '**' wildcard. --- 484,490 ---- char *errpt; // save the fix part of the path ! search_ctx->ffsc_fix_path = vim_strnsave(path, wc_part - path); /* * copy wc_path and add restricts to the '**' wildcard. *** ../vim-8.2.0966/src/highlight.c 2020-06-07 20:49:02.077891881 +0200 --- src/highlight.c 2020-06-12 22:46:59.641129105 +0200 *************** *** 963,969 **** break; } vim_free(arg); ! arg = vim_strnsave(arg_start, (int)(linep - arg_start)); if (arg == NULL) { error = TRUE; --- 963,969 ---- break; } vim_free(arg); ! arg = vim_strnsave(arg_start, linep - arg_start); if (arg == NULL) { error = TRUE; *************** *** 5003,5009 **** { p = skiptowhite(eap->arg); if (!eap->skip) ! g = vim_strnsave(eap->arg, (int)(p - eap->arg)); p = skipwhite(p); if (*p == NUL) { --- 5003,5009 ---- { p = skiptowhite(eap->arg); if (!eap->skip) ! g = vim_strnsave(eap->arg, p - eap->arg); p = skipwhite(p); if (*p == NUL) { *** ../vim-8.2.0966/src/if_ruby.c 2020-05-30 20:30:42.892816571 +0200 --- src/if_ruby.c 2020-06-12 22:47:16.445054281 +0200 *************** *** 1858,1864 **** rettv->v_type = VAR_STRING; rettv->vval.v_string = vim_strnsave((char_u *)RSTRING_PTR(str), ! (int)RSTRING_LEN(str)); } break; case T_ARRAY: --- 1858,1864 ---- rettv->v_type = VAR_STRING; rettv->vval.v_string = vim_strnsave((char_u *)RSTRING_PTR(str), ! RSTRING_LEN(str)); } break; case T_ARRAY: *** ../vim-8.2.0966/src/insexpand.c 2020-05-13 22:44:18.142288807 +0200 --- src/insexpand.c 2020-06-12 22:47:57.572870991 +0200 *************** *** 1579,1585 **** ins_compl_restart(); vim_free(compl_leader); ! compl_leader = vim_strnsave(line + compl_col, (int)(p - line) - compl_col); if (compl_leader != NULL) { ins_compl_new_leader(); --- 1579,1585 ---- ins_compl_restart(); vim_free(compl_leader); ! compl_leader = vim_strnsave(line + compl_col, (p - line) - compl_col); if (compl_leader != NULL) { ins_compl_new_leader(); *************** *** 1706,1712 **** { vim_free(compl_leader); compl_leader = vim_strnsave(ml_get_curline() + compl_col, ! (int)(curwin->w_cursor.col - compl_col)); if (compl_leader != NULL) ins_compl_new_leader(); } --- 1706,1712 ---- { vim_free(compl_leader); compl_leader = vim_strnsave(ml_get_curline() + compl_col, ! curwin->w_cursor.col - compl_col); if (compl_leader != NULL) ins_compl_new_leader(); } *** ../vim-8.2.0966/src/json.c 2020-05-19 22:38:55.608777143 +0200 --- src/json.c 2020-06-12 22:48:18.268778642 +0200 *************** *** 662,668 **** if (cur_item != NULL) { cur_item->v_type = VAR_STRING; ! cur_item->vval.v_string = vim_strnsave(key, (int)(p - key)); top_item->jd_key = cur_item->vval.v_string; } reader->js_used += (int)(p - key); --- 662,668 ---- if (cur_item != NULL) { cur_item->v_type = VAR_STRING; ! cur_item->vval.v_string = vim_strnsave(key, p - key); top_item->jd_key = cur_item->vval.v_string; } reader->js_used += (int)(p - key); *** ../vim-8.2.0966/src/mark.c 2020-06-01 14:14:40.691899742 +0200 --- src/mark.c 2020-06-12 22:48:36.888695498 +0200 *************** *** 680,686 **** if (mp->lnum == 0 || mp->lnum > curbuf->b_ml.ml_line_count) return vim_strsave((char_u *)"-invalid-"); // Allow for up to 5 bytes per character. ! s = vim_strnsave(skipwhite(ml_get(mp->lnum)), (int)Columns * 5); if (s == NULL) return NULL; // Truncate the line to fit it in the window. --- 680,686 ---- if (mp->lnum == 0 || mp->lnum > curbuf->b_ml.ml_line_count) return vim_strsave((char_u *)"-invalid-"); // Allow for up to 5 bytes per character. ! s = vim_strnsave(skipwhite(ml_get(mp->lnum)), Columns * 5); if (s == NULL) return NULL; // Truncate the line to fit it in the window. *** ../vim-8.2.0966/src/memline.c 2020-05-30 20:30:42.896816552 +0200 --- src/memline.c 2020-06-12 22:48:52.752624617 +0200 *************** *** 1375,1381 **** #endif for (p = b0p->b0_fname + fnsize; p > b0p->b0_fname && p[-1] != NUL; --p) ; ! b0_fenc = vim_strnsave(p, (int)(b0p->b0_fname + fnsize - p)); } mf_put(mfp, hp, FALSE, FALSE); // release block 0 --- 1375,1381 ---- #endif for (p = b0p->b0_fname + fnsize; p > b0p->b0_fname && p[-1] != NUL; --p) ; ! b0_fenc = vim_strnsave(p, b0p->b0_fname + fnsize - p); } mf_put(mfp, hp, FALSE, FALSE); // release block 0 *** ../vim-8.2.0966/src/menu.c 2020-04-20 22:42:28.232964333 +0200 --- src/menu.c 2020-06-12 22:49:13.236533050 +0200 *************** *** 1810,1816 **** { if (actext != NULL) *actext = vim_strsave(p + 1); ! text = vim_strnsave(str, (int)(p - str)); } else text = vim_strsave(str); --- 1810,1816 ---- { if (actext != NULL) *actext = vim_strsave(p + 1); ! text = vim_strnsave(str, p - str); } else text = vim_strsave(str); *************** *** 2716,2722 **** if (from != NULL) { from_noamp = menu_text(from, NULL, NULL); ! to = vim_strnsave(to, (int)(arg - to)); if (from_noamp != NULL && to != NULL) { menu_translate_tab_and_shift(from); --- 2716,2722 ---- if (from != NULL) { from_noamp = menu_text(from, NULL, NULL); ! to = vim_strnsave(to, arg - to); if (from_noamp != NULL && to != NULL) { menu_translate_tab_and_shift(from); *** ../vim-8.2.0966/src/misc1.c 2020-06-10 15:45:54.496849260 +0200 --- src/misc1.c 2020-06-12 22:49:51.752360689 +0200 *************** *** 1795,1801 **** if (p == exe_name || p == p_hf) #endif // check that the result is a directory name ! p = vim_strnsave(p, (int)(pend - p)); if (p != NULL && !mch_isdir(p)) VIM_CLEAR(p); --- 1795,1801 ---- if (p == exe_name || p == p_hf) #endif // check that the result is a directory name ! p = vim_strnsave(p, pend - p); if (p != NULL && !mch_isdir(p)) VIM_CLEAR(p); *************** *** 2576,2582 **** #ifdef MSWIN p = gettail(p_sh); ! p = vim_strnsave(p, (int)(skiptowhite(p) - p)); #else p = skiptowhite(p_sh); if (*p == NUL) --- 2576,2582 ---- #ifdef MSWIN p = gettail(p_sh); ! p = vim_strnsave(p, skiptowhite(p) - p); #else p = skiptowhite(p_sh); if (*p == NUL) *************** *** 2593,2599 **** for (p2 = p_sh; p2 < p; MB_PTR_ADV(p2)) if (vim_ispathsep(*p2)) p1 = p2 + 1; ! p = vim_strnsave(p1, (int)(p - p1)); } #endif return p; --- 2593,2599 ---- for (p2 = p_sh; p2 < p; MB_PTR_ADV(p2)) if (vim_ispathsep(*p2)) p1 = p2 + 1; ! p = vim_strnsave(p1, p - p1); } #endif return p; *** ../vim-8.2.0966/src/ops.c 2020-06-12 20:19:37.972526321 +0200 --- src/ops.c 2020-06-12 22:50:05.076301007 +0200 *************** *** 1616,1622 **** if (pre_textlen >= 0 && (ins_len = (long)STRLEN(firstline) - pre_textlen) > 0) { ! ins_text = vim_strnsave(firstline, (int)ins_len); if (ins_text != NULL) { // block handled here --- 1616,1622 ---- if (pre_textlen >= 0 && (ins_len = (long)STRLEN(firstline) - pre_textlen) > 0) { ! ins_text = vim_strnsave(firstline, ins_len); if (ins_text != NULL) { // block handled here *** ../vim-8.2.0966/src/os_win32.c 2020-05-30 18:37:51.031344270 +0200 --- src/os_win32.c 2020-06-12 22:50:18.600240420 +0200 *************** *** 477,484 **** if (exe_path == NULL && exe_name != NULL) { ! exe_path = vim_strnsave(exe_name, ! (int)(gettail_sep(exe_name) - exe_name)); if (exe_path != NULL) { // Append our starting directory to $PATH, so that when doing --- 477,483 ---- if (exe_path == NULL && exe_name != NULL) { ! exe_path = vim_strnsave(exe_name, gettail_sep(exe_name) - exe_name); if (exe_path != NULL) { // Append our starting directory to $PATH, so that when doing *** ../vim-8.2.0966/src/regexp.c 2020-04-20 19:42:06.590078519 +0200 --- src/regexp.c 2020-06-12 22:50:40.188143663 +0200 *************** *** 1846,1852 **** if (s == NULL || rsm.sm_match->endp[i] == NULL) s = NULL; else ! s = vim_strnsave(s, (int)(rsm.sm_match->endp[i] - s)); li->li_tv.v_type = VAR_STRING; li->li_tv.vval.v_string = s; li = li->li_next; --- 1846,1852 ---- if (s == NULL || rsm.sm_match->endp[i] == NULL) s = NULL; else ! s = vim_strnsave(s, rsm.sm_match->endp[i] - s); li->li_tv.v_type = VAR_STRING; li->li_tv.vval.v_string = s; li = li->li_next; *************** *** 2462,2468 **** if (s == NULL || rsm.sm_match->endp[no] == NULL) retval = NULL; else ! retval = vim_strnsave(s, (int)(rsm.sm_match->endp[no] - s)); } return retval; --- 2462,2468 ---- if (s == NULL || rsm.sm_match->endp[no] == NULL) retval = NULL; else ! retval = vim_strnsave(s, rsm.sm_match->endp[no] - s); } return retval; *** ../vim-8.2.0966/src/regexp_bt.c 2020-04-12 19:37:13.522297249 +0200 --- src/regexp_bt.c 2020-06-12 22:50:59.300057957 +0200 *************** *** 4588,4594 **** if (reg_startzp[i] != NULL && reg_endzp[i] != NULL) re_extmatch_out->matches[i] = vim_strnsave(reg_startzp[i], ! (int)(reg_endzp[i] - reg_startzp[i])); } } } --- 4588,4594 ---- if (reg_startzp[i] != NULL && reg_endzp[i] != NULL) re_extmatch_out->matches[i] = vim_strnsave(reg_startzp[i], ! reg_endzp[i] - reg_startzp[i]); } } } *** ../vim-8.2.0966/src/regexp_nfa.c 2020-06-09 19:34:51.485836791 +0200 --- src/regexp_nfa.c 2020-06-12 22:51:16.679979957 +0200 *************** *** 7103,7110 **** if (lpos->start != NULL && lpos->end != NULL) re_extmatch_out->matches[i] = ! vim_strnsave(lpos->start, ! (int)(lpos->end - lpos->start)); } } } --- 7103,7109 ---- if (lpos->start != NULL && lpos->end != NULL) re_extmatch_out->matches[i] = ! vim_strnsave(lpos->start, lpos->end - lpos->start); } } } *** ../vim-8.2.0966/src/register.c 2020-06-12 22:08:56.414965077 +0200 --- src/register.c 2020-06-12 22:51:31.503913418 +0200 *************** *** 2655,2661 **** { char_u *p, *s; ! p = vim_strnsave(str, (int)len); if (p == NULL) return; if (must_append && expr_line != NULL) --- 2655,2661 ---- { char_u *p, *s; ! p = vim_strnsave(str, len); if (p == NULL) return; if (must_append && expr_line != NULL) *** ../vim-8.2.0966/src/search.c 2020-06-04 20:55:37.300027492 +0200 --- src/search.c 2020-06-12 22:51:47.511841525 +0200 *************** *** 1916,1922 **** for (p = linep + startpos->col + 1; *p && *p != '('; ++p) ; delim_len = (p - linep) - startpos->col - 1; ! delim_copy = vim_strnsave(linep + startpos->col + 1, (int)delim_len); if (delim_copy == NULL) return FALSE; for (lnum = startpos->lnum; lnum <= endpos->lnum; ++lnum) --- 1916,1922 ---- for (p = linep + startpos->col + 1; *p && *p != '('; ++p) ; delim_len = (p - linep) - startpos->col - 1; ! delim_copy = vim_strnsave(linep + startpos->col + 1, delim_len); if (delim_copy == NULL) return FALSE; for (lnum = startpos->lnum; lnum <= endpos->lnum; ++lnum) *** ../vim-8.2.0966/src/sign.c 2020-04-12 19:37:13.522297249 +0200 --- src/sign.c 2020-06-12 22:52:27.507661771 +0200 *************** *** 1309,1330 **** if (STRNCMP(arg, "icon=", 5) == 0) { arg += 5; ! icon = vim_strnsave(arg, (int)(p - arg)); } else if (STRNCMP(arg, "text=", 5) == 0) { arg += 5; ! text = vim_strnsave(arg, (int)(p - arg)); } else if (STRNCMP(arg, "linehl=", 7) == 0) { arg += 7; ! linehl = vim_strnsave(arg, (int)(p - arg)); } else if (STRNCMP(arg, "texthl=", 7) == 0) { arg += 7; ! texthl = vim_strnsave(arg, (int)(p - arg)); } else { --- 1309,1330 ---- if (STRNCMP(arg, "icon=", 5) == 0) { arg += 5; ! icon = vim_strnsave(arg, p - arg); } else if (STRNCMP(arg, "text=", 5) == 0) { arg += 5; ! text = vim_strnsave(arg, p - arg); } else if (STRNCMP(arg, "linehl=", 7) == 0) { arg += 7; ! linehl = vim_strnsave(arg, p - arg); } else if (STRNCMP(arg, "texthl=", 7) == 0) { arg += 7; ! texthl = vim_strnsave(arg, p - arg); } else { *** ../vim-8.2.0966/src/syntax.c 2020-06-07 20:49:02.077891881 +0200 --- src/syntax.c 2020-06-12 22:53:44.499315346 +0200 *************** *** 4652,4658 **** arg = skiptowhite(arg); if (gname_start == arg) return NULL; ! gname = vim_strnsave(gname_start, (int)(arg - gname_start)); if (gname == NULL) return NULL; if (STRCMP(gname, "NONE") == 0) --- 4652,4658 ---- arg = skiptowhite(arg); if (gname_start == arg) return NULL; ! gname = vim_strnsave(gname_start, arg - gname_start); if (gname == NULL) return NULL; if (STRCMP(gname, "NONE") == 0) *************** *** 4662,4668 **** syn_id = syn_name2id(gname); for (i = curwin->w_s->b_syn_patterns.ga_len; --i >= 0; ) if (SYN_ITEMS(curwin->w_s)[i].sp_syn.id == syn_id ! && SYN_ITEMS(curwin->w_s)[i].sp_type == SPTYPE_START) { *opt->sync_idx = i; break; --- 4662,4669 ---- syn_id = syn_name2id(gname); for (i = curwin->w_s->b_syn_patterns.ga_len; --i >= 0; ) if (SYN_ITEMS(curwin->w_s)[i].sp_syn.id == syn_id ! && SYN_ITEMS(curwin->w_s)[i].sp_type ! == SPTYPE_START) { *opt->sync_idx = i; break; *************** *** 5656,5662 **** return NULL; } // store the pattern and compiled regexp program ! if ((ci->sp_pattern = vim_strnsave(arg + 1, (int)(end - arg - 1))) == NULL) return NULL; // Make 'cpoptions' empty, to avoid the 'l' flag --- 5657,5663 ---- return NULL; } // store the pattern and compiled regexp program ! if ((ci->sp_pattern = vim_strnsave(arg + 1, end - arg - 1)) == NULL) return NULL; // Make 'cpoptions' empty, to avoid the 'l' flag *************** *** 5836,5843 **** if (!eap->skip) { // store the pattern and compiled regexp program ! if ((curwin->w_s->b_syn_linecont_pat = vim_strnsave(next_arg + 1, ! (int)(arg_end - next_arg - 1))) == NULL) { finished = TRUE; break; --- 5837,5845 ---- if (!eap->skip) { // store the pattern and compiled regexp program ! if ((curwin->w_s->b_syn_linecont_pat = ! vim_strnsave(next_arg + 1, ! arg_end - next_arg - 1)) == NULL) { finished = TRUE; break; *************** *** 6272,6278 **** // isolate subcommand name for (subcmd_end = arg; ASCII_ISALPHA(*subcmd_end); ++subcmd_end) ; ! subcmd_name = vim_strnsave(arg, (int)(subcmd_end - arg)); if (subcmd_name != NULL) { if (eap->skip) // skip error messages for all subcommands --- 6274,6280 ---- // isolate subcommand name for (subcmd_end = arg; ASCII_ISALPHA(*subcmd_end); ++subcmd_end) ; ! subcmd_name = vim_strnsave(arg, subcmd_end - arg); if (subcmd_name != NULL) { if (eap->skip) // skip error messages for all subcommands *** ../vim-8.2.0966/src/term.c 2020-06-10 12:15:46.827919259 +0200 --- src/term.c 2020-06-12 22:54:06.835214729 +0200 *************** *** 4086,4096 **** } #if defined(MSWIN) && !defined(FEAT_GUI) ! s = vim_strnsave(string, (int)STRLEN(string) + 1); #else # ifdef VIMDLL if (!gui.in_use) ! s = vim_strnsave(string, (int)STRLEN(string) + 1); else # endif s = vim_strsave(string); --- 4086,4096 ---- } #if defined(MSWIN) && !defined(FEAT_GUI) ! s = vim_strnsave(string, STRLEN(string) + 1); #else # ifdef VIMDLL if (!gui.in_use) ! s = vim_strnsave(string, STRLEN(string) + 1); else # endif s = vim_strsave(string); *** ../vim-8.2.0966/src/terminal.c 2020-05-31 16:04:38.558053522 +0200 --- src/terminal.c 2020-06-12 22:54:31.047105594 +0200 *************** *** 3011,3017 **** { case VTERM_PROP_TITLE: strval = vim_strnsave((char_u *)value->string.str, ! (int)value->string.len); if (strval == NULL) break; vim_free(term->tl_title); --- 3011,3017 ---- { case VTERM_PROP_TITLE: strval = vim_strnsave((char_u *)value->string.str, ! value->string.len); if (strval == NULL) break; vim_free(term->tl_title); *************** *** 3073,3079 **** case VTERM_PROP_CURSORCOLOR: strval = vim_strnsave((char_u *)value->string.str, ! (int)value->string.len); if (strval == NULL) break; cursor_color_copy(&term->tl_cursor_color, strval); --- 3073,3079 ---- case VTERM_PROP_CURSORCOLOR: strval = vim_strnsave((char_u *)value->string.str, ! value->string.len); if (strval == NULL) break; cursor_color_copy(&term->tl_cursor_color, strval); *** ../vim-8.2.0966/src/undo.c 2020-05-30 16:17:30.771468466 +0200 --- src/undo.c 2020-06-12 22:54:47.131033056 +0200 *************** *** 849,855 **** { // Use same directory as the ffname, // "dir/name" -> "dir/.name.un~" ! undo_file_name = vim_strnsave(ffname, (int)(STRLEN(ffname) + 5)); if (undo_file_name == NULL) break; p = gettail(undo_file_name); --- 849,855 ---- { // Use same directory as the ffname, // "dir/name" -> "dir/.name.un~" ! undo_file_name = vim_strnsave(ffname, STRLEN(ffname) + 5); if (undo_file_name == NULL) break; p = gettail(undo_file_name); *** ../vim-8.2.0966/src/usercmd.c 2020-04-23 17:07:26.968434279 +0200 --- src/usercmd.c 2020-06-12 22:55:06.646945027 +0200 *************** *** 676,682 **** } if (arg != NULL) ! *compl_arg = vim_strnsave(arg, (int)arglen); # endif return OK; } --- 676,682 ---- } if (arg != NULL) ! *compl_arg = vim_strnsave(arg, arglen); # endif return OK; } *************** *** 939,945 **** { if (ga_grow(gap, 1) != OK) goto fail; ! if ((p = vim_strnsave(name, (int)name_len)) == NULL) goto fail; cmd = USER_CMD_GA(gap, i); --- 939,945 ---- { if (ga_grow(gap, 1) != OK) goto fail; ! if ((p = vim_strnsave(name, name_len)) == NULL) goto fail; cmd = USER_CMD_GA(gap, i); *** ../vim-8.2.0966/src/userfunc.c 2020-06-11 23:10:42.122363543 +0200 --- src/userfunc.c 2020-06-12 22:55:58.750709931 +0200 *************** *** 2699,2705 **** p = skip_type(ret_type); if (p > ret_type) { ! ret_type = vim_strnsave(ret_type, (int)(p - ret_type)); p = skipwhite(p); } else --- 2699,2705 ---- p = skip_type(ret_type); if (p > ret_type) { ! ret_type = vim_strnsave(ret_type, p - ret_type); p = skipwhite(p); } else *************** *** 2972,2983 **** // Ignore leading white space. p = skipwhite(p + 4); heredoc_trimmed = vim_strnsave(theline, ! (int)(skipwhite(theline) - theline)); } if (*p == NUL) skip_until = vim_strsave((char_u *)"."); else ! skip_until = vim_strnsave(p, (int)(skiptowhite(p) - p)); do_concat = FALSE; is_heredoc = TRUE; } --- 2972,2983 ---- // Ignore leading white space. p = skipwhite(p + 4); heredoc_trimmed = vim_strnsave(theline, ! skipwhite(theline) - theline); } if (*p == NUL) skip_until = vim_strsave((char_u *)"."); else ! skip_until = vim_strnsave(p, skiptowhite(p) - p); do_concat = FALSE; is_heredoc = TRUE; } *************** *** 3002,3010 **** // Ignore leading white space. p = skipwhite(p + 4); heredoc_trimmed = vim_strnsave(theline, ! (int)(skipwhite(theline) - theline)); } ! skip_until = vim_strnsave(p, (int)(skiptowhite(p) - p)); do_concat = FALSE; is_heredoc = TRUE; } --- 3002,3010 ---- // Ignore leading white space. p = skipwhite(p + 4); heredoc_trimmed = vim_strnsave(theline, ! skipwhite(theline) - theline); } ! skip_until = vim_strnsave(p, skiptowhite(p) - p); do_concat = FALSE; is_heredoc = TRUE; } *** ../vim-8.2.0966/src/vim9compile.c 2020-05-25 22:36:46.629735032 +0200 --- src/vim9compile.c 2020-06-12 22:57:35.118388909 +0200 *************** *** 1575,1581 **** RETURN_OK_IF_SKIP(cctx); if ((isn = generate_instr(cctx, ISN_STRINGMEMBER)) == NULL) return FAIL; ! isn->isn_arg.string = vim_strnsave(name, (int)len); // check for dict type type = ((type_T **)stack->ga_data)[stack->ga_len - 1]; --- 1575,1581 ---- RETURN_OK_IF_SKIP(cctx); if ((isn = generate_instr(cctx, ISN_STRINGMEMBER)) == NULL) return FAIL; ! isn->isn_arg.string = vim_strnsave(name, len); // check for dict type type = ((type_T **)stack->ga_data)[stack->ga_len - 1]; *************** *** 1671,1677 **** // entries. This is less efficient, but memory is cheap these days. lvar->lv_idx = cctx->ctx_locals_count++; ! lvar->lv_name = vim_strnsave(name, (int)(len == 0 ? STRLEN(name) : len)); lvar->lv_const = isConst; lvar->lv_type = type; --- 1671,1677 ---- // entries. This is less efficient, but memory is cheap these days. lvar->lv_idx = cctx->ctx_locals_count++; ! lvar->lv_name = vim_strnsave(name, len == 0 ? STRLEN(name) : len); lvar->lv_const = isConst; lvar->lv_type = type; *************** *** 4627,4633 **** --p; varlen = p - arg; ! name = vim_strnsave(arg, (int)varlen); if (name == NULL) return NULL; --- 4627,4633 ---- --p; varlen = p - arg; ! name = vim_strnsave(arg, varlen); if (name == NULL) return NULL; *************** *** 6268,6274 **** { if (p > start) { ! generate_PUSHS(cctx, vim_strnsave(start, (int)(p - start))); ++count; } p += 2; --- 6268,6274 ---- { if (p > start) { ! generate_PUSHS(cctx, vim_strnsave(start, p - start)); ++count; } p += 2; *** ../vim-8.2.0966/src/if_perl.xs 2020-05-30 20:30:42.896816552 +0200 --- src/if_perl.xs 2020-06-12 22:57:52.954334036 +0200 *************** *** 1435,1441 **** char_u *str; PerlIOVim * s = PerlIOSelf(f, PerlIOVim); ! str = vim_strnsave((char_u *)vbuf, (int)count); if (str == NULL) return 0; msg_split((char_u *)str, s->attr); --- 1435,1441 ---- char_u *str; PerlIOVim * s = PerlIOSelf(f, PerlIOVim); ! str = vim_strnsave((char_u *)vbuf, count); if (str == NULL) return 0; msg_split((char_u *)str, s->attr); *** ../vim-8.2.0966/src/version.c 2020-06-12 22:30:57.629228449 +0200 --- src/version.c 2020-06-12 22:58:29.582218914 +0200 *************** *** 756,757 **** --- 756,759 ---- { /* Add new patch number below this line */ + /**/ + 967, /**/ -- We do not stumble over mountains, but over molehills. Confucius /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///