mirror of
https://github.com/vim/vim.git
synced 2025-07-26 11:04:33 -04:00
patch 8.2.0967: unnecessary type casts for vim_strnsave()
Problem: Unnecessary type casts for vim_strnsave(). Solution: Remove the type casts.
This commit is contained in:
parent
722e505d1a
commit
71ccd03ee8
@ -2534,7 +2534,7 @@ lookup_scriptvar(char_u *name, size_t len, cctx_T *dummy UNUSED)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
p = vim_strnsave(name, (int)len);
|
p = vim_strnsave(name, len);
|
||||||
if (p == NULL)
|
if (p == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -3221,7 +3221,7 @@ ex_append(exarg_T *eap)
|
|||||||
p = vim_strchr(eap->nextcmd, NL);
|
p = vim_strchr(eap->nextcmd, NL);
|
||||||
if (p == NULL)
|
if (p == NULL)
|
||||||
p = eap->nextcmd + STRLEN(eap->nextcmd);
|
p = eap->nextcmd + STRLEN(eap->nextcmd);
|
||||||
theline = vim_strnsave(eap->nextcmd, (int)(p - eap->nextcmd));
|
theline = vim_strnsave(eap->nextcmd, p - eap->nextcmd);
|
||||||
if (*p != NUL)
|
if (*p != NUL)
|
||||||
++p;
|
++p;
|
||||||
eap->nextcmd = p;
|
eap->nextcmd = p;
|
||||||
|
@ -439,7 +439,7 @@ get_exception_string(
|
|||||||
{
|
{
|
||||||
cmdlen = (int)STRLEN(cmdname);
|
cmdlen = (int)STRLEN(cmdname);
|
||||||
ret = (char *)vim_strnsave((char_u *)"Vim(",
|
ret = (char *)vim_strnsave((char_u *)"Vim(",
|
||||||
4 + cmdlen + 2 + (int)STRLEN(mesg));
|
4 + cmdlen + 2 + STRLEN(mesg));
|
||||||
if (ret == NULL)
|
if (ret == NULL)
|
||||||
return ret;
|
return ret;
|
||||||
STRCPY(&ret[4], cmdname);
|
STRCPY(&ret[4], cmdname);
|
||||||
@ -448,7 +448,7 @@ get_exception_string(
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ret = (char *)vim_strnsave((char_u *)"Vim:", 4 + (int)STRLEN(mesg));
|
ret = (char *)vim_strnsave((char_u *)"Vim:", 4 + STRLEN(mesg));
|
||||||
if (ret == NULL)
|
if (ret == NULL)
|
||||||
return ret;
|
return ret;
|
||||||
val = ret + 4;
|
val = ret + 4;
|
||||||
@ -806,7 +806,7 @@ report_pending(int action, int pending, void *value)
|
|||||||
if (pending & CSTP_THROW)
|
if (pending & CSTP_THROW)
|
||||||
{
|
{
|
||||||
vim_snprintf((char *)IObuff, IOSIZE, mesg, _("Exception"));
|
vim_snprintf((char *)IObuff, IOSIZE, mesg, _("Exception"));
|
||||||
mesg = (char *)vim_strnsave(IObuff, (int)STRLEN(IObuff) + 4);
|
mesg = (char *)vim_strnsave(IObuff, STRLEN(IObuff) + 4);
|
||||||
STRCAT(mesg, ": %s");
|
STRCAT(mesg, ": %s");
|
||||||
s = (char *)((except_T *)value)->value;
|
s = (char *)((except_T *)value)->value;
|
||||||
}
|
}
|
||||||
|
@ -2724,7 +2724,7 @@ next_fenc(char_u **pp, int *alloced)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
r = vim_strnsave(*pp, (int)(p - *pp));
|
r = vim_strnsave(*pp, p - *pp);
|
||||||
*pp = p + 1;
|
*pp = p + 1;
|
||||||
if (r != NULL)
|
if (r != NULL)
|
||||||
{
|
{
|
||||||
|
@ -389,7 +389,7 @@ repeat:
|
|||||||
if (mch_isdir(*fnamep))
|
if (mch_isdir(*fnamep))
|
||||||
{
|
{
|
||||||
// Make room for one or two extra characters.
|
// Make room for one or two extra characters.
|
||||||
*fnamep = vim_strnsave(*fnamep, (int)STRLEN(*fnamep) + 2);
|
*fnamep = vim_strnsave(*fnamep, STRLEN(*fnamep) + 2);
|
||||||
vim_free(*bufp); // free any allocated file name
|
vim_free(*bufp); // free any allocated file name
|
||||||
*bufp = *fnamep;
|
*bufp = *fnamep;
|
||||||
if (*fnamep == NULL)
|
if (*fnamep == NULL)
|
||||||
@ -655,7 +655,7 @@ repeat:
|
|||||||
p = vim_strchr(s, sep);
|
p = vim_strchr(s, sep);
|
||||||
if (p != NULL)
|
if (p != NULL)
|
||||||
{
|
{
|
||||||
pat = vim_strnsave(s, (int)(p - s));
|
pat = vim_strnsave(s, p - s);
|
||||||
if (pat != NULL)
|
if (pat != NULL)
|
||||||
{
|
{
|
||||||
s = p + 1;
|
s = p + 1;
|
||||||
@ -663,7 +663,7 @@ repeat:
|
|||||||
p = vim_strchr(s, sep);
|
p = vim_strchr(s, sep);
|
||||||
if (p != NULL)
|
if (p != NULL)
|
||||||
{
|
{
|
||||||
sub = vim_strnsave(s, (int)(p - s));
|
sub = vim_strnsave(s, p - s);
|
||||||
str = vim_strnsave(*fnamep, *fnamelen);
|
str = vim_strnsave(*fnamep, *fnamelen);
|
||||||
if (sub != NULL && str != NULL)
|
if (sub != NULL && str != NULL)
|
||||||
{
|
{
|
||||||
@ -1296,7 +1296,7 @@ mkdir_recurse(char_u *dir, int prot)
|
|||||||
return OK;
|
return OK;
|
||||||
|
|
||||||
// If the directory exists we're done. Otherwise: create it.
|
// If the directory exists we're done. Otherwise: create it.
|
||||||
updir = vim_strnsave(dir, (int)(p - dir));
|
updir = vim_strnsave(dir, p - dir);
|
||||||
if (updir == NULL)
|
if (updir == NULL)
|
||||||
return FAIL;
|
return FAIL;
|
||||||
if (mch_isdir(updir))
|
if (mch_isdir(updir))
|
||||||
@ -1594,7 +1594,7 @@ f_readfile(typval_T *argvars, typval_T *rettv)
|
|||||||
--prevlen;
|
--prevlen;
|
||||||
}
|
}
|
||||||
if (prevlen == 0)
|
if (prevlen == 0)
|
||||||
s = vim_strnsave(start, (int)len);
|
s = vim_strnsave(start, len);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Change "prev" buffer to be the right size. This way
|
// Change "prev" buffer to be the right size. This way
|
||||||
@ -3037,7 +3037,7 @@ expand_backtick(
|
|||||||
int i;
|
int i;
|
||||||
|
|
||||||
// Create the command: lop off the backticks.
|
// Create the command: lop off the backticks.
|
||||||
cmd = vim_strnsave(pat + 1, (int)STRLEN(pat) - 2);
|
cmd = vim_strnsave(pat + 1, STRLEN(pat) - 2);
|
||||||
if (cmd == NULL)
|
if (cmd == NULL)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
@ -451,7 +451,7 @@ vim_findfile_init(
|
|||||||
if (walker)
|
if (walker)
|
||||||
{
|
{
|
||||||
search_ctx->ffsc_stopdirs_v[dircount-1] =
|
search_ctx->ffsc_stopdirs_v[dircount-1] =
|
||||||
vim_strnsave(helper, (int)(walker - helper));
|
vim_strnsave(helper, walker - helper);
|
||||||
walker++;
|
walker++;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -484,7 +484,7 @@ vim_findfile_init(
|
|||||||
char *errpt;
|
char *errpt;
|
||||||
|
|
||||||
// save the fix part of the path
|
// save the fix part of the path
|
||||||
search_ctx->ffsc_fix_path = vim_strnsave(path, (int)(wc_part - path));
|
search_ctx->ffsc_fix_path = vim_strnsave(path, wc_part - path);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* copy wc_path and add restricts to the '**' wildcard.
|
* copy wc_path and add restricts to the '**' wildcard.
|
||||||
|
@ -963,7 +963,7 @@ do_highlight(
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
vim_free(arg);
|
vim_free(arg);
|
||||||
arg = vim_strnsave(arg_start, (int)(linep - arg_start));
|
arg = vim_strnsave(arg_start, linep - arg_start);
|
||||||
if (arg == NULL)
|
if (arg == NULL)
|
||||||
{
|
{
|
||||||
error = TRUE;
|
error = TRUE;
|
||||||
@ -5003,7 +5003,7 @@ ex_match(exarg_T *eap)
|
|||||||
{
|
{
|
||||||
p = skiptowhite(eap->arg);
|
p = skiptowhite(eap->arg);
|
||||||
if (!eap->skip)
|
if (!eap->skip)
|
||||||
g = vim_strnsave(eap->arg, (int)(p - eap->arg));
|
g = vim_strnsave(eap->arg, p - eap->arg);
|
||||||
p = skipwhite(p);
|
p = skipwhite(p);
|
||||||
if (*p == NUL)
|
if (*p == NUL)
|
||||||
{
|
{
|
||||||
|
@ -1435,7 +1435,7 @@ PerlIOVim_write(pTHX_ PerlIO *f, const void *vbuf, Size_t count)
|
|||||||
char_u *str;
|
char_u *str;
|
||||||
PerlIOVim * s = PerlIOSelf(f, PerlIOVim);
|
PerlIOVim * s = PerlIOSelf(f, PerlIOVim);
|
||||||
|
|
||||||
str = vim_strnsave((char_u *)vbuf, (int)count);
|
str = vim_strnsave((char_u *)vbuf, count);
|
||||||
if (str == NULL)
|
if (str == NULL)
|
||||||
return 0;
|
return 0;
|
||||||
msg_split((char_u *)str, s->attr);
|
msg_split((char_u *)str, s->attr);
|
||||||
|
@ -1858,7 +1858,7 @@ ruby_convert_to_vim_value(VALUE val, typval_T *rettv)
|
|||||||
|
|
||||||
rettv->v_type = VAR_STRING;
|
rettv->v_type = VAR_STRING;
|
||||||
rettv->vval.v_string = vim_strnsave((char_u *)RSTRING_PTR(str),
|
rettv->vval.v_string = vim_strnsave((char_u *)RSTRING_PTR(str),
|
||||||
(int)RSTRING_LEN(str));
|
RSTRING_LEN(str));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case T_ARRAY:
|
case T_ARRAY:
|
||||||
|
@ -1579,7 +1579,7 @@ ins_compl_bs(void)
|
|||||||
ins_compl_restart();
|
ins_compl_restart();
|
||||||
|
|
||||||
vim_free(compl_leader);
|
vim_free(compl_leader);
|
||||||
compl_leader = vim_strnsave(line + compl_col, (int)(p - line) - compl_col);
|
compl_leader = vim_strnsave(line + compl_col, (p - line) - compl_col);
|
||||||
if (compl_leader != NULL)
|
if (compl_leader != NULL)
|
||||||
{
|
{
|
||||||
ins_compl_new_leader();
|
ins_compl_new_leader();
|
||||||
@ -1706,7 +1706,7 @@ ins_compl_addleader(int c)
|
|||||||
{
|
{
|
||||||
vim_free(compl_leader);
|
vim_free(compl_leader);
|
||||||
compl_leader = vim_strnsave(ml_get_curline() + compl_col,
|
compl_leader = vim_strnsave(ml_get_curline() + compl_col,
|
||||||
(int)(curwin->w_cursor.col - compl_col));
|
curwin->w_cursor.col - compl_col);
|
||||||
if (compl_leader != NULL)
|
if (compl_leader != NULL)
|
||||||
ins_compl_new_leader();
|
ins_compl_new_leader();
|
||||||
}
|
}
|
||||||
|
@ -662,7 +662,7 @@ json_decode_item(js_read_T *reader, typval_T *res, int options)
|
|||||||
if (cur_item != NULL)
|
if (cur_item != NULL)
|
||||||
{
|
{
|
||||||
cur_item->v_type = VAR_STRING;
|
cur_item->v_type = VAR_STRING;
|
||||||
cur_item->vval.v_string = vim_strnsave(key, (int)(p - key));
|
cur_item->vval.v_string = vim_strnsave(key, p - key);
|
||||||
top_item->jd_key = cur_item->vval.v_string;
|
top_item->jd_key = cur_item->vval.v_string;
|
||||||
}
|
}
|
||||||
reader->js_used += (int)(p - key);
|
reader->js_used += (int)(p - key);
|
||||||
|
@ -680,7 +680,7 @@ mark_line(pos_T *mp, int lead_len)
|
|||||||
if (mp->lnum == 0 || mp->lnum > curbuf->b_ml.ml_line_count)
|
if (mp->lnum == 0 || mp->lnum > curbuf->b_ml.ml_line_count)
|
||||||
return vim_strsave((char_u *)"-invalid-");
|
return vim_strsave((char_u *)"-invalid-");
|
||||||
// Allow for up to 5 bytes per character.
|
// Allow for up to 5 bytes per character.
|
||||||
s = vim_strnsave(skipwhite(ml_get(mp->lnum)), (int)Columns * 5);
|
s = vim_strnsave(skipwhite(ml_get(mp->lnum)), Columns * 5);
|
||||||
if (s == NULL)
|
if (s == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
// Truncate the line to fit it in the window.
|
// Truncate the line to fit it in the window.
|
||||||
|
@ -1375,7 +1375,7 @@ ml_recover(int checkext)
|
|||||||
#endif
|
#endif
|
||||||
for (p = b0p->b0_fname + fnsize; p > b0p->b0_fname && p[-1] != NUL; --p)
|
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));
|
b0_fenc = vim_strnsave(p, b0p->b0_fname + fnsize - p);
|
||||||
}
|
}
|
||||||
|
|
||||||
mf_put(mfp, hp, FALSE, FALSE); // release block 0
|
mf_put(mfp, hp, FALSE, FALSE); // release block 0
|
||||||
|
@ -1810,7 +1810,7 @@ menu_text(char_u *str, int *mnemonic, char_u **actext)
|
|||||||
{
|
{
|
||||||
if (actext != NULL)
|
if (actext != NULL)
|
||||||
*actext = vim_strsave(p + 1);
|
*actext = vim_strsave(p + 1);
|
||||||
text = vim_strnsave(str, (int)(p - str));
|
text = vim_strnsave(str, p - str);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
text = vim_strsave(str);
|
text = vim_strsave(str);
|
||||||
@ -2716,7 +2716,7 @@ ex_menutranslate(exarg_T *eap UNUSED)
|
|||||||
if (from != NULL)
|
if (from != NULL)
|
||||||
{
|
{
|
||||||
from_noamp = menu_text(from, NULL, NULL);
|
from_noamp = menu_text(from, NULL, NULL);
|
||||||
to = vim_strnsave(to, (int)(arg - to));
|
to = vim_strnsave(to, arg - to);
|
||||||
if (from_noamp != NULL && to != NULL)
|
if (from_noamp != NULL && to != NULL)
|
||||||
{
|
{
|
||||||
menu_translate_tab_and_shift(from);
|
menu_translate_tab_and_shift(from);
|
||||||
|
@ -1795,7 +1795,7 @@ vim_getenv(char_u *name, int *mustfree)
|
|||||||
if (p == exe_name || p == p_hf)
|
if (p == exe_name || p == p_hf)
|
||||||
#endif
|
#endif
|
||||||
// check that the result is a directory name
|
// check that the result is a directory name
|
||||||
p = vim_strnsave(p, (int)(pend - p));
|
p = vim_strnsave(p, pend - p);
|
||||||
|
|
||||||
if (p != NULL && !mch_isdir(p))
|
if (p != NULL && !mch_isdir(p))
|
||||||
VIM_CLEAR(p);
|
VIM_CLEAR(p);
|
||||||
@ -2576,7 +2576,7 @@ get_isolated_shell_name(void)
|
|||||||
|
|
||||||
#ifdef MSWIN
|
#ifdef MSWIN
|
||||||
p = gettail(p_sh);
|
p = gettail(p_sh);
|
||||||
p = vim_strnsave(p, (int)(skiptowhite(p) - p));
|
p = vim_strnsave(p, skiptowhite(p) - p);
|
||||||
#else
|
#else
|
||||||
p = skiptowhite(p_sh);
|
p = skiptowhite(p_sh);
|
||||||
if (*p == NUL)
|
if (*p == NUL)
|
||||||
@ -2593,7 +2593,7 @@ get_isolated_shell_name(void)
|
|||||||
for (p2 = p_sh; p2 < p; MB_PTR_ADV(p2))
|
for (p2 = p_sh; p2 < p; MB_PTR_ADV(p2))
|
||||||
if (vim_ispathsep(*p2))
|
if (vim_ispathsep(*p2))
|
||||||
p1 = p2 + 1;
|
p1 = p2 + 1;
|
||||||
p = vim_strnsave(p1, (int)(p - p1));
|
p = vim_strnsave(p1, p - p1);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
return p;
|
return p;
|
||||||
|
@ -1616,7 +1616,7 @@ op_insert(oparg_T *oap, long count1)
|
|||||||
if (pre_textlen >= 0
|
if (pre_textlen >= 0
|
||||||
&& (ins_len = (long)STRLEN(firstline) - pre_textlen) > 0)
|
&& (ins_len = (long)STRLEN(firstline) - pre_textlen) > 0)
|
||||||
{
|
{
|
||||||
ins_text = vim_strnsave(firstline, (int)ins_len);
|
ins_text = vim_strnsave(firstline, ins_len);
|
||||||
if (ins_text != NULL)
|
if (ins_text != NULL)
|
||||||
{
|
{
|
||||||
// block handled here
|
// block handled here
|
||||||
|
@ -477,8 +477,7 @@ get_exe_name(void)
|
|||||||
|
|
||||||
if (exe_path == NULL && exe_name != NULL)
|
if (exe_path == NULL && exe_name != NULL)
|
||||||
{
|
{
|
||||||
exe_path = vim_strnsave(exe_name,
|
exe_path = vim_strnsave(exe_name, gettail_sep(exe_name) - exe_name);
|
||||||
(int)(gettail_sep(exe_name) - exe_name));
|
|
||||||
if (exe_path != NULL)
|
if (exe_path != NULL)
|
||||||
{
|
{
|
||||||
// Append our starting directory to $PATH, so that when doing
|
// Append our starting directory to $PATH, so that when doing
|
||||||
|
@ -1846,7 +1846,7 @@ fill_submatch_list(int argc UNUSED, typval_T *argv, int argskip, int argcount)
|
|||||||
if (s == NULL || rsm.sm_match->endp[i] == NULL)
|
if (s == NULL || rsm.sm_match->endp[i] == NULL)
|
||||||
s = NULL;
|
s = NULL;
|
||||||
else
|
else
|
||||||
s = vim_strnsave(s, (int)(rsm.sm_match->endp[i] - s));
|
s = vim_strnsave(s, rsm.sm_match->endp[i] - s);
|
||||||
li->li_tv.v_type = VAR_STRING;
|
li->li_tv.v_type = VAR_STRING;
|
||||||
li->li_tv.vval.v_string = s;
|
li->li_tv.vval.v_string = s;
|
||||||
li = li->li_next;
|
li = li->li_next;
|
||||||
@ -2462,7 +2462,7 @@ reg_submatch(int no)
|
|||||||
if (s == NULL || rsm.sm_match->endp[no] == NULL)
|
if (s == NULL || rsm.sm_match->endp[no] == NULL)
|
||||||
retval = NULL;
|
retval = NULL;
|
||||||
else
|
else
|
||||||
retval = vim_strnsave(s, (int)(rsm.sm_match->endp[no] - s));
|
retval = vim_strnsave(s, rsm.sm_match->endp[no] - s);
|
||||||
}
|
}
|
||||||
|
|
||||||
return retval;
|
return retval;
|
||||||
|
@ -4588,7 +4588,7 @@ regtry(
|
|||||||
if (reg_startzp[i] != NULL && reg_endzp[i] != NULL)
|
if (reg_startzp[i] != NULL && reg_endzp[i] != NULL)
|
||||||
re_extmatch_out->matches[i] =
|
re_extmatch_out->matches[i] =
|
||||||
vim_strnsave(reg_startzp[i],
|
vim_strnsave(reg_startzp[i],
|
||||||
(int)(reg_endzp[i] - reg_startzp[i]));
|
reg_endzp[i] - reg_startzp[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7103,8 +7103,7 @@ nfa_regtry(
|
|||||||
|
|
||||||
if (lpos->start != NULL && lpos->end != NULL)
|
if (lpos->start != NULL && lpos->end != NULL)
|
||||||
re_extmatch_out->matches[i] =
|
re_extmatch_out->matches[i] =
|
||||||
vim_strnsave(lpos->start,
|
vim_strnsave(lpos->start, lpos->end - lpos->start);
|
||||||
(int)(lpos->end - lpos->start));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2655,7 +2655,7 @@ write_reg_contents_ex(
|
|||||||
{
|
{
|
||||||
char_u *p, *s;
|
char_u *p, *s;
|
||||||
|
|
||||||
p = vim_strnsave(str, (int)len);
|
p = vim_strnsave(str, len);
|
||||||
if (p == NULL)
|
if (p == NULL)
|
||||||
return;
|
return;
|
||||||
if (must_append && expr_line != NULL)
|
if (must_append && expr_line != NULL)
|
||||||
|
@ -1916,7 +1916,7 @@ find_rawstring_end(char_u *linep, pos_T *startpos, pos_T *endpos)
|
|||||||
for (p = linep + startpos->col + 1; *p && *p != '('; ++p)
|
for (p = linep + startpos->col + 1; *p && *p != '('; ++p)
|
||||||
;
|
;
|
||||||
delim_len = (p - linep) - startpos->col - 1;
|
delim_len = (p - linep) - startpos->col - 1;
|
||||||
delim_copy = vim_strnsave(linep + startpos->col + 1, (int)delim_len);
|
delim_copy = vim_strnsave(linep + startpos->col + 1, delim_len);
|
||||||
if (delim_copy == NULL)
|
if (delim_copy == NULL)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
for (lnum = startpos->lnum; lnum <= endpos->lnum; ++lnum)
|
for (lnum = startpos->lnum; lnum <= endpos->lnum; ++lnum)
|
||||||
|
@ -1309,22 +1309,22 @@ sign_define_cmd(char_u *sign_name, char_u *cmdline)
|
|||||||
if (STRNCMP(arg, "icon=", 5) == 0)
|
if (STRNCMP(arg, "icon=", 5) == 0)
|
||||||
{
|
{
|
||||||
arg += 5;
|
arg += 5;
|
||||||
icon = vim_strnsave(arg, (int)(p - arg));
|
icon = vim_strnsave(arg, p - arg);
|
||||||
}
|
}
|
||||||
else if (STRNCMP(arg, "text=", 5) == 0)
|
else if (STRNCMP(arg, "text=", 5) == 0)
|
||||||
{
|
{
|
||||||
arg += 5;
|
arg += 5;
|
||||||
text = vim_strnsave(arg, (int)(p - arg));
|
text = vim_strnsave(arg, p - arg);
|
||||||
}
|
}
|
||||||
else if (STRNCMP(arg, "linehl=", 7) == 0)
|
else if (STRNCMP(arg, "linehl=", 7) == 0)
|
||||||
{
|
{
|
||||||
arg += 7;
|
arg += 7;
|
||||||
linehl = vim_strnsave(arg, (int)(p - arg));
|
linehl = vim_strnsave(arg, p - arg);
|
||||||
}
|
}
|
||||||
else if (STRNCMP(arg, "texthl=", 7) == 0)
|
else if (STRNCMP(arg, "texthl=", 7) == 0)
|
||||||
{
|
{
|
||||||
arg += 7;
|
arg += 7;
|
||||||
texthl = vim_strnsave(arg, (int)(p - arg));
|
texthl = vim_strnsave(arg, p - arg);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
14
src/syntax.c
14
src/syntax.c
@ -4652,7 +4652,7 @@ get_syn_options(
|
|||||||
arg = skiptowhite(arg);
|
arg = skiptowhite(arg);
|
||||||
if (gname_start == arg)
|
if (gname_start == arg)
|
||||||
return NULL;
|
return NULL;
|
||||||
gname = vim_strnsave(gname_start, (int)(arg - gname_start));
|
gname = vim_strnsave(gname_start, arg - gname_start);
|
||||||
if (gname == NULL)
|
if (gname == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
if (STRCMP(gname, "NONE") == 0)
|
if (STRCMP(gname, "NONE") == 0)
|
||||||
@ -4662,7 +4662,8 @@ get_syn_options(
|
|||||||
syn_id = syn_name2id(gname);
|
syn_id = syn_name2id(gname);
|
||||||
for (i = curwin->w_s->b_syn_patterns.ga_len; --i >= 0; )
|
for (i = curwin->w_s->b_syn_patterns.ga_len; --i >= 0; )
|
||||||
if (SYN_ITEMS(curwin->w_s)[i].sp_syn.id == syn_id
|
if (SYN_ITEMS(curwin->w_s)[i].sp_syn.id == syn_id
|
||||||
&& SYN_ITEMS(curwin->w_s)[i].sp_type == SPTYPE_START)
|
&& SYN_ITEMS(curwin->w_s)[i].sp_type
|
||||||
|
== SPTYPE_START)
|
||||||
{
|
{
|
||||||
*opt->sync_idx = i;
|
*opt->sync_idx = i;
|
||||||
break;
|
break;
|
||||||
@ -5656,7 +5657,7 @@ get_syn_pattern(char_u *arg, synpat_T *ci)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
// store the pattern and compiled regexp program
|
// store the pattern and compiled regexp program
|
||||||
if ((ci->sp_pattern = vim_strnsave(arg + 1, (int)(end - arg - 1))) == NULL)
|
if ((ci->sp_pattern = vim_strnsave(arg + 1, end - arg - 1)) == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
// Make 'cpoptions' empty, to avoid the 'l' flag
|
// Make 'cpoptions' empty, to avoid the 'l' flag
|
||||||
@ -5836,8 +5837,9 @@ syn_cmd_sync(exarg_T *eap, int syncing UNUSED)
|
|||||||
if (!eap->skip)
|
if (!eap->skip)
|
||||||
{
|
{
|
||||||
// store the pattern and compiled regexp program
|
// store the pattern and compiled regexp program
|
||||||
if ((curwin->w_s->b_syn_linecont_pat = vim_strnsave(next_arg + 1,
|
if ((curwin->w_s->b_syn_linecont_pat =
|
||||||
(int)(arg_end - next_arg - 1))) == NULL)
|
vim_strnsave(next_arg + 1,
|
||||||
|
arg_end - next_arg - 1)) == NULL)
|
||||||
{
|
{
|
||||||
finished = TRUE;
|
finished = TRUE;
|
||||||
break;
|
break;
|
||||||
@ -6272,7 +6274,7 @@ ex_syntax(exarg_T *eap)
|
|||||||
// isolate subcommand name
|
// isolate subcommand name
|
||||||
for (subcmd_end = arg; ASCII_ISALPHA(*subcmd_end); ++subcmd_end)
|
for (subcmd_end = arg; ASCII_ISALPHA(*subcmd_end); ++subcmd_end)
|
||||||
;
|
;
|
||||||
subcmd_name = vim_strnsave(arg, (int)(subcmd_end - arg));
|
subcmd_name = vim_strnsave(arg, subcmd_end - arg);
|
||||||
if (subcmd_name != NULL)
|
if (subcmd_name != NULL)
|
||||||
{
|
{
|
||||||
if (eap->skip) // skip error messages for all subcommands
|
if (eap->skip) // skip error messages for all subcommands
|
||||||
|
@ -4086,11 +4086,11 @@ add_termcode(char_u *name, char_u *string, int flags)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if defined(MSWIN) && !defined(FEAT_GUI)
|
#if defined(MSWIN) && !defined(FEAT_GUI)
|
||||||
s = vim_strnsave(string, (int)STRLEN(string) + 1);
|
s = vim_strnsave(string, STRLEN(string) + 1);
|
||||||
#else
|
#else
|
||||||
# ifdef VIMDLL
|
# ifdef VIMDLL
|
||||||
if (!gui.in_use)
|
if (!gui.in_use)
|
||||||
s = vim_strnsave(string, (int)STRLEN(string) + 1);
|
s = vim_strnsave(string, STRLEN(string) + 1);
|
||||||
else
|
else
|
||||||
# endif
|
# endif
|
||||||
s = vim_strsave(string);
|
s = vim_strsave(string);
|
||||||
|
@ -3011,7 +3011,7 @@ handle_settermprop(
|
|||||||
{
|
{
|
||||||
case VTERM_PROP_TITLE:
|
case VTERM_PROP_TITLE:
|
||||||
strval = vim_strnsave((char_u *)value->string.str,
|
strval = vim_strnsave((char_u *)value->string.str,
|
||||||
(int)value->string.len);
|
value->string.len);
|
||||||
if (strval == NULL)
|
if (strval == NULL)
|
||||||
break;
|
break;
|
||||||
vim_free(term->tl_title);
|
vim_free(term->tl_title);
|
||||||
@ -3073,7 +3073,7 @@ handle_settermprop(
|
|||||||
|
|
||||||
case VTERM_PROP_CURSORCOLOR:
|
case VTERM_PROP_CURSORCOLOR:
|
||||||
strval = vim_strnsave((char_u *)value->string.str,
|
strval = vim_strnsave((char_u *)value->string.str,
|
||||||
(int)value->string.len);
|
value->string.len);
|
||||||
if (strval == NULL)
|
if (strval == NULL)
|
||||||
break;
|
break;
|
||||||
cursor_color_copy(&term->tl_cursor_color, strval);
|
cursor_color_copy(&term->tl_cursor_color, strval);
|
||||||
|
@ -849,7 +849,7 @@ u_get_undo_file_name(char_u *buf_ffname, int reading)
|
|||||||
{
|
{
|
||||||
// Use same directory as the ffname,
|
// Use same directory as the ffname,
|
||||||
// "dir/name" -> "dir/.name.un~"
|
// "dir/name" -> "dir/.name.un~"
|
||||||
undo_file_name = vim_strnsave(ffname, (int)(STRLEN(ffname) + 5));
|
undo_file_name = vim_strnsave(ffname, STRLEN(ffname) + 5);
|
||||||
if (undo_file_name == NULL)
|
if (undo_file_name == NULL)
|
||||||
break;
|
break;
|
||||||
p = gettail(undo_file_name);
|
p = gettail(undo_file_name);
|
||||||
|
@ -676,7 +676,7 @@ parse_compl_arg(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (arg != NULL)
|
if (arg != NULL)
|
||||||
*compl_arg = vim_strnsave(arg, (int)arglen);
|
*compl_arg = vim_strnsave(arg, arglen);
|
||||||
# endif
|
# endif
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
@ -939,7 +939,7 @@ uc_add_command(
|
|||||||
{
|
{
|
||||||
if (ga_grow(gap, 1) != OK)
|
if (ga_grow(gap, 1) != OK)
|
||||||
goto fail;
|
goto fail;
|
||||||
if ((p = vim_strnsave(name, (int)name_len)) == NULL)
|
if ((p = vim_strnsave(name, name_len)) == NULL)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
cmd = USER_CMD_GA(gap, i);
|
cmd = USER_CMD_GA(gap, i);
|
||||||
|
@ -2699,7 +2699,7 @@ def_function(exarg_T *eap, char_u *name_arg)
|
|||||||
p = skip_type(ret_type);
|
p = skip_type(ret_type);
|
||||||
if (p > ret_type)
|
if (p > ret_type)
|
||||||
{
|
{
|
||||||
ret_type = vim_strnsave(ret_type, (int)(p - ret_type));
|
ret_type = vim_strnsave(ret_type, p - ret_type);
|
||||||
p = skipwhite(p);
|
p = skipwhite(p);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -2972,12 +2972,12 @@ def_function(exarg_T *eap, char_u *name_arg)
|
|||||||
// Ignore leading white space.
|
// Ignore leading white space.
|
||||||
p = skipwhite(p + 4);
|
p = skipwhite(p + 4);
|
||||||
heredoc_trimmed = vim_strnsave(theline,
|
heredoc_trimmed = vim_strnsave(theline,
|
||||||
(int)(skipwhite(theline) - theline));
|
skipwhite(theline) - theline);
|
||||||
}
|
}
|
||||||
if (*p == NUL)
|
if (*p == NUL)
|
||||||
skip_until = vim_strsave((char_u *)".");
|
skip_until = vim_strsave((char_u *)".");
|
||||||
else
|
else
|
||||||
skip_until = vim_strnsave(p, (int)(skiptowhite(p) - p));
|
skip_until = vim_strnsave(p, skiptowhite(p) - p);
|
||||||
do_concat = FALSE;
|
do_concat = FALSE;
|
||||||
is_heredoc = TRUE;
|
is_heredoc = TRUE;
|
||||||
}
|
}
|
||||||
@ -3002,9 +3002,9 @@ def_function(exarg_T *eap, char_u *name_arg)
|
|||||||
// Ignore leading white space.
|
// Ignore leading white space.
|
||||||
p = skipwhite(p + 4);
|
p = skipwhite(p + 4);
|
||||||
heredoc_trimmed = vim_strnsave(theline,
|
heredoc_trimmed = vim_strnsave(theline,
|
||||||
(int)(skipwhite(theline) - theline));
|
skipwhite(theline) - theline);
|
||||||
}
|
}
|
||||||
skip_until = vim_strnsave(p, (int)(skiptowhite(p) - p));
|
skip_until = vim_strnsave(p, skiptowhite(p) - p);
|
||||||
do_concat = FALSE;
|
do_concat = FALSE;
|
||||||
is_heredoc = TRUE;
|
is_heredoc = TRUE;
|
||||||
}
|
}
|
||||||
|
@ -754,6 +754,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
967,
|
||||||
/**/
|
/**/
|
||||||
966,
|
966,
|
||||||
/**/
|
/**/
|
||||||
|
@ -1575,7 +1575,7 @@ generate_STRINGMEMBER(cctx_T *cctx, char_u *name, size_t len)
|
|||||||
RETURN_OK_IF_SKIP(cctx);
|
RETURN_OK_IF_SKIP(cctx);
|
||||||
if ((isn = generate_instr(cctx, ISN_STRINGMEMBER)) == NULL)
|
if ((isn = generate_instr(cctx, ISN_STRINGMEMBER)) == NULL)
|
||||||
return FAIL;
|
return FAIL;
|
||||||
isn->isn_arg.string = vim_strnsave(name, (int)len);
|
isn->isn_arg.string = vim_strnsave(name, len);
|
||||||
|
|
||||||
// check for dict type
|
// check for dict type
|
||||||
type = ((type_T **)stack->ga_data)[stack->ga_len - 1];
|
type = ((type_T **)stack->ga_data)[stack->ga_len - 1];
|
||||||
@ -1671,7 +1671,7 @@ reserve_local(cctx_T *cctx, char_u *name, size_t len, int isConst, type_T *type)
|
|||||||
// entries. This is less efficient, but memory is cheap these days.
|
// entries. This is less efficient, but memory is cheap these days.
|
||||||
lvar->lv_idx = cctx->ctx_locals_count++;
|
lvar->lv_idx = cctx->ctx_locals_count++;
|
||||||
|
|
||||||
lvar->lv_name = vim_strnsave(name, (int)(len == 0 ? STRLEN(name) : len));
|
lvar->lv_name = vim_strnsave(name, len == 0 ? STRLEN(name) : len);
|
||||||
lvar->lv_const = isConst;
|
lvar->lv_const = isConst;
|
||||||
lvar->lv_type = type;
|
lvar->lv_type = type;
|
||||||
|
|
||||||
@ -4627,7 +4627,7 @@ compile_assignment(char_u *arg, exarg_T *eap, cmdidx_T cmdidx, cctx_T *cctx)
|
|||||||
--p;
|
--p;
|
||||||
|
|
||||||
varlen = p - arg;
|
varlen = p - arg;
|
||||||
name = vim_strnsave(arg, (int)varlen);
|
name = vim_strnsave(arg, varlen);
|
||||||
if (name == NULL)
|
if (name == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
@ -6268,7 +6268,7 @@ compile_exec(char_u *line, exarg_T *eap, cctx_T *cctx)
|
|||||||
{
|
{
|
||||||
if (p > start)
|
if (p > start)
|
||||||
{
|
{
|
||||||
generate_PUSHS(cctx, vim_strnsave(start, (int)(p - start)));
|
generate_PUSHS(cctx, vim_strnsave(start, p - start));
|
||||||
++count;
|
++count;
|
||||||
}
|
}
|
||||||
p += 2;
|
p += 2;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user