mirror of
https://github.com/neovim/neovim.git
synced 2024-12-19 18:55:14 -07:00
Use memmove instead of mch_memmove
This commit is contained in:
parent
dbc904956a
commit
07dad7acf3
@ -387,7 +387,7 @@ void bf_key_init(char_u *password, char_u *salt, int salt_len)
|
||||
key[i] = u;
|
||||
}
|
||||
|
||||
mch_memmove(sbx, sbi, 4 * 4 * 256);
|
||||
memmove(sbx, sbi, 4 * 4 * 256);
|
||||
|
||||
int keypos = 0;
|
||||
for (i = 0; i < 18; i++) {
|
||||
@ -585,9 +585,9 @@ void bf_crypt_save(void)
|
||||
{
|
||||
save_randbyte_offset = randbyte_offset;
|
||||
save_update_offset = update_offset;
|
||||
mch_memmove(save_ofb_buffer, ofb_buffer, BF_OFB_LEN);
|
||||
mch_memmove(save_pax, pax, 4 * 18);
|
||||
mch_memmove(save_sbx, sbx, 4 * 4 * 256);
|
||||
memmove(save_ofb_buffer, ofb_buffer, BF_OFB_LEN);
|
||||
memmove(save_pax, pax, 4 * 18);
|
||||
memmove(save_sbx, sbx, 4 * 4 * 256);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -598,9 +598,9 @@ void bf_crypt_restore(void)
|
||||
{
|
||||
randbyte_offset = save_randbyte_offset;
|
||||
update_offset = save_update_offset;
|
||||
mch_memmove(ofb_buffer, save_ofb_buffer, BF_OFB_LEN);
|
||||
mch_memmove(pax, save_pax, 4 * 18);
|
||||
mch_memmove(sbx, save_sbx, 4 * 4 * 256);
|
||||
memmove(ofb_buffer, save_ofb_buffer, BF_OFB_LEN);
|
||||
memmove(pax, save_pax, 4 * 18);
|
||||
memmove(sbx, save_sbx, 4 * 4 * 256);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -25,6 +25,8 @@
|
||||
* The current implementation remembers all file names ever used.
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "vim.h"
|
||||
#include "buffer.h"
|
||||
#include "charset.h"
|
||||
@ -2933,7 +2935,7 @@ build_stl_str_hl (
|
||||
/* There are too many items. Add the error code to the statusline
|
||||
* to give the user a hint about what went wrong. */
|
||||
if (p + 6 < out + outlen) {
|
||||
mch_memmove(p, " E541", (size_t)5);
|
||||
memmove(p, " E541", (size_t)5);
|
||||
p += 5;
|
||||
}
|
||||
break;
|
||||
@ -3010,7 +3012,7 @@ build_stl_str_hl (
|
||||
n = (long)(p - t) - item[groupitem[groupdepth]].maxwid + 1;
|
||||
|
||||
*t = '<';
|
||||
mch_memmove(t + 1, t + n, (size_t)(p - (t + n)));
|
||||
memmove(t + 1, t + n, (size_t)(p - (t + n)));
|
||||
p = p - n + 1;
|
||||
/* Fill up space left over by half a double-wide char. */
|
||||
while (++l < item[groupitem[groupdepth]].minwid)
|
||||
@ -3032,7 +3034,7 @@ build_stl_str_hl (
|
||||
*p++ = fillchar;
|
||||
} else {
|
||||
/* fill by inserting characters */
|
||||
mch_memmove(t + n - l, t, (size_t)(p - t));
|
||||
memmove(t + n - l, t, (size_t)(p - t));
|
||||
l = n - l;
|
||||
if (p + l >= out + outlen)
|
||||
l = (long)((out + outlen) - p - 1);
|
||||
|
@ -311,9 +311,9 @@ void trans_characters(char_u *buf, int bufsize)
|
||||
if (room <= 0) {
|
||||
return;
|
||||
}
|
||||
mch_memmove(buf + trs_len, buf + 1, (size_t)len);
|
||||
memmove(buf + trs_len, buf + 1, (size_t)len);
|
||||
}
|
||||
mch_memmove(buf, trs, (size_t)trs_len);
|
||||
memmove(buf, trs, (size_t)trs_len);
|
||||
--len;
|
||||
}
|
||||
buf += trs_len;
|
||||
@ -427,14 +427,14 @@ char_u* str_foldcase(char_u *str, int orglen, char_u *buf, int buflen)
|
||||
if (ga_grow(&ga, len + 1) == FAIL) {
|
||||
return NULL;
|
||||
}
|
||||
mch_memmove(ga.ga_data, str, (size_t)len);
|
||||
memmove(ga.ga_data, str, (size_t)len);
|
||||
ga.ga_len = len;
|
||||
} else {
|
||||
if (len >= buflen) {
|
||||
// Ugly!
|
||||
len = buflen - 1;
|
||||
}
|
||||
mch_memmove(buf, str, (size_t)len);
|
||||
memmove(buf, str, (size_t)len);
|
||||
}
|
||||
|
||||
if (buf == NULL) {
|
||||
|
@ -6298,7 +6298,7 @@ replace_push (
|
||||
return;
|
||||
}
|
||||
if (replace_stack != NULL) {
|
||||
mch_memmove(p, replace_stack,
|
||||
memmove(p, replace_stack,
|
||||
(size_t)(replace_stack_nr * sizeof(char_u)));
|
||||
vim_free(replace_stack);
|
||||
}
|
||||
@ -6306,7 +6306,7 @@ replace_push (
|
||||
}
|
||||
p = replace_stack + replace_stack_nr - replace_offset;
|
||||
if (replace_offset)
|
||||
mch_memmove(p + 1, p, (size_t)(replace_offset * sizeof(char_u)));
|
||||
memmove(p + 1, p, (size_t)(replace_offset * sizeof(char_u)));
|
||||
*p = c;
|
||||
++replace_stack_nr;
|
||||
}
|
||||
@ -6352,7 +6352,7 @@ replace_join (
|
||||
for (i = replace_stack_nr; --i >= 0; )
|
||||
if (replace_stack[i] == NUL && off-- <= 0) {
|
||||
--replace_stack_nr;
|
||||
mch_memmove(replace_stack + i, replace_stack + i + 1,
|
||||
memmove(replace_stack + i, replace_stack + i + 1,
|
||||
(size_t)(replace_stack_nr - i));
|
||||
return;
|
||||
}
|
||||
|
18
src/eval.c
18
src/eval.c
@ -1105,7 +1105,7 @@ void var_redir_str(char_u *value, int value_len)
|
||||
len = value_len; /* Append only "value_len" characters */
|
||||
|
||||
if (ga_grow(&redir_ga, len) == OK) {
|
||||
mch_memmove((char *)redir_ga.ga_data + redir_ga.ga_len, value, len);
|
||||
memmove((char *)redir_ga.ga_data + redir_ga.ga_len, value, len);
|
||||
redir_ga.ga_len += len;
|
||||
} else
|
||||
var_redir_stop();
|
||||
@ -7321,7 +7321,7 @@ call_func (
|
||||
if (fname == NULL)
|
||||
error = ERROR_OTHER;
|
||||
else {
|
||||
mch_memmove(fname, fname_buf, (size_t)i);
|
||||
memmove(fname, fname_buf, (size_t)i);
|
||||
STRCPY(fname + i, name + llen);
|
||||
}
|
||||
}
|
||||
@ -12016,7 +12016,7 @@ static void f_readfile(typval_T *argvars, typval_T *rettv)
|
||||
* the bytes are only copied once, and very long lines are
|
||||
* allocated only once. */
|
||||
if ((s = vim_realloc(prev, prevlen + len + 1)) != NULL) {
|
||||
mch_memmove(s + prevlen, start, len);
|
||||
memmove(s + prevlen, start, len);
|
||||
s[prevlen + len] = NUL;
|
||||
prev = NULL; /* the list will own the string */
|
||||
prevlen = prevsize = 0;
|
||||
@ -12071,7 +12071,7 @@ static void f_readfile(typval_T *argvars, typval_T *rettv)
|
||||
dest = buf;
|
||||
}
|
||||
if (readlen > p - buf + 1)
|
||||
mch_memmove(dest, p + 1, readlen - (p - buf) - 1);
|
||||
memmove(dest, p + 1, readlen - (p - buf) - 1);
|
||||
readlen -= 3 - adjust_prevlen;
|
||||
prevlen -= adjust_prevlen;
|
||||
p = dest - 1;
|
||||
@ -12109,7 +12109,7 @@ static void f_readfile(typval_T *argvars, typval_T *rettv)
|
||||
prev = newprev;
|
||||
}
|
||||
/* Add the line part to end of "prev". */
|
||||
mch_memmove(prev + prevlen, start, p - start);
|
||||
memmove(prev + prevlen, start, p - start);
|
||||
prevlen += (long)(p - start);
|
||||
}
|
||||
} /* while */
|
||||
@ -12372,7 +12372,7 @@ static void f_repeat(typval_T *argvars, typval_T *rettv)
|
||||
r = alloc(len + 1);
|
||||
if (r != NULL) {
|
||||
for (i = 0; i < n; i++)
|
||||
mch_memmove(r + i * slen, p, (size_t)slen);
|
||||
memmove(r + i * slen, p, (size_t)slen);
|
||||
r[len] = NUL;
|
||||
}
|
||||
|
||||
@ -14905,7 +14905,7 @@ error:
|
||||
}
|
||||
|
||||
ga_grow(&ga, cplen);
|
||||
mch_memmove((char *)ga.ga_data + ga.ga_len, cpstr, (size_t)cplen);
|
||||
memmove((char *)ga.ga_data + ga.ga_len, cpstr, (size_t)cplen);
|
||||
ga.ga_len += cplen;
|
||||
|
||||
in_str += inlen;
|
||||
@ -17829,7 +17829,7 @@ trans_function_name (
|
||||
if (lead > 3) /* If it's "<SID>" */
|
||||
STRCPY(name + 3, sid_buf);
|
||||
}
|
||||
mch_memmove(name + lead, lv.ll_name, (size_t)len);
|
||||
memmove(name + lead, lv.ll_name, (size_t)len);
|
||||
name[len + lead] = NUL;
|
||||
}
|
||||
*pp = end;
|
||||
@ -19587,7 +19587,7 @@ char_u *do_string_sub(char_u *str, char_u *pat, char_u *sub, char_u *flags)
|
||||
|
||||
/* copy the text up to where the match is */
|
||||
i = (int)(regmatch.startp[0] - tail);
|
||||
mch_memmove((char_u *)ga.ga_data + ga.ga_len, tail, (size_t)i);
|
||||
memmove((char_u *)ga.ga_data + ga.ga_len, tail, (size_t)i);
|
||||
/* add the substituted text */
|
||||
(void)vim_regsub(®match, sub, (char_u *)ga.ga_data
|
||||
+ ga.ga_len + i, TRUE, TRUE, FALSE);
|
||||
|
@ -11,6 +11,8 @@
|
||||
* ex_cmds.c: some functions for command line commands
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "vim.h"
|
||||
#include "version_defs.h"
|
||||
#include "ex_cmds.h"
|
||||
@ -625,8 +627,8 @@ void ex_retab(exarg_T *eap)
|
||||
if (new_line == NULL)
|
||||
break;
|
||||
if (start_col > 0)
|
||||
mch_memmove(new_line, ptr, (size_t)start_col);
|
||||
mch_memmove(new_line + start_col + len,
|
||||
memmove(new_line, ptr, (size_t)start_col);
|
||||
memmove(new_line + start_col + len,
|
||||
ptr + col, (size_t)(old_len - col + 1));
|
||||
ptr = new_line + start_col;
|
||||
for (col = 0; col < len; col++)
|
||||
@ -4150,7 +4152,7 @@ void do_sub(exarg_T *eap)
|
||||
vim_free(new_start);
|
||||
goto outofmem;
|
||||
}
|
||||
mch_memmove(p1, new_start, (size_t)(len + 1));
|
||||
memmove(p1, new_start, (size_t)(len + 1));
|
||||
vim_free(new_start);
|
||||
new_start = p1;
|
||||
}
|
||||
@ -4160,7 +4162,7 @@ void do_sub(exarg_T *eap)
|
||||
/*
|
||||
* copy the text up to the part that matched
|
||||
*/
|
||||
mch_memmove(new_end, sub_firstline + copycol, (size_t)copy_len);
|
||||
memmove(new_end, sub_firstline + copycol, (size_t)copy_len);
|
||||
new_end += copy_len;
|
||||
|
||||
(void)vim_regsub_multi(®match,
|
||||
@ -5088,16 +5090,16 @@ int find_help_tags(char_u *arg, int *num_matches, char_u ***matches, int keep_la
|
||||
if (*IObuff == '`') {
|
||||
if (d > IObuff + 2 && d[-1] == '`') {
|
||||
/* remove the backticks from `command` */
|
||||
mch_memmove(IObuff, IObuff + 1, STRLEN(IObuff));
|
||||
memmove(IObuff, IObuff + 1, STRLEN(IObuff));
|
||||
d[-2] = NUL;
|
||||
} else if (d > IObuff + 3 && d[-2] == '`' && d[-1] == ',') {
|
||||
/* remove the backticks and comma from `command`, */
|
||||
mch_memmove(IObuff, IObuff + 1, STRLEN(IObuff));
|
||||
memmove(IObuff, IObuff + 1, STRLEN(IObuff));
|
||||
d[-3] = NUL;
|
||||
} else if (d > IObuff + 4 && d[-3] == '`'
|
||||
&& d[-2] == '\\' && d[-1] == '.') {
|
||||
/* remove the backticks and dot from `command`\. */
|
||||
mch_memmove(IObuff, IObuff + 1, STRLEN(IObuff));
|
||||
memmove(IObuff, IObuff + 1, STRLEN(IObuff));
|
||||
d[-4] = NUL;
|
||||
}
|
||||
}
|
||||
|
@ -11,6 +11,8 @@
|
||||
* ex_cmds2.c: some more functions for command line commands
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "vim.h"
|
||||
#include "version_defs.h"
|
||||
#include "ex_cmds2.h"
|
||||
@ -582,7 +584,7 @@ void ex_breakdel(exarg_T *eap)
|
||||
vim_regfree(DEBUGGY(gap, todel).dbg_prog);
|
||||
--gap->ga_len;
|
||||
if (todel < gap->ga_len)
|
||||
mch_memmove(&DEBUGGY(gap, todel), &DEBUGGY(gap, todel + 1),
|
||||
memmove(&DEBUGGY(gap, todel), &DEBUGGY(gap, todel + 1),
|
||||
(gap->ga_len - todel) * sizeof(struct debuggy));
|
||||
if (eap->cmdidx == CMD_breakdel)
|
||||
++debug_tick;
|
||||
@ -1629,7 +1631,7 @@ do_arglist (
|
||||
(colnr_T)0)) {
|
||||
didone = TRUE;
|
||||
vim_free(ARGLIST[match].ae_fname);
|
||||
mch_memmove(ARGLIST + match, ARGLIST + match + 1,
|
||||
memmove(ARGLIST + match, ARGLIST + match + 1,
|
||||
(ARGCOUNT - match - 1) * sizeof(aentry_T));
|
||||
--ALIST(curwin)->al_ga.ga_len;
|
||||
if (curwin->w_arg_idx > match)
|
||||
@ -1973,7 +1975,7 @@ void ex_argdelete(exarg_T *eap)
|
||||
else {
|
||||
for (i = eap->line1; i <= eap->line2; ++i)
|
||||
vim_free(ARGLIST[i - 1].ae_fname);
|
||||
mch_memmove(ARGLIST + eap->line1 - 1, ARGLIST + eap->line2,
|
||||
memmove(ARGLIST + eap->line1 - 1, ARGLIST + eap->line2,
|
||||
(size_t)((ARGCOUNT - eap->line2) * sizeof(aentry_T)));
|
||||
ALIST(curwin)->al_ga.ga_len -= n;
|
||||
if (curwin->w_arg_idx >= eap->line2)
|
||||
@ -2134,7 +2136,7 @@ alist_add_list (
|
||||
if (after > ARGCOUNT)
|
||||
after = ARGCOUNT;
|
||||
if (after < ARGCOUNT)
|
||||
mch_memmove(&(ARGLIST[after + count]), &(ARGLIST[after]),
|
||||
memmove(&(ARGLIST[after + count]), &(ARGLIST[after]),
|
||||
(ARGCOUNT - after) * sizeof(aentry_T));
|
||||
for (i = 0; i < count; ++i) {
|
||||
ARGLIST[after + i].ae_fname = files[i];
|
||||
|
@ -3872,9 +3872,9 @@ static char_u *repl_cmdline(exarg_T *eap, char_u *src, int srclen, char_u *repl,
|
||||
* Copy the next commands, if there are any.
|
||||
*/
|
||||
i = (int)(src - *cmdlinep); /* length of part before match */
|
||||
mch_memmove(new_cmdline, *cmdlinep, (size_t)i);
|
||||
memmove(new_cmdline, *cmdlinep, (size_t)i);
|
||||
|
||||
mch_memmove(new_cmdline + i, repl, (size_t)len);
|
||||
memmove(new_cmdline + i, repl, (size_t)len);
|
||||
i += len; /* remember the end of the string */
|
||||
STRCPY(new_cmdline + i, src + srclen);
|
||||
src = new_cmdline + i; /* remember where to continue */
|
||||
@ -4399,7 +4399,7 @@ static int uc_add_command(char_u *name, size_t name_len, char_u *rep, long argt,
|
||||
goto fail;
|
||||
|
||||
cmd = USER_CMD_GA(gap, i);
|
||||
mch_memmove(cmd + 1, cmd, (gap->ga_len - i) * sizeof(ucmd_T));
|
||||
memmove(cmd + 1, cmd, (gap->ga_len - i) * sizeof(ucmd_T));
|
||||
|
||||
++gap->ga_len;
|
||||
|
||||
@ -4817,7 +4817,7 @@ static void ex_delcommand(exarg_T *eap)
|
||||
--gap->ga_len;
|
||||
|
||||
if (i < gap->ga_len)
|
||||
mch_memmove(cmd, cmd + 1, (gap->ga_len - i) * sizeof(ucmd_T));
|
||||
memmove(cmd, cmd + 1, (gap->ga_len - i) * sizeof(ucmd_T));
|
||||
}
|
||||
|
||||
/*
|
||||
@ -5131,7 +5131,7 @@ static void do_ucmd(exarg_T *eap)
|
||||
* Also change K_SPECIAL KS_EXTRA KE_CSI into CSI. */
|
||||
len = ksp - p;
|
||||
if (len > 0) {
|
||||
mch_memmove(q, p, len);
|
||||
memmove(q, p, len);
|
||||
q += len;
|
||||
}
|
||||
*q++ = ksp[1] == KS_SPECIAL ? K_SPECIAL : CSI;
|
||||
@ -5152,7 +5152,7 @@ static void do_ucmd(exarg_T *eap)
|
||||
if (buf == NULL)
|
||||
totlen += len;
|
||||
else {
|
||||
mch_memmove(q, p, len);
|
||||
memmove(q, p, len);
|
||||
q += len;
|
||||
}
|
||||
|
||||
@ -8180,7 +8180,7 @@ char_u *expand_sfile(char_u *arg)
|
||||
vim_free(result);
|
||||
return NULL;
|
||||
}
|
||||
mch_memmove(newres, result, (size_t)(p - result));
|
||||
memmove(newres, result, (size_t)(p - result));
|
||||
STRCPY(newres + (p - result), repl);
|
||||
len = (int)STRLEN(newres);
|
||||
STRCAT(newres, p + srclen);
|
||||
|
@ -1851,7 +1851,7 @@ add_indent:
|
||||
char_u *s = skipwhite(p);
|
||||
|
||||
ga_grow(&line_ga, 1);
|
||||
mch_memmove(s + 1, s, line_ga.ga_len - (s - p) + 1);
|
||||
memmove(s + 1, s, line_ga.ga_len - (s - p) + 1);
|
||||
*s = ' ';
|
||||
++line_ga.ga_len;
|
||||
}
|
||||
@ -1892,7 +1892,7 @@ redraw:
|
||||
while (get_indent_str(p, 8) > indent) {
|
||||
char_u *s = skipwhite(p);
|
||||
|
||||
mch_memmove(s - 1, s, line_ga.ga_len - (s - p) + 1);
|
||||
memmove(s - 1, s, line_ga.ga_len - (s - p) + 1);
|
||||
--line_ga.ga_len;
|
||||
}
|
||||
goto add_indent;
|
||||
@ -2024,7 +2024,7 @@ static int realloc_cmdbuff(int len)
|
||||
}
|
||||
/* There isn't always a NUL after the command, but it may need to be
|
||||
* there, thus copy up to the NUL and add a NUL. */
|
||||
mch_memmove(ccline.cmdbuff, p, (size_t)ccline.cmdlen);
|
||||
memmove(ccline.cmdbuff, p, (size_t)ccline.cmdlen);
|
||||
ccline.cmdbuff[ccline.cmdlen] = NUL;
|
||||
vim_free(p);
|
||||
|
||||
@ -2141,7 +2141,7 @@ static void draw_cmdline(int start, int len)
|
||||
}
|
||||
} else {
|
||||
prev_c = u8c;
|
||||
mch_memmove(arshape_buf + newlen, p, mb_l);
|
||||
memmove(arshape_buf + newlen, p, mb_l);
|
||||
newlen += mb_l;
|
||||
}
|
||||
}
|
||||
@ -2212,7 +2212,7 @@ int put_on_cmdline(char_u *str, int len, int redraw)
|
||||
retval = OK;
|
||||
if (retval == OK) {
|
||||
if (!ccline.overstrike) {
|
||||
mch_memmove(ccline.cmdbuff + ccline.cmdpos + len,
|
||||
memmove(ccline.cmdbuff + ccline.cmdpos + len,
|
||||
ccline.cmdbuff + ccline.cmdpos,
|
||||
(size_t)(ccline.cmdlen - ccline.cmdpos));
|
||||
ccline.cmdlen += len;
|
||||
@ -2228,7 +2228,7 @@ int put_on_cmdline(char_u *str, int len, int redraw)
|
||||
i += (*mb_ptr2len)(ccline.cmdbuff + i))
|
||||
--m;
|
||||
if (i < ccline.cmdlen) {
|
||||
mch_memmove(ccline.cmdbuff + ccline.cmdpos + len,
|
||||
memmove(ccline.cmdbuff + ccline.cmdpos + len,
|
||||
ccline.cmdbuff + i, (size_t)(ccline.cmdlen - i));
|
||||
ccline.cmdlen += ccline.cmdpos + len - i;
|
||||
} else
|
||||
@ -2236,7 +2236,7 @@ int put_on_cmdline(char_u *str, int len, int redraw)
|
||||
} else if (ccline.cmdpos + len > ccline.cmdlen)
|
||||
ccline.cmdlen = ccline.cmdpos + len;
|
||||
}
|
||||
mch_memmove(ccline.cmdbuff + ccline.cmdpos, str, (size_t)len);
|
||||
memmove(ccline.cmdbuff + ccline.cmdpos, str, (size_t)len);
|
||||
ccline.cmdbuff[ccline.cmdlen] = NUL;
|
||||
|
||||
if (enc_utf8) {
|
||||
@ -2497,7 +2497,7 @@ void cmdline_paste_str(char_u *s, int literally)
|
||||
*/
|
||||
static void cmdline_del(int from)
|
||||
{
|
||||
mch_memmove(ccline.cmdbuff + from, ccline.cmdbuff + ccline.cmdpos,
|
||||
memmove(ccline.cmdbuff + from, ccline.cmdbuff + ccline.cmdpos,
|
||||
(size_t)(ccline.cmdlen - ccline.cmdpos + 1));
|
||||
ccline.cmdlen -= ccline.cmdpos - from;
|
||||
ccline.cmdpos = from;
|
||||
@ -2724,10 +2724,10 @@ nextwild (
|
||||
} else
|
||||
v = OK;
|
||||
if (v == OK) {
|
||||
mch_memmove(&ccline.cmdbuff[ccline.cmdpos + difflen],
|
||||
memmove(&ccline.cmdbuff[ccline.cmdpos + difflen],
|
||||
&ccline.cmdbuff[ccline.cmdpos],
|
||||
(size_t)(ccline.cmdlen - ccline.cmdpos + 1));
|
||||
mch_memmove(&ccline.cmdbuff[i], p2, STRLEN(p2));
|
||||
memmove(&ccline.cmdbuff[i], p2, STRLEN(p2));
|
||||
ccline.cmdlen += difflen;
|
||||
ccline.cmdpos += difflen;
|
||||
}
|
||||
@ -5037,12 +5037,12 @@ int read_viminfo_history(vir_T *virp, int writing)
|
||||
if (type == HIST_SEARCH) {
|
||||
/* Search entry: Move the separator from the first
|
||||
* column to after the NUL. */
|
||||
mch_memmove(p, val + 1, (size_t)len);
|
||||
memmove(p, val + 1, (size_t)len);
|
||||
p[len] = sep;
|
||||
} else {
|
||||
/* Not a search entry: No separator in the viminfo
|
||||
* file, add a NUL separator. */
|
||||
mch_memmove(p, val, (size_t)len + 1);
|
||||
memmove(p, val, (size_t)len + 1);
|
||||
p[len + 1] = NUL;
|
||||
}
|
||||
viminfo_history[type][viminfo_hisidx[type]++] = p;
|
||||
|
44
src/fileio.c
44
src/fileio.c
@ -11,6 +11,8 @@
|
||||
* fileio.c: read from and write to a file
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "vim.h"
|
||||
#include "fileio.h"
|
||||
#include "blowfish.h"
|
||||
@ -1026,7 +1028,7 @@ retry:
|
||||
break;
|
||||
}
|
||||
if (linerest) /* copy characters from the previous buffer */
|
||||
mch_memmove(new_buffer, ptr - linerest, (size_t)linerest);
|
||||
memmove(new_buffer, ptr - linerest, (size_t)linerest);
|
||||
vim_free(buffer);
|
||||
buffer = new_buffer;
|
||||
ptr = buffer + linerest;
|
||||
@ -1059,7 +1061,7 @@ retry:
|
||||
|
||||
if (conv_restlen > 0) {
|
||||
/* Insert unconverted bytes from previous line. */
|
||||
mch_memmove(ptr, conv_rest, conv_restlen);
|
||||
memmove(ptr, conv_rest, conv_restlen);
|
||||
ptr += conv_restlen;
|
||||
size -= conv_restlen;
|
||||
}
|
||||
@ -1219,7 +1221,7 @@ retry:
|
||||
/* Remove BOM from the text */
|
||||
filesize += blen;
|
||||
size -= blen;
|
||||
mch_memmove(ptr, ptr + blen, (size_t)size);
|
||||
memmove(ptr, ptr + blen, (size_t)size);
|
||||
if (set_options) {
|
||||
curbuf->b_p_bomb = TRUE;
|
||||
curbuf->b_start_bomb = TRUE;
|
||||
@ -1301,13 +1303,13 @@ retry:
|
||||
if (from_size > 0) {
|
||||
/* Some remaining characters, keep them for the next
|
||||
* round. */
|
||||
mch_memmove(conv_rest, (char_u *)fromp, from_size);
|
||||
memmove(conv_rest, (char_u *)fromp, from_size);
|
||||
conv_restlen = (int)from_size;
|
||||
}
|
||||
|
||||
/* move the linerest to before the converted characters */
|
||||
line_start = ptr - linerest;
|
||||
mch_memmove(line_start, buffer, (size_t)linerest);
|
||||
memmove(line_start, buffer, (size_t)linerest);
|
||||
size = (long)((char_u *)top - ptr);
|
||||
}
|
||||
# endif
|
||||
@ -1378,7 +1380,7 @@ retry:
|
||||
* conv_rest[]. */
|
||||
if (tail != NULL) {
|
||||
conv_restlen = (int)((ptr + size) - tail);
|
||||
mch_memmove(conv_rest, (char_u *)tail, conv_restlen);
|
||||
memmove(conv_rest, (char_u *)tail, conv_restlen);
|
||||
size -= conv_restlen;
|
||||
}
|
||||
|
||||
@ -1499,7 +1501,7 @@ retry:
|
||||
|
||||
/* move the linerest to before the converted characters */
|
||||
line_start = dest - linerest;
|
||||
mch_memmove(line_start, buffer, (size_t)linerest);
|
||||
memmove(line_start, buffer, (size_t)linerest);
|
||||
size = (long)((ptr + real_size) - dest);
|
||||
ptr = dest;
|
||||
} else if (enc_utf8 && !curbuf->b_p_bin) {
|
||||
@ -1530,7 +1532,7 @@ retry:
|
||||
* already done so. */
|
||||
if (p > ptr) {
|
||||
conv_restlen = todo;
|
||||
mch_memmove(conv_rest, p, conv_restlen);
|
||||
memmove(conv_rest, p, conv_restlen);
|
||||
size -= conv_restlen;
|
||||
break;
|
||||
}
|
||||
@ -1552,7 +1554,7 @@ retry:
|
||||
|
||||
/* Drop, keep or replace the bad byte. */
|
||||
if (bad_char_behavior == BAD_DROP) {
|
||||
mch_memmove(p, p + 1, todo - 1);
|
||||
memmove(p, p + 1, todo - 1);
|
||||
--p;
|
||||
--size;
|
||||
} else if (bad_char_behavior != BAD_KEEP)
|
||||
@ -2338,7 +2340,7 @@ check_for_cryptkey (
|
||||
/* Remove magic number from the text */
|
||||
*filesizep += CRYPT_MAGIC_LEN + salt_len + seed_len;
|
||||
*sizep -= CRYPT_MAGIC_LEN + salt_len + seed_len;
|
||||
mch_memmove(ptr, ptr + CRYPT_MAGIC_LEN + salt_len + seed_len,
|
||||
memmove(ptr, ptr + CRYPT_MAGIC_LEN + salt_len + seed_len,
|
||||
(size_t)*sizep);
|
||||
/* Restore the read-only flag. */
|
||||
curbuf->b_p_ro = b_p_ro;
|
||||
@ -4050,7 +4052,7 @@ nofail:
|
||||
* front of the file name. */
|
||||
if (errnum != NULL) {
|
||||
STRMOVE(IObuff + numlen, IObuff);
|
||||
mch_memmove(IObuff, errnum, (size_t)numlen);
|
||||
memmove(IObuff, errnum, (size_t)numlen);
|
||||
}
|
||||
STRCAT(IObuff, errmsg);
|
||||
emsg(IObuff);
|
||||
@ -4332,7 +4334,7 @@ static int buf_write_bytes(struct bw_info *ip)
|
||||
l = CONV_RESTLEN - ip->bw_restlen;
|
||||
if (l > len)
|
||||
l = len;
|
||||
mch_memmove(ip->bw_rest + ip->bw_restlen, buf, (size_t)l);
|
||||
memmove(ip->bw_rest + ip->bw_restlen, buf, (size_t)l);
|
||||
n = utf_ptr2len_len(ip->bw_rest, ip->bw_restlen + l);
|
||||
if (n > ip->bw_restlen + len) {
|
||||
/* We have an incomplete byte sequence at the end to
|
||||
@ -4352,7 +4354,7 @@ static int buf_write_bytes(struct bw_info *ip)
|
||||
ip->bw_restlen = 0;
|
||||
} else {
|
||||
ip->bw_restlen -= n;
|
||||
mch_memmove(ip->bw_rest, ip->bw_rest + n,
|
||||
memmove(ip->bw_rest, ip->bw_rest + n,
|
||||
(size_t)ip->bw_restlen);
|
||||
n = 0;
|
||||
}
|
||||
@ -4365,7 +4367,7 @@ static int buf_write_bytes(struct bw_info *ip)
|
||||
if (len - wlen > CONV_RESTLEN)
|
||||
return FAIL;
|
||||
ip->bw_restlen = len - wlen;
|
||||
mch_memmove(ip->bw_rest, buf + wlen,
|
||||
memmove(ip->bw_rest, buf + wlen,
|
||||
(size_t)ip->bw_restlen);
|
||||
break;
|
||||
}
|
||||
@ -4405,8 +4407,8 @@ static int buf_write_bytes(struct bw_info *ip)
|
||||
* conversion buffer for this. */
|
||||
fromlen = len + ip->bw_restlen;
|
||||
from = ip->bw_conv_buf + ip->bw_conv_buflen - fromlen;
|
||||
mch_memmove(from, ip->bw_rest, (size_t)ip->bw_restlen);
|
||||
mch_memmove(from + ip->bw_restlen, buf, (size_t)len);
|
||||
memmove(from, ip->bw_rest, (size_t)ip->bw_restlen);
|
||||
memmove(from + ip->bw_restlen, buf, (size_t)len);
|
||||
} else {
|
||||
from = buf;
|
||||
fromlen = len;
|
||||
@ -4438,8 +4440,8 @@ static int buf_write_bytes(struct bw_info *ip)
|
||||
* conversion buffer for this. */
|
||||
fromlen = len + ip->bw_restlen;
|
||||
fp = (char *)ip->bw_conv_buf + ip->bw_conv_buflen - fromlen;
|
||||
mch_memmove(fp, ip->bw_rest, (size_t)ip->bw_restlen);
|
||||
mch_memmove(fp + ip->bw_restlen, buf, (size_t)len);
|
||||
memmove(fp, ip->bw_rest, (size_t)ip->bw_restlen);
|
||||
memmove(fp + ip->bw_restlen, buf, (size_t)len);
|
||||
from = fp;
|
||||
tolen = ip->bw_conv_buflen - fromlen;
|
||||
} else {
|
||||
@ -4477,7 +4479,7 @@ static int buf_write_bytes(struct bw_info *ip)
|
||||
|
||||
/* copy remainder to ip->bw_rest[] to be used for the next call. */
|
||||
if (fromlen > 0)
|
||||
mch_memmove(ip->bw_rest, (void *)from, fromlen);
|
||||
memmove(ip->bw_rest, (void *)from, fromlen);
|
||||
ip->bw_restlen = (int)fromlen;
|
||||
|
||||
buf = ip->bw_conv_buf;
|
||||
@ -8248,7 +8250,7 @@ file_pat_to_reg_pat (
|
||||
/* The 'pattern' is a filetype check ONLY */
|
||||
reg_pat = (char_u *)alloc(check_length + 1);
|
||||
if (reg_pat != NULL) {
|
||||
mch_memmove(reg_pat, pat, (size_t)check_length);
|
||||
memmove(reg_pat, pat, (size_t)check_length);
|
||||
reg_pat[check_length] = NUL;
|
||||
}
|
||||
return reg_pat;
|
||||
@ -8295,7 +8297,7 @@ file_pat_to_reg_pat (
|
||||
#ifdef FEAT_OSFILETYPE
|
||||
/* Copy the type check in to the start. */
|
||||
if (check_length)
|
||||
mch_memmove(reg_pat, pat - check_length, (size_t)check_length);
|
||||
memmove(reg_pat, pat - check_length, (size_t)check_length);
|
||||
i = check_length;
|
||||
#else
|
||||
i = 0;
|
||||
|
12
src/fold.c
12
src/fold.c
@ -624,7 +624,7 @@ void foldCreate(linenr_T start, linenr_T end)
|
||||
if (end_rel < fp[cont - 1].fd_top + fp[cont - 1].fd_len - 1)
|
||||
end_rel = fp[cont - 1].fd_top + fp[cont - 1].fd_len - 1;
|
||||
/* Move contained folds to inside new fold. */
|
||||
mch_memmove(fold_ga.ga_data, fp, sizeof(fold_T) * cont);
|
||||
memmove(fold_ga.ga_data, fp, sizeof(fold_T) * cont);
|
||||
fold_ga.ga_len += cont;
|
||||
i += cont;
|
||||
|
||||
@ -635,7 +635,7 @@ void foldCreate(linenr_T start, linenr_T end)
|
||||
}
|
||||
/* Move remaining entries to after the new fold. */
|
||||
if (i < gap->ga_len)
|
||||
mch_memmove(fp + 1, (fold_T *)gap->ga_data + i,
|
||||
memmove(fp + 1, (fold_T *)gap->ga_data + i,
|
||||
sizeof(fold_T) * (gap->ga_len - i));
|
||||
gap->ga_len = gap->ga_len + 1 - cont;
|
||||
|
||||
@ -1302,7 +1302,7 @@ static void deleteFoldEntry(garray_T *gap, int idx, int recursive)
|
||||
deleteFoldRecurse(&fp->fd_nested);
|
||||
--gap->ga_len;
|
||||
if (idx < gap->ga_len)
|
||||
mch_memmove(fp, fp + 1, sizeof(fold_T) * (gap->ga_len - idx));
|
||||
memmove(fp, fp + 1, sizeof(fold_T) * (gap->ga_len - idx));
|
||||
} else {
|
||||
/* Move nested folds one level up, to overwrite the fold that is
|
||||
* deleted. */
|
||||
@ -1323,10 +1323,10 @@ static void deleteFoldEntry(garray_T *gap, int idx, int recursive)
|
||||
|
||||
/* move the existing folds down to make room */
|
||||
if (idx + 1 < gap->ga_len)
|
||||
mch_memmove(fp + moved, fp + 1,
|
||||
memmove(fp + moved, fp + 1,
|
||||
sizeof(fold_T) * (gap->ga_len - (idx + 1)));
|
||||
/* move the contained folds one level up */
|
||||
mch_memmove(fp, nfp, (size_t)(sizeof(fold_T) * moved));
|
||||
memmove(fp, nfp, (size_t)(sizeof(fold_T) * moved));
|
||||
vim_free(nfp);
|
||||
gap->ga_len += moved - 1;
|
||||
}
|
||||
@ -2516,7 +2516,7 @@ static int foldInsert(garray_T *gap, int i)
|
||||
return FAIL;
|
||||
fp = (fold_T *)gap->ga_data + i;
|
||||
if (i < gap->ga_len)
|
||||
mch_memmove(fp + 1, fp, sizeof(fold_T) * (gap->ga_len - i));
|
||||
memmove(fp + 1, fp, sizeof(fold_T) * (gap->ga_len - i));
|
||||
++gap->ga_len;
|
||||
ga_init2(&fp->fd_nested, (int)sizeof(fold_T), 10);
|
||||
return OK;
|
||||
|
@ -126,7 +126,7 @@ void ga_concat(garray_T *gap, char_u *s)
|
||||
{
|
||||
int len = (int)STRLEN(s);
|
||||
if (ga_grow(gap, len) == OK) {
|
||||
mch_memmove((char *)gap->ga_data + gap->ga_len, s, (size_t)len);
|
||||
memmove((char *)gap->ga_data + gap->ga_len, s, (size_t)len);
|
||||
gap->ga_len += len;
|
||||
}
|
||||
}
|
||||
|
@ -269,7 +269,7 @@ add_buff (
|
||||
EMSG(_("E222: Add to read buffer"));
|
||||
return;
|
||||
} else if (buf->bh_index != 0)
|
||||
mch_memmove(buf->bh_first.b_next->b_str,
|
||||
memmove(buf->bh_first.b_next->b_str,
|
||||
buf->bh_first.b_next->b_str + buf->bh_index,
|
||||
STRLEN(buf->bh_first.b_next->b_str + buf->bh_index) + 1);
|
||||
buf->bh_index = 0;
|
||||
@ -847,7 +847,7 @@ int ins_typebuf(char_u *str, int noremap, int offset, int nottyped, int silent)
|
||||
*/
|
||||
if (offset == 0 && addlen <= typebuf.tb_off) {
|
||||
typebuf.tb_off -= addlen;
|
||||
mch_memmove(typebuf.tb_buf + typebuf.tb_off, str, (size_t)addlen);
|
||||
memmove(typebuf.tb_buf + typebuf.tb_off, str, (size_t)addlen);
|
||||
}
|
||||
/*
|
||||
* Need to allocate a new buffer.
|
||||
@ -874,22 +874,22 @@ int ins_typebuf(char_u *str, int noremap, int offset, int nottyped, int silent)
|
||||
typebuf.tb_buflen = newlen;
|
||||
|
||||
/* copy the old chars, before the insertion point */
|
||||
mch_memmove(s1 + newoff, typebuf.tb_buf + typebuf.tb_off,
|
||||
memmove(s1 + newoff, typebuf.tb_buf + typebuf.tb_off,
|
||||
(size_t)offset);
|
||||
/* copy the new chars */
|
||||
mch_memmove(s1 + newoff + offset, str, (size_t)addlen);
|
||||
memmove(s1 + newoff + offset, str, (size_t)addlen);
|
||||
/* copy the old chars, after the insertion point, including the NUL at
|
||||
* the end */
|
||||
mch_memmove(s1 + newoff + offset + addlen,
|
||||
memmove(s1 + newoff + offset + addlen,
|
||||
typebuf.tb_buf + typebuf.tb_off + offset,
|
||||
(size_t)(typebuf.tb_len - offset + 1));
|
||||
if (typebuf.tb_buf != typebuf_init)
|
||||
vim_free(typebuf.tb_buf);
|
||||
typebuf.tb_buf = s1;
|
||||
|
||||
mch_memmove(s2 + newoff, typebuf.tb_noremap + typebuf.tb_off,
|
||||
memmove(s2 + newoff, typebuf.tb_noremap + typebuf.tb_off,
|
||||
(size_t)offset);
|
||||
mch_memmove(s2 + newoff + offset + addlen,
|
||||
memmove(s2 + newoff + offset + addlen,
|
||||
typebuf.tb_noremap + typebuf.tb_off + offset,
|
||||
(size_t)(typebuf.tb_len - offset));
|
||||
if (typebuf.tb_noremap != noremapbuf_init)
|
||||
@ -1024,18 +1024,18 @@ void del_typebuf(int len, int offset)
|
||||
* Leave some extra room at the end to avoid reallocation.
|
||||
*/
|
||||
if (typebuf.tb_off > MAXMAPLEN) {
|
||||
mch_memmove(typebuf.tb_buf + MAXMAPLEN,
|
||||
memmove(typebuf.tb_buf + MAXMAPLEN,
|
||||
typebuf.tb_buf + typebuf.tb_off, (size_t)offset);
|
||||
mch_memmove(typebuf.tb_noremap + MAXMAPLEN,
|
||||
memmove(typebuf.tb_noremap + MAXMAPLEN,
|
||||
typebuf.tb_noremap + typebuf.tb_off, (size_t)offset);
|
||||
typebuf.tb_off = MAXMAPLEN;
|
||||
}
|
||||
/* adjust typebuf.tb_buf (include the NUL at the end) */
|
||||
mch_memmove(typebuf.tb_buf + typebuf.tb_off + offset,
|
||||
memmove(typebuf.tb_buf + typebuf.tb_off + offset,
|
||||
typebuf.tb_buf + i + len,
|
||||
(size_t)(typebuf.tb_len - offset + 1));
|
||||
/* adjust typebuf.tb_noremap[] */
|
||||
mch_memmove(typebuf.tb_noremap + typebuf.tb_off + offset,
|
||||
memmove(typebuf.tb_noremap + typebuf.tb_off + offset,
|
||||
typebuf.tb_noremap + i + len,
|
||||
(size_t)(typebuf.tb_len - offset));
|
||||
}
|
||||
@ -2520,7 +2520,7 @@ fix_input_buffer (
|
||||
&& (i < 2 || p[1] != KS_EXTRA || p[2] !=
|
||||
(int)KE_CURSORHOLD)
|
||||
)) {
|
||||
mch_memmove(p + 3, p + 1, (size_t)i);
|
||||
memmove(p + 3, p + 1, (size_t)i);
|
||||
p[2] = K_THIRD(p[0]);
|
||||
p[1] = K_SECOND(p[0]);
|
||||
p[0] = K_SPECIAL;
|
||||
|
@ -337,7 +337,7 @@ static int hash_may_resize(hashtab_T *ht, int minitems)
|
||||
// Moving from ht_smallarray to ht_smallarray! Happens when there
|
||||
// are many removed items. Copy the items to be able to clean up
|
||||
// removed items.
|
||||
mch_memmove(temparray, newarray, sizeof(temparray));
|
||||
memmove(temparray, newarray, sizeof(temparray));
|
||||
oldarray = temparray;
|
||||
} else {
|
||||
oldarray = ht->ht_array;
|
||||
|
@ -245,7 +245,7 @@ set_indent (
|
||||
*s++ = ' ';
|
||||
--todo;
|
||||
}
|
||||
mch_memmove(s, p, (size_t)line_len);
|
||||
memmove(s, p, (size_t)line_len);
|
||||
|
||||
/* Replace the line (unless undo fails). */
|
||||
if (!(flags & SIN_UNDO) || u_savesub(curwin->w_cursor.lnum) == OK) {
|
||||
@ -353,7 +353,7 @@ int copy_indent(int size, char_u *src)
|
||||
}
|
||||
|
||||
/* Append the original line */
|
||||
mch_memmove(p, ml_get_curline(), (size_t)line_len);
|
||||
memmove(p, ml_get_curline(), (size_t)line_len);
|
||||
|
||||
/* Replace the line */
|
||||
ml_replace(curwin->w_cursor.lnum, line, FALSE);
|
||||
|
@ -11,6 +11,8 @@
|
||||
* mark.c: functions for setting marks and jumping to them
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "vim.h"
|
||||
#include "mark.h"
|
||||
#include "buffer.h"
|
||||
@ -1502,7 +1504,7 @@ void copy_viminfo_marks(vir_T *virp, FILE *fp_out, int count, int eof, int flags
|
||||
* first */
|
||||
if (curbuf->b_changelistlen == JUMPLISTSIZE)
|
||||
/* list is full, remove oldest entry */
|
||||
mch_memmove(curbuf->b_changelist,
|
||||
memmove(curbuf->b_changelist,
|
||||
curbuf->b_changelist + 1,
|
||||
sizeof(pos_T) * (JUMPLISTSIZE - 1));
|
||||
else
|
||||
|
10
src/mbyte.c
10
src/mbyte.c
@ -77,6 +77,8 @@
|
||||
* some commands, like ":menutrans"
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "vim.h"
|
||||
#include "mbyte.h"
|
||||
#include "charset.h"
|
||||
@ -3048,7 +3050,7 @@ void mb_copy_char(char_u **fp, char_u **tp)
|
||||
{
|
||||
int l = (*mb_ptr2len)(*fp);
|
||||
|
||||
mch_memmove(*tp, *fp, (size_t)l);
|
||||
memmove(*tp, *fp, (size_t)l);
|
||||
*tp += l;
|
||||
*fp += l;
|
||||
}
|
||||
@ -3583,7 +3585,7 @@ static char_u * iconv_string(vimconv_T *vcp, char_u *str, int slen, int *unconvl
|
||||
len = len + fromlen * 2 + 40;
|
||||
p = alloc((unsigned)len);
|
||||
if (p != NULL && done > 0)
|
||||
mch_memmove(p, result, done);
|
||||
memmove(p, result, done);
|
||||
vim_free(result);
|
||||
result = p;
|
||||
if (result == NULL) /* out of memory */
|
||||
@ -3902,10 +3904,10 @@ int convert_input_safe(ptr, len, maxlen, restp, restlenp)
|
||||
/* Move the unconverted characters to allocated memory. */
|
||||
*restp = alloc(unconvertlen);
|
||||
if (*restp != NULL)
|
||||
mch_memmove(*restp, ptr + len - unconvertlen, unconvertlen);
|
||||
memmove(*restp, ptr + len - unconvertlen, unconvertlen);
|
||||
*restlenp = unconvertlen;
|
||||
}
|
||||
mch_memmove(ptr, d, dlen);
|
||||
memmove(ptr, d, dlen);
|
||||
} else
|
||||
/* result is too long, keep the unconverted text (the caller must
|
||||
* have done something wrong!) */
|
||||
|
@ -424,7 +424,7 @@ static void ml_set_b0_crypt(buf_T *buf, ZERO_BL *b0p)
|
||||
b0p->b0_id[1] = BLOCK0_ID1_C1;
|
||||
/* Generate a seed and store it in block 0 and in the memfile. */
|
||||
sha2_seed(&b0p->b0_seed, MF_SEED_LEN, NULL, 0);
|
||||
mch_memmove(buf->b_ml.ml_mfp->mf_seed, &b0p->b0_seed, MF_SEED_LEN);
|
||||
memmove(buf->b_ml.ml_mfp->mf_seed, &b0p->b0_seed, MF_SEED_LEN);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -458,7 +458,7 @@ void ml_set_crypt_key(buf_T *buf, char_u *old_key, int old_cm)
|
||||
mfp->mf_old_key = old_key;
|
||||
mfp->mf_old_cm = old_cm;
|
||||
if (old_cm > 0)
|
||||
mch_memmove(mfp->mf_old_seed, mfp->mf_seed, MF_SEED_LEN);
|
||||
memmove(mfp->mf_old_seed, mfp->mf_seed, MF_SEED_LEN);
|
||||
|
||||
/* Update block 0 with the crypt flag and may set a new seed. */
|
||||
ml_upd_block0(buf, UB_CRYPT);
|
||||
@ -857,8 +857,8 @@ static void set_b0_fname(ZERO_BL *b0p, buf_T *buf)
|
||||
vim_strncpy(b0p->b0_fname, buf->b_ffname,
|
||||
B0_FNAME_SIZE_CRYPT - 1);
|
||||
} else {
|
||||
mch_memmove(b0p->b0_fname + ulen + 1, b0p->b0_fname + 1, flen);
|
||||
mch_memmove(b0p->b0_fname + 1, uname, ulen);
|
||||
memmove(b0p->b0_fname + ulen + 1, b0p->b0_fname + 1, flen);
|
||||
memmove(b0p->b0_fname + 1, uname, ulen);
|
||||
}
|
||||
}
|
||||
if (mch_stat((char *)buf->b_ffname, &st) >= 0) {
|
||||
@ -916,7 +916,7 @@ static void add_b0_fenc(ZERO_BL *b0p, buf_T *buf)
|
||||
if ((int)STRLEN(b0p->b0_fname) + n + 1 > size)
|
||||
b0p->b0_flags &= ~B0_HAS_FENC;
|
||||
else {
|
||||
mch_memmove((char *)b0p->b0_fname + size - n,
|
||||
memmove((char *)b0p->b0_fname + size - n,
|
||||
(char *)buf->b_p_fenc, (size_t)n);
|
||||
*(b0p->b0_fname + size - n - 1) = NUL;
|
||||
b0p->b0_flags |= B0_HAS_FENC;
|
||||
@ -1100,7 +1100,7 @@ void ml_recover(void)
|
||||
b0_cm = 0;
|
||||
else if (b0p->b0_id[1] == BLOCK0_ID1_C1) {
|
||||
b0_cm = 1;
|
||||
mch_memmove(mfp->mf_seed, &b0p->b0_seed, MF_SEED_LEN);
|
||||
memmove(mfp->mf_seed, &b0p->b0_seed, MF_SEED_LEN);
|
||||
}
|
||||
set_crypt_method(buf, b0_cm);
|
||||
|
||||
@ -1131,7 +1131,7 @@ void ml_recover(void)
|
||||
p = alloc(mfp->mf_page_size);
|
||||
if (p == NULL)
|
||||
goto theend;
|
||||
mch_memmove(p, hp->bh_data, previous_page_size);
|
||||
memmove(p, hp->bh_data, previous_page_size);
|
||||
vim_free(hp->bh_data);
|
||||
hp->bh_data = p;
|
||||
b0p = (ZERO_BL *)(hp->bh_data);
|
||||
@ -2309,7 +2309,7 @@ ml_append_int (
|
||||
offset = dp->db_txt_end;
|
||||
else
|
||||
offset = ((dp->db_index[db_idx]) & DB_INDEX_MASK);
|
||||
mch_memmove((char *)dp + dp->db_txt_start,
|
||||
memmove((char *)dp + dp->db_txt_start,
|
||||
(char *)dp + dp->db_txt_start + len,
|
||||
(size_t)(offset - (dp->db_txt_start + len)));
|
||||
for (i = line_count - 1; i > db_idx; --i)
|
||||
@ -2321,7 +2321,7 @@ ml_append_int (
|
||||
/*
|
||||
* copy the text into the block
|
||||
*/
|
||||
mch_memmove((char *)dp + dp->db_index[db_idx + 1], line, (size_t)len);
|
||||
memmove((char *)dp + dp->db_index[db_idx + 1], line, (size_t)len);
|
||||
if (mark)
|
||||
dp->db_index[db_idx + 1] |= DB_MARKED;
|
||||
|
||||
@ -2424,7 +2424,7 @@ ml_append_int (
|
||||
if (mark)
|
||||
dp_right->db_index[0] |= DB_MARKED;
|
||||
|
||||
mch_memmove((char *)dp_right + dp_right->db_txt_start,
|
||||
memmove((char *)dp_right + dp_right->db_txt_start,
|
||||
line, (size_t)len);
|
||||
++line_count_right;
|
||||
}
|
||||
@ -2436,7 +2436,7 @@ ml_append_int (
|
||||
*/
|
||||
dp_right->db_txt_start -= data_moved;
|
||||
dp_right->db_free -= total_moved;
|
||||
mch_memmove((char *)dp_right + dp_right->db_txt_start,
|
||||
memmove((char *)dp_right + dp_right->db_txt_start,
|
||||
(char *)dp_left + dp_left->db_txt_start,
|
||||
(size_t)data_moved);
|
||||
offset = dp_right->db_txt_start - dp_left->db_txt_start;
|
||||
@ -2462,7 +2462,7 @@ ml_append_int (
|
||||
dp_left->db_index[line_count_left] = dp_left->db_txt_start;
|
||||
if (mark)
|
||||
dp_left->db_index[line_count_left] |= DB_MARKED;
|
||||
mch_memmove((char *)dp_left + dp_left->db_txt_start,
|
||||
memmove((char *)dp_left + dp_left->db_txt_start,
|
||||
line, (size_t)len);
|
||||
++line_count_left;
|
||||
}
|
||||
@ -2523,7 +2523,7 @@ ml_append_int (
|
||||
/* block not full, add one entry */
|
||||
if (pp->pb_count < pp->pb_count_max) {
|
||||
if (pb_idx + 1 < (int)pp->pb_count)
|
||||
mch_memmove(&pp->pb_pointer[pb_idx + 2],
|
||||
memmove(&pp->pb_pointer[pb_idx + 2],
|
||||
&pp->pb_pointer[pb_idx + 1],
|
||||
(size_t)(pp->pb_count - pb_idx - 1) * sizeof(PTR_EN));
|
||||
++pp->pb_count;
|
||||
@ -2578,7 +2578,7 @@ ml_append_int (
|
||||
* block 1 is updated to point to the new block
|
||||
* then continue to split the new block
|
||||
*/
|
||||
mch_memmove(pp_new, pp, (size_t)page_size);
|
||||
memmove(pp_new, pp, (size_t)page_size);
|
||||
pp->pb_count = 1;
|
||||
pp->pb_pointer[0].pe_bnum = hp_new->bh_bnum;
|
||||
pp->pb_pointer[0].pe_line_count = buf->b_ml.ml_line_count;
|
||||
@ -2597,7 +2597,7 @@ ml_append_int (
|
||||
*/
|
||||
total_moved = pp->pb_count - pb_idx - 1;
|
||||
if (total_moved) {
|
||||
mch_memmove(&pp_new->pb_pointer[0],
|
||||
memmove(&pp_new->pb_pointer[0],
|
||||
&pp->pb_pointer[pb_idx + 1],
|
||||
(size_t)(total_moved) * sizeof(PTR_EN));
|
||||
pp_new->pb_count = total_moved;
|
||||
@ -2795,7 +2795,7 @@ static int ml_delete_int(buf_T *buf, linenr_T lnum, int message)
|
||||
mf_free(mfp, hp);
|
||||
else {
|
||||
if (count != idx) /* move entries after the deleted one */
|
||||
mch_memmove(&pp->pb_pointer[idx], &pp->pb_pointer[idx + 1],
|
||||
memmove(&pp->pb_pointer[idx], &pp->pb_pointer[idx + 1],
|
||||
(size_t)(count - idx) * sizeof(PTR_EN));
|
||||
mf_put(mfp, hp, TRUE, FALSE);
|
||||
|
||||
@ -2817,7 +2817,7 @@ static int ml_delete_int(buf_T *buf, linenr_T lnum, int message)
|
||||
* delete the text by moving the next lines forwards
|
||||
*/
|
||||
text_start = dp->db_txt_start;
|
||||
mch_memmove((char *)dp + text_start + line_size,
|
||||
memmove((char *)dp + text_start + line_size,
|
||||
(char *)dp + text_start, (size_t)(line_start - text_start));
|
||||
|
||||
/*
|
||||
@ -3004,7 +3004,7 @@ static void ml_flush_line(buf_T *buf)
|
||||
count = buf->b_ml.ml_locked_high - buf->b_ml.ml_locked_low + 1;
|
||||
if (extra != 0 && idx < count - 1) {
|
||||
/* move text of following lines */
|
||||
mch_memmove((char *)dp + dp->db_txt_start - extra,
|
||||
memmove((char *)dp + dp->db_txt_start - extra,
|
||||
(char *)dp + dp->db_txt_start,
|
||||
(size_t)(start - dp->db_txt_start));
|
||||
|
||||
@ -3019,7 +3019,7 @@ static void ml_flush_line(buf_T *buf)
|
||||
dp->db_txt_start -= extra;
|
||||
|
||||
/* copy new line into the data block */
|
||||
mch_memmove(old_line - extra, new_line, (size_t)new_len);
|
||||
memmove(old_line - extra, new_line, (size_t)new_len);
|
||||
buf->b_ml.ml_flags |= (ML_LOCKED_DIRTY | ML_LOCKED_POS);
|
||||
/* The else case is already covered by the insert and delete */
|
||||
ml_updatechunk(buf, lnum, (long)extra, ML_CHNK_UPDLINE);
|
||||
@ -3296,7 +3296,7 @@ static int ml_add_stack(buf_T *buf)
|
||||
(buf->b_ml.ml_stack_size + STACK_INCR));
|
||||
if (newstack == NULL)
|
||||
return -1;
|
||||
mch_memmove(newstack, buf->b_ml.ml_stack,
|
||||
memmove(newstack, buf->b_ml.ml_stack,
|
||||
(size_t)top * sizeof(infoptr_T));
|
||||
vim_free(buf->b_ml.ml_stack);
|
||||
buf->b_ml.ml_stack = newstack;
|
||||
@ -4209,7 +4209,7 @@ char_u *ml_encrypt_data(memfile_T *mfp, char_u *data, off_t offset, unsigned siz
|
||||
text_len = size - dp->db_txt_start;
|
||||
|
||||
/* Copy the header and the text. */
|
||||
mch_memmove(new_data, dp, head_end - (char_u *)dp);
|
||||
memmove(new_data, dp, head_end - (char_u *)dp);
|
||||
|
||||
/* Encrypt the text. */
|
||||
crypt_push_state();
|
||||
@ -4386,7 +4386,7 @@ static void ml_updatechunk(buf_T *buf, linenr_T line, long len, int updtype)
|
||||
int text_end;
|
||||
int linecnt;
|
||||
|
||||
mch_memmove(buf->b_ml.ml_chunksize + curix + 1,
|
||||
memmove(buf->b_ml.ml_chunksize + curix + 1,
|
||||
buf->b_ml.ml_chunksize + curix,
|
||||
(buf->b_ml.ml_usedchunks - curix) *
|
||||
sizeof(chunksize_T));
|
||||
@ -4471,7 +4471,7 @@ static void ml_updatechunk(buf_T *buf, linenr_T line, long len, int updtype)
|
||||
curchnk = buf->b_ml.ml_chunksize + curix;
|
||||
} else if (curix == 0 && curchnk->mlcs_numlines <= 0) {
|
||||
buf->b_ml.ml_usedchunks--;
|
||||
mch_memmove(buf->b_ml.ml_chunksize, buf->b_ml.ml_chunksize + 1,
|
||||
memmove(buf->b_ml.ml_chunksize, buf->b_ml.ml_chunksize + 1,
|
||||
buf->b_ml.ml_usedchunks * sizeof(chunksize_T));
|
||||
return;
|
||||
} else if (curix == 0 || (curchnk->mlcs_numlines > 10
|
||||
@ -4486,7 +4486,7 @@ static void ml_updatechunk(buf_T *buf, linenr_T line, long len, int updtype)
|
||||
curchnk[-1].mlcs_totalsize += curchnk->mlcs_totalsize;
|
||||
buf->b_ml.ml_usedchunks--;
|
||||
if (curix < buf->b_ml.ml_usedchunks) {
|
||||
mch_memmove(buf->b_ml.ml_chunksize + curix,
|
||||
memmove(buf->b_ml.ml_chunksize + curix,
|
||||
buf->b_ml.ml_chunksize + curix + 1,
|
||||
(buf->b_ml.ml_usedchunks - curix) *
|
||||
sizeof(chunksize_T));
|
||||
|
@ -12,6 +12,8 @@
|
||||
* Code for menus. Used for the GUI and 'wildmenu'.
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "vim.h"
|
||||
#include "menu.h"
|
||||
#include "charset.h"
|
||||
@ -1180,7 +1182,7 @@ static char_u *popup_mode_name(char_u *name, int idx)
|
||||
|
||||
p = vim_strnsave(name, len + 1);
|
||||
if (p != NULL) {
|
||||
mch_memmove(p + 6, p + 5, (size_t)(len - 4));
|
||||
memmove(p + 6, p + 5, (size_t)(len - 4));
|
||||
p[5] = menu_mode_chars[idx];
|
||||
}
|
||||
return p;
|
||||
|
@ -312,11 +312,11 @@ void trunc_string(char_u *s, char_u *buf, int room, int buflen)
|
||||
|
||||
/* Set the middle and copy the last part. */
|
||||
if (e + 3 < buflen) {
|
||||
mch_memmove(buf + e, "...", (size_t)3);
|
||||
memmove(buf + e, "...", (size_t)3);
|
||||
len = (int)STRLEN(s + i) + 1;
|
||||
if (len >= buflen - e - 3)
|
||||
len = buflen - e - 3 - 1;
|
||||
mch_memmove(buf + e + 3, s + i, len);
|
||||
memmove(buf + e + 3, s + i, len);
|
||||
buf[e + 3 + len - 1] = NUL;
|
||||
} else {
|
||||
buf[e - 1] = NUL; /* make sure it is truncated */
|
||||
@ -1446,7 +1446,7 @@ void msg_prt_line(char_u *s, int list)
|
||||
mb_char2bytes(lcs_nbsp, buf);
|
||||
buf[(*mb_ptr2len)(buf)] = NUL;
|
||||
} else {
|
||||
mch_memmove(buf, s, (size_t)l);
|
||||
memmove(buf, s, (size_t)l);
|
||||
buf[l] = NUL;
|
||||
}
|
||||
msg_puts(buf);
|
||||
@ -2334,7 +2334,7 @@ void mch_errmsg(char *str)
|
||||
error_ga.ga_itemsize = 1;
|
||||
}
|
||||
if (ga_grow(&error_ga, len) == OK) {
|
||||
mch_memmove((char_u *)error_ga.ga_data + error_ga.ga_len,
|
||||
memmove((char_u *)error_ga.ga_data + error_ga.ga_len,
|
||||
(char_u *)str, len);
|
||||
#ifdef UNIX
|
||||
/* remove CR characters, they are displayed */
|
||||
@ -2859,7 +2859,7 @@ copy_char (
|
||||
return (*mb_char2bytes)(c, to);
|
||||
} else {
|
||||
len = (*mb_ptr2len)(from);
|
||||
mch_memmove(to, from, (size_t)len);
|
||||
memmove(to, from, (size_t)len);
|
||||
return len;
|
||||
}
|
||||
} else {
|
||||
@ -3256,7 +3256,7 @@ long a1, a2, a3, a4, a5, a6, a7, a8, a9, a10;
|
||||
if (str_l < str_m) {
|
||||
size_t avail = str_m - str_l;
|
||||
|
||||
mch_memmove(str + str_l, p, n > avail ? avail : n);
|
||||
memmove(str + str_l, p, n > avail ? avail : n);
|
||||
}
|
||||
p += n;
|
||||
str_l += n;
|
||||
@ -3886,7 +3886,7 @@ long a1, a2, a3, a4, a5, a6, a7, a8, a9, a10;
|
||||
if (str_l < str_m) {
|
||||
size_t avail = str_m - str_l;
|
||||
|
||||
mch_memmove(str + str_l, str_arg,
|
||||
memmove(str + str_l, str_arg,
|
||||
(size_t)zn > avail ? avail
|
||||
: (size_t)zn);
|
||||
}
|
||||
@ -3917,7 +3917,7 @@ long a1, a2, a3, a4, a5, a6, a7, a8, a9, a10;
|
||||
if (str_l < str_m) {
|
||||
size_t avail = str_m - str_l;
|
||||
|
||||
mch_memmove(str + str_l,
|
||||
memmove(str + str_l,
|
||||
str_arg + zero_padding_insertion_ind,
|
||||
(size_t)sn > avail ? avail : (size_t)sn);
|
||||
}
|
||||
|
42
src/misc1.c
42
src/misc1.c
@ -11,6 +11,8 @@
|
||||
* misc1.c: functions that didn't seem to fit elsewhere
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "vim.h"
|
||||
#include "version_defs.h"
|
||||
#include "misc1.h"
|
||||
@ -546,11 +548,11 @@ open_line (
|
||||
}
|
||||
l = lead_repl_len - (int)(endp - p);
|
||||
if (l != 0)
|
||||
mch_memmove(endp + l, endp,
|
||||
memmove(endp + l, endp,
|
||||
(size_t)((leader + lead_len) - endp));
|
||||
lead_len += l;
|
||||
}
|
||||
mch_memmove(p, lead_repl, (size_t)lead_repl_len);
|
||||
memmove(p, lead_repl, (size_t)lead_repl_len);
|
||||
if (p + lead_repl_len > leader + lead_len)
|
||||
p[lead_repl_len] = NUL;
|
||||
|
||||
@ -564,7 +566,7 @@ open_line (
|
||||
p[1] = ' ';
|
||||
--l;
|
||||
}
|
||||
mch_memmove(p + 1, p + l + 1,
|
||||
memmove(p + 1, p + l + 1,
|
||||
(size_t)((leader + lead_len) - (p + l + 1)));
|
||||
lead_len -= l;
|
||||
*p = ' ';
|
||||
@ -588,12 +590,12 @@ open_line (
|
||||
break;
|
||||
}
|
||||
if (i != lead_repl_len) {
|
||||
mch_memmove(p + lead_repl_len, p + i,
|
||||
memmove(p + lead_repl_len, p + i,
|
||||
(size_t)(lead_len - i - (p - leader)));
|
||||
lead_len += lead_repl_len - i;
|
||||
}
|
||||
}
|
||||
mch_memmove(p, lead_repl, (size_t)lead_repl_len);
|
||||
memmove(p, lead_repl, (size_t)lead_repl_len);
|
||||
|
||||
/* Replace any remaining non-white chars in the old
|
||||
* leader by spaces. Keep Tabs, the indent must
|
||||
@ -603,7 +605,7 @@ open_line (
|
||||
/* Don't put a space before a TAB. */
|
||||
if (p + 1 < leader + lead_len && p[1] == TAB) {
|
||||
--lead_len;
|
||||
mch_memmove(p, p + 1,
|
||||
memmove(p, p + 1,
|
||||
(leader + lead_len) - p);
|
||||
} else {
|
||||
int l = (*mb_ptr2len)(p);
|
||||
@ -615,7 +617,7 @@ open_line (
|
||||
--l;
|
||||
*p++ = ' ';
|
||||
}
|
||||
mch_memmove(p + 1, p + l,
|
||||
memmove(p + 1, p + l,
|
||||
(leader + lead_len) - p);
|
||||
lead_len -= l - 1;
|
||||
}
|
||||
@ -1515,15 +1517,15 @@ void ins_char_bytes(char_u *buf, int charlen)
|
||||
|
||||
/* Copy bytes before the cursor. */
|
||||
if (col > 0)
|
||||
mch_memmove(newp, oldp, (size_t)col);
|
||||
memmove(newp, oldp, (size_t)col);
|
||||
|
||||
/* Copy bytes after the changed character(s). */
|
||||
p = newp + col;
|
||||
mch_memmove(p + newlen, oldp + col + oldlen,
|
||||
memmove(p + newlen, oldp + col + oldlen,
|
||||
(size_t)(linelen - col - oldlen));
|
||||
|
||||
/* Insert or overwrite the new character. */
|
||||
mch_memmove(p, buf, charlen);
|
||||
memmove(p, buf, charlen);
|
||||
i = charlen;
|
||||
|
||||
/* Fill with spaces when necessary. */
|
||||
@ -1583,9 +1585,9 @@ void ins_str(char_u *s)
|
||||
if (newp == NULL)
|
||||
return;
|
||||
if (col > 0)
|
||||
mch_memmove(newp, oldp, (size_t)col);
|
||||
mch_memmove(newp + col, s, (size_t)newlen);
|
||||
mch_memmove(newp + col + newlen, oldp + col, (size_t)(oldlen - col + 1));
|
||||
memmove(newp, oldp, (size_t)col);
|
||||
memmove(newp + col, s, (size_t)newlen);
|
||||
memmove(newp + col + newlen, oldp + col, (size_t)(oldlen - col + 1));
|
||||
ml_replace(lnum, newp, FALSE);
|
||||
changed_bytes(lnum, col);
|
||||
curwin->w_cursor.col += newlen;
|
||||
@ -1717,9 +1719,9 @@ del_bytes (
|
||||
newp = alloc((unsigned)(oldlen + 1 - count));
|
||||
if (newp == NULL)
|
||||
return FAIL;
|
||||
mch_memmove(newp, oldp, (size_t)col);
|
||||
memmove(newp, oldp, (size_t)col);
|
||||
}
|
||||
mch_memmove(newp + col, oldp + col + count, (size_t)movelen);
|
||||
memmove(newp + col, oldp + col + count, (size_t)movelen);
|
||||
if (!was_alloced)
|
||||
ml_replace(lnum, newp, FALSE);
|
||||
|
||||
@ -2110,7 +2112,7 @@ static void changed_common(linenr_T lnum, colnr_T col, linenr_T lnume, long xtra
|
||||
if (curbuf->b_changelistlen == JUMPLISTSIZE) {
|
||||
/* changelist is full: remove oldest entry */
|
||||
curbuf->b_changelistlen = JUMPLISTSIZE - 1;
|
||||
mch_memmove(curbuf->b_changelist, curbuf->b_changelist + 1,
|
||||
memmove(curbuf->b_changelist, curbuf->b_changelist + 1,
|
||||
sizeof(pos_T) * (JUMPLISTSIZE - 1));
|
||||
FOR_ALL_TAB_WINDOWS(tp, wp)
|
||||
{
|
||||
@ -2464,7 +2466,7 @@ int get_keystroke(void)
|
||||
mod_mask = buf[2];
|
||||
len -= 3;
|
||||
if (len > 0)
|
||||
mch_memmove(buf, buf + 3, (size_t)len);
|
||||
memmove(buf, buf + 3, (size_t)len);
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
@ -4204,7 +4206,7 @@ unix_expandpath (
|
||||
mac_precompose_path(buf, precomp_len, &precomp_len);
|
||||
|
||||
if (precomp_buf) {
|
||||
mch_memmove(buf, precomp_buf, precomp_len);
|
||||
memmove(buf, precomp_buf, precomp_len);
|
||||
vim_free(precomp_buf);
|
||||
}
|
||||
#endif
|
||||
@ -4322,7 +4324,7 @@ static void expand_path_option(char_u *curdir, garray_T *gap)
|
||||
buf[len] = NUL;
|
||||
else
|
||||
STRMOVE(buf + len, buf + 2);
|
||||
mch_memmove(buf, curbuf->b_ffname, len);
|
||||
memmove(buf, curbuf->b_ffname, len);
|
||||
simplify_filename(buf);
|
||||
} else if (buf[0] == NUL)
|
||||
/* relative to current directory */
|
||||
@ -4467,7 +4469,7 @@ static void uniquefy_paths(garray_T *gap, char_u *pattern)
|
||||
&& is_unique(pathsep_p + 1, gap, i)
|
||||
&& path_cutoff != NULL && pathsep_p + 1 >= path_cutoff) {
|
||||
sort_again = TRUE;
|
||||
mch_memmove(path, pathsep_p + 1, STRLEN(pathsep_p));
|
||||
memmove(path, pathsep_p + 1, STRLEN(pathsep_p));
|
||||
break;
|
||||
}
|
||||
|
||||
|
40
src/misc2.c
40
src/misc2.c
@ -1034,7 +1034,7 @@ char_u *vim_strsave(char_u *string)
|
||||
len = (unsigned)STRLEN(string) + 1;
|
||||
p = alloc(len);
|
||||
if (p != NULL)
|
||||
mch_memmove(p, string, (size_t)len);
|
||||
memmove(p, string, (size_t)len);
|
||||
return p;
|
||||
}
|
||||
|
||||
@ -1098,7 +1098,7 @@ char_u *vim_strsave_escaped_ext(char_u *string, char_u *esc_chars, int cc, int b
|
||||
p2 = escaped_string;
|
||||
for (p = string; *p; p++) {
|
||||
if (has_mbyte && (l = (*mb_ptr2len)(p)) > 1) {
|
||||
mch_memmove(p2, p, (size_t)l);
|
||||
memmove(p2, p, (size_t)l);
|
||||
p2 += l;
|
||||
p += l - 1; /* skip multibyte char */
|
||||
continue;
|
||||
@ -1275,7 +1275,7 @@ char_u *strup_save(char_u *orig)
|
||||
s = alloc((unsigned)STRLEN(res) + 1 + newl - l);
|
||||
if (s == NULL)
|
||||
break;
|
||||
mch_memmove(s, res, p - res);
|
||||
memmove(s, res, p - res);
|
||||
STRCPY(s + (p - res) + newl, p + l);
|
||||
p = s + (p - res);
|
||||
vim_free(res);
|
||||
@ -1352,7 +1352,7 @@ void vim_strcat(char_u *to, char_u *from, size_t tosize)
|
||||
size_t fromlen = STRLEN(from);
|
||||
|
||||
if (tolen + fromlen + 1 > tosize) {
|
||||
mch_memmove(to + tolen, from, tosize - tolen - 1);
|
||||
memmove(to + tolen, from, tosize - tolen - 1);
|
||||
to[tosize - 1] = NUL;
|
||||
} else
|
||||
STRCPY(to + tolen, from);
|
||||
@ -1430,32 +1430,6 @@ size_t len;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef VIM_MEMMOVE
|
||||
/*
|
||||
* Version of memmove() that handles overlapping source and destination.
|
||||
* For systems that don't have a function that is guaranteed to do that (SYSV).
|
||||
*/
|
||||
void mch_memmove(dst_arg, src_arg, len)
|
||||
void *src_arg, *dst_arg;
|
||||
size_t len;
|
||||
{
|
||||
/*
|
||||
* A void doesn't have a size, we use char pointers.
|
||||
*/
|
||||
char *dst = dst_arg, *src = src_arg;
|
||||
|
||||
/* overlap, copy backwards */
|
||||
if (dst > src && dst < src + len) {
|
||||
src += len;
|
||||
dst += len;
|
||||
while (len-- > 0)
|
||||
*--dst = *--src;
|
||||
} else /* copy forwards */
|
||||
while (len-- > 0)
|
||||
*dst++ = *src++;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if (!defined(HAVE_STRCASECMP) && !defined(HAVE_STRICMP)) || defined(PROTO)
|
||||
/*
|
||||
* Compare two strings, ignoring case, using current locale.
|
||||
@ -1905,9 +1879,9 @@ int (*cmp)(const void *, const void *);
|
||||
if ((*cmp)((void *)p1, (void *)p2) <= 0)
|
||||
break;
|
||||
/* Exchange the elements. */
|
||||
mch_memmove(buf, p1, elm_size);
|
||||
mch_memmove(p1, p2, elm_size);
|
||||
mch_memmove(p2, buf, elm_size);
|
||||
memmove(buf, p1, elm_size);
|
||||
memmove(p1, p2, elm_size);
|
||||
memmove(p2, buf, elm_size);
|
||||
}
|
||||
|
||||
vim_free(buf);
|
||||
|
@ -3110,7 +3110,7 @@ int add_to_showcmd(int c)
|
||||
extra_len = (int)STRLEN(p);
|
||||
overflow = old_len + extra_len - SHOWCMD_COLS;
|
||||
if (overflow > 0)
|
||||
mch_memmove(showcmd_buf, showcmd_buf + overflow,
|
||||
memmove(showcmd_buf, showcmd_buf + overflow,
|
||||
old_len - overflow + 1);
|
||||
STRCAT(showcmd_buf, p);
|
||||
|
||||
|
40
src/ops.c
40
src/ops.c
@ -385,11 +385,11 @@ static void shift_block(oparg_T *oap, int amount)
|
||||
if (newp == NULL)
|
||||
return;
|
||||
memset(newp, NUL, (size_t)(bd.textcol + i + j + len));
|
||||
mch_memmove(newp, oldp, (size_t)bd.textcol);
|
||||
memmove(newp, oldp, (size_t)bd.textcol);
|
||||
copy_chars(newp + bd.textcol, (size_t)i, TAB);
|
||||
copy_spaces(newp + bd.textcol + i, (size_t)j);
|
||||
/* the end */
|
||||
mch_memmove(newp + bd.textcol + i + j, bd.textstart, (size_t)len);
|
||||
memmove(newp + bd.textcol + i + j, bd.textstart, (size_t)len);
|
||||
} else { /* left */
|
||||
colnr_T destination_col; /* column to which text in block will
|
||||
be shifted */
|
||||
@ -470,7 +470,7 @@ static void shift_block(oparg_T *oap, int amount)
|
||||
newp = alloc_check(new_line_len);
|
||||
if (newp == NULL)
|
||||
return;
|
||||
mch_memmove(newp, oldp, (size_t)(verbatim_copy_end - oldp));
|
||||
memmove(newp, oldp, (size_t)(verbatim_copy_end - oldp));
|
||||
copy_spaces(newp + (verbatim_copy_end - oldp), (size_t)fill);
|
||||
STRMOVE(newp + (verbatim_copy_end - oldp) + fill, non_white);
|
||||
}
|
||||
@ -534,14 +534,14 @@ static void block_insert(oparg_T *oap, char_u *s, int b_insert, struct block_def
|
||||
continue;
|
||||
|
||||
/* copy up to shifted part */
|
||||
mch_memmove(newp, oldp, (size_t)(offset));
|
||||
memmove(newp, oldp, (size_t)(offset));
|
||||
oldp += offset;
|
||||
|
||||
/* insert pre-padding */
|
||||
copy_spaces(newp + offset, (size_t)spaces);
|
||||
|
||||
/* copy the new text */
|
||||
mch_memmove(newp + offset + spaces, s, (size_t)s_len);
|
||||
memmove(newp + offset + spaces, s, (size_t)s_len);
|
||||
offset += s_len;
|
||||
|
||||
if (spaces && !bdp->is_short) {
|
||||
@ -1507,7 +1507,7 @@ int op_delete(oparg_T *oap)
|
||||
if (newp == NULL)
|
||||
continue;
|
||||
/* copy up to deleted part */
|
||||
mch_memmove(newp, oldp, (size_t)bd.textcol);
|
||||
memmove(newp, oldp, (size_t)bd.textcol);
|
||||
/* insert spaces */
|
||||
copy_spaces(newp + bd.textcol,
|
||||
(size_t)(bd.startspaces + bd.endspaces));
|
||||
@ -1782,7 +1782,7 @@ int op_replace(oparg_T *oap, int c)
|
||||
continue;
|
||||
memset(newp, NUL, (size_t)(oldlen + 1 + n));
|
||||
/* copy up to deleted part */
|
||||
mch_memmove(newp, oldp, (size_t)bd.textcol);
|
||||
memmove(newp, oldp, (size_t)bd.textcol);
|
||||
oldp += bd.textcol + bd.textlen;
|
||||
/* insert pre-spaces */
|
||||
copy_spaces(newp + bd.textcol, (size_t)bd.startspaces);
|
||||
@ -2300,11 +2300,11 @@ int op_change(oparg_T *oap)
|
||||
if (newp == NULL)
|
||||
continue;
|
||||
/* copy up to block start */
|
||||
mch_memmove(newp, oldp, (size_t)bd.textcol);
|
||||
memmove(newp, oldp, (size_t)bd.textcol);
|
||||
offset = bd.textcol;
|
||||
copy_spaces(newp + offset, (size_t)vpos.coladd);
|
||||
offset += vpos.coladd;
|
||||
mch_memmove(newp + offset, ins_text, (size_t)ins_len);
|
||||
memmove(newp + offset, ins_text, (size_t)ins_len);
|
||||
offset += ins_len;
|
||||
oldp += bd.textcol;
|
||||
STRMOVE(newp + offset, oldp);
|
||||
@ -2620,7 +2620,7 @@ static int yank_copy_line(struct block_def *bd, long y_idx)
|
||||
y_current->y_array[y_idx] = pnew;
|
||||
copy_spaces(pnew, (size_t)bd->startspaces);
|
||||
pnew += bd->startspaces;
|
||||
mch_memmove(pnew, bd->textstart, (size_t)bd->textlen);
|
||||
memmove(pnew, bd->textstart, (size_t)bd->textlen);
|
||||
pnew += bd->textlen;
|
||||
copy_spaces(pnew, (size_t)bd->endspaces);
|
||||
pnew += bd->endspaces;
|
||||
@ -2937,14 +2937,14 @@ do_put (
|
||||
break;
|
||||
/* copy part up to cursor to new line */
|
||||
ptr = newp;
|
||||
mch_memmove(ptr, oldp, (size_t)bd.textcol);
|
||||
memmove(ptr, oldp, (size_t)bd.textcol);
|
||||
ptr += bd.textcol;
|
||||
/* may insert some spaces before the new text */
|
||||
copy_spaces(ptr, (size_t)bd.startspaces);
|
||||
ptr += bd.startspaces;
|
||||
/* insert the new text */
|
||||
for (j = 0; j < count; ++j) {
|
||||
mch_memmove(ptr, y_array[i], (size_t)yanklen);
|
||||
memmove(ptr, y_array[i], (size_t)yanklen);
|
||||
ptr += yanklen;
|
||||
|
||||
/* insert block's trailing spaces only if there's text behind */
|
||||
@ -2957,7 +2957,7 @@ do_put (
|
||||
copy_spaces(ptr, (size_t)bd.endspaces);
|
||||
ptr += bd.endspaces;
|
||||
/* move the text after the cursor to the end of the line. */
|
||||
mch_memmove(ptr, oldp + bd.textcol + delcount,
|
||||
memmove(ptr, oldp + bd.textcol + delcount,
|
||||
(size_t)(oldlen - bd.textcol - delcount + 1));
|
||||
ml_replace(curwin->w_cursor.lnum, newp, FALSE);
|
||||
|
||||
@ -3033,10 +3033,10 @@ do_put (
|
||||
newp = alloc_check((unsigned)(STRLEN(oldp) + totlen + 1));
|
||||
if (newp == NULL)
|
||||
goto end; /* alloc() gave an error message */
|
||||
mch_memmove(newp, oldp, (size_t)col);
|
||||
memmove(newp, oldp, (size_t)col);
|
||||
ptr = newp + col;
|
||||
for (i = 0; i < count; ++i) {
|
||||
mch_memmove(ptr, y_array[0], (size_t)yanklen);
|
||||
memmove(ptr, y_array[0], (size_t)yanklen);
|
||||
ptr += yanklen;
|
||||
}
|
||||
STRMOVE(ptr, oldp + col);
|
||||
@ -3089,9 +3089,9 @@ do_put (
|
||||
if (newp == NULL)
|
||||
goto error;
|
||||
/* copy first part of line */
|
||||
mch_memmove(newp, oldp, (size_t)col);
|
||||
memmove(newp, oldp, (size_t)col);
|
||||
/* append to first line */
|
||||
mch_memmove(newp + col, y_array[0], (size_t)(yanklen + 1));
|
||||
memmove(newp + col, y_array[0], (size_t)(yanklen + 1));
|
||||
ml_replace(lnum, newp, FALSE);
|
||||
|
||||
curwin->w_cursor.lnum = lnum;
|
||||
@ -3595,7 +3595,7 @@ int do_join(long count, int insert_space, int save_undo, int use_formatoptions)
|
||||
*/
|
||||
for (t = count - 1;; --t) {
|
||||
cend -= currsize;
|
||||
mch_memmove(cend, curr, (size_t)currsize);
|
||||
memmove(cend, curr, (size_t)currsize);
|
||||
if (spaces[t] > 0) {
|
||||
cend -= spaces[t];
|
||||
copy_spaces(cend, (size_t)(spaces[t]));
|
||||
@ -4962,11 +4962,11 @@ str_to_reg (
|
||||
if (s == NULL)
|
||||
break;
|
||||
if (extra)
|
||||
mch_memmove(s, y_ptr->y_array[lnum], (size_t)extra);
|
||||
memmove(s, y_ptr->y_array[lnum], (size_t)extra);
|
||||
if (append)
|
||||
vim_free(y_ptr->y_array[lnum]);
|
||||
if (i)
|
||||
mch_memmove(s + extra, str + start, (size_t)i);
|
||||
memmove(s + extra, str + start, (size_t)i);
|
||||
extra += i;
|
||||
s[extra] = NUL;
|
||||
y_ptr->y_array[lnum++] = s;
|
||||
|
12
src/option.c
12
src/option.c
@ -32,6 +32,8 @@
|
||||
*/
|
||||
|
||||
#define IN_OPTION_C
|
||||
#include <string.h>
|
||||
|
||||
#include "vim.h"
|
||||
#include "option.h"
|
||||
#include "blowfish.h"
|
||||
@ -3161,7 +3163,7 @@ do_set (
|
||||
if (has_mbyte
|
||||
&& (i = (*mb_ptr2len)(arg)) > 1) {
|
||||
/* copy multibyte char */
|
||||
mch_memmove(s, arg, (size_t)i);
|
||||
memmove(s, arg, (size_t)i);
|
||||
arg += i;
|
||||
s += i;
|
||||
} else
|
||||
@ -3228,9 +3230,9 @@ do_set (
|
||||
&& *newval != NUL);
|
||||
if (adding) {
|
||||
i = (int)STRLEN(origval);
|
||||
mch_memmove(newval + i + comma, newval,
|
||||
memmove(newval + i + comma, newval,
|
||||
STRLEN(newval) + 1);
|
||||
mch_memmove(newval, origval, (size_t)i);
|
||||
memmove(newval, origval, (size_t)i);
|
||||
} else {
|
||||
i = (int)STRLEN(newval);
|
||||
STRMOVE(newval + i + comma, origval);
|
||||
@ -3336,7 +3338,7 @@ skip:
|
||||
if (i + (arg - startarg) < IOSIZE) {
|
||||
/* append the argument with the error */
|
||||
STRCAT(IObuff, ": ");
|
||||
mch_memmove(IObuff + i, startarg, (arg - startarg));
|
||||
memmove(IObuff + i, startarg, (arg - startarg));
|
||||
IObuff[i + (arg - startarg)] = NUL;
|
||||
}
|
||||
/* make sure all characters are printable */
|
||||
@ -7677,7 +7679,7 @@ static void langmap_set_entry(int from, int to)
|
||||
|
||||
/* insert new entry at position "a" */
|
||||
entries = (langmap_entry_T *)(langmap_mapga.ga_data) + a;
|
||||
mch_memmove(entries + 1, entries,
|
||||
memmove(entries + 1, entries,
|
||||
(langmap_mapga.ga_len - a) * sizeof(langmap_entry_T));
|
||||
++langmap_mapga.ga_len;
|
||||
entries[0].from = from;
|
||||
|
@ -27,6 +27,8 @@
|
||||
*/
|
||||
# define select select_declared_wrong
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "vim.h"
|
||||
#include "os_unix.h"
|
||||
#include "os/time.h"
|
||||
@ -2189,7 +2191,7 @@ int options; /* SHELL_*, see vim.h */
|
||||
if (ta_buf[i] == CSI && len - i > 2) {
|
||||
c = TERMCAP2KEY(ta_buf[i + 1], ta_buf[i + 2]);
|
||||
if (c == K_DEL || c == K_KDEL || c == K_BS) {
|
||||
mch_memmove(ta_buf + i + 1, ta_buf + i + 3,
|
||||
memmove(ta_buf + i + 1, ta_buf + i + 3,
|
||||
(size_t)(len - i - 2));
|
||||
if (c == K_DEL || c == K_KDEL)
|
||||
ta_buf[i] = DEL;
|
||||
@ -2239,7 +2241,7 @@ int options; /* SHELL_*, see vim.h */
|
||||
len = write(toshell_fd, (char *)ta_buf, (size_t)1);
|
||||
if (len > 0) {
|
||||
ta_len -= len;
|
||||
mch_memmove(ta_buf, ta_buf + len, ta_len);
|
||||
memmove(ta_buf, ta_buf + len, ta_len);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2318,7 +2320,7 @@ int options; /* SHELL_*, see vim.h */
|
||||
if (p < buffer + len) {
|
||||
*p = c;
|
||||
buffer_off = (buffer + len) - p;
|
||||
mch_memmove(buffer, p, buffer_off);
|
||||
memmove(buffer, p, buffer_off);
|
||||
continue;
|
||||
}
|
||||
buffer_off = 0;
|
||||
|
@ -253,24 +253,6 @@
|
||||
# define DFLT_MAXMEMTOT (10*1024) /* use up to 10 Mbyte for Vim */
|
||||
# endif
|
||||
|
||||
/* memmove is not present on all systems, use memmove, bcopy, memcpy or our
|
||||
* own version */
|
||||
/* Some systems have (void *) arguments, some (char *). If we use (char *) it
|
||||
* works for all */
|
||||
#ifdef USEMEMMOVE
|
||||
# define mch_memmove(to, from, len) memmove((char *)(to), (char *)(from), len)
|
||||
#else
|
||||
# ifdef USEBCOPY
|
||||
# define mch_memmove(to, from, len) bcopy((char *)(from), (char *)(to), len)
|
||||
# else
|
||||
# ifdef USEMEMCPY
|
||||
# define mch_memmove(to, from, len) memcpy((char *)(to), (char *)(from), len)
|
||||
# else
|
||||
# define VIM_MEMMOVE /* found in misc2.c */
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
# ifdef HAVE_RENAME
|
||||
# define mch_rename(src, dst) rename(src, dst)
|
||||
# else
|
||||
|
@ -6453,9 +6453,9 @@ char_u *regtilde(char_u *source, int magic)
|
||||
if (tmpsub != NULL) {
|
||||
/* copy prefix */
|
||||
len = (int)(p - newsub); /* not including ~ */
|
||||
mch_memmove(tmpsub, newsub, (size_t)len);
|
||||
memmove(tmpsub, newsub, (size_t)len);
|
||||
/* interpret tilde */
|
||||
mch_memmove(tmpsub + len, reg_prev_sub, (size_t)prevlen);
|
||||
memmove(tmpsub + len, reg_prev_sub, (size_t)prevlen);
|
||||
/* copy postfix */
|
||||
if (!magic)
|
||||
++p; /* back off \ */
|
||||
@ -6724,7 +6724,7 @@ static int vim_regsub_both(char_u *source, char_u *dest, int copy, int magic, in
|
||||
* are composing characters; copy them as-is. */
|
||||
if (clen < totlen) {
|
||||
if (copy)
|
||||
mch_memmove(dst + 1, src - 1 + clen,
|
||||
memmove(dst + 1, src - 1 + clen,
|
||||
(size_t)(totlen - clen));
|
||||
dst += totlen - clen;
|
||||
}
|
||||
|
@ -552,7 +552,7 @@ static int realloc_post_list(void)
|
||||
new_start = (int *)lalloc(new_max * sizeof(int), TRUE);
|
||||
if (new_start == NULL)
|
||||
return FAIL;
|
||||
mch_memmove(new_start, post_start, nstate_max * sizeof(int));
|
||||
memmove(new_start, post_start, nstate_max * sizeof(int));
|
||||
old_start = post_start;
|
||||
post_start = new_start;
|
||||
post_ptr = new_start + (post_ptr - old_start);
|
||||
@ -3560,11 +3560,11 @@ static void copy_sub(regsub_T *to, regsub_T *from)
|
||||
if (from->in_use > 0) {
|
||||
/* Copy the match start and end positions. */
|
||||
if (REG_MULTI)
|
||||
mch_memmove(&to->list.multi[0],
|
||||
memmove(&to->list.multi[0],
|
||||
&from->list.multi[0],
|
||||
sizeof(struct multipos) * from->in_use);
|
||||
else
|
||||
mch_memmove(&to->list.line[0],
|
||||
memmove(&to->list.line[0],
|
||||
&from->list.line[0],
|
||||
sizeof(struct linepos) * from->in_use);
|
||||
}
|
||||
@ -3580,11 +3580,11 @@ static void copy_sub_off(regsub_T *to, regsub_T *from)
|
||||
if (from->in_use > 1) {
|
||||
/* Copy the match start and end positions. */
|
||||
if (REG_MULTI)
|
||||
mch_memmove(&to->list.multi[1],
|
||||
memmove(&to->list.multi[1],
|
||||
&from->list.multi[1],
|
||||
sizeof(struct multipos) * (from->in_use - 1));
|
||||
else
|
||||
mch_memmove(&to->list.line[1],
|
||||
memmove(&to->list.line[1],
|
||||
&from->list.line[1],
|
||||
sizeof(struct linepos) * (from->in_use - 1));
|
||||
}
|
||||
@ -4221,13 +4221,13 @@ addstate_here (
|
||||
newl = (nfa_thread_T *)alloc(l->len * sizeof(nfa_thread_T));
|
||||
if (newl == NULL)
|
||||
return;
|
||||
mch_memmove(&(newl[0]),
|
||||
memmove(&(newl[0]),
|
||||
&(l->t[0]),
|
||||
sizeof(nfa_thread_T) * listidx);
|
||||
mch_memmove(&(newl[listidx]),
|
||||
memmove(&(newl[listidx]),
|
||||
&(l->t[l->n - count]),
|
||||
sizeof(nfa_thread_T) * count);
|
||||
mch_memmove(&(newl[listidx + count]),
|
||||
memmove(&(newl[listidx + count]),
|
||||
&(l->t[listidx + 1]),
|
||||
sizeof(nfa_thread_T) * (l->n - count - listidx - 1));
|
||||
vim_free(l->t);
|
||||
@ -4235,10 +4235,10 @@ addstate_here (
|
||||
} else {
|
||||
/* make space for new states, then move them from the
|
||||
* end to the current position */
|
||||
mch_memmove(&(l->t[listidx + count]),
|
||||
memmove(&(l->t[listidx + count]),
|
||||
&(l->t[listidx + 1]),
|
||||
sizeof(nfa_thread_T) * (l->n - listidx - 1));
|
||||
mch_memmove(&(l->t[listidx]),
|
||||
memmove(&(l->t[listidx]),
|
||||
&(l->t[l->n - 1]),
|
||||
sizeof(nfa_thread_T) * count);
|
||||
}
|
||||
|
46
src/screen.c
46
src/screen.c
@ -309,23 +309,23 @@ int redraw_asap(int type)
|
||||
if (ret != 2) {
|
||||
/* Save the text displayed in the command line area. */
|
||||
for (r = 0; r < rows; ++r) {
|
||||
mch_memmove(screenline + r * Columns,
|
||||
memmove(screenline + r * Columns,
|
||||
ScreenLines + LineOffset[cmdline_row + r],
|
||||
(size_t)Columns * sizeof(schar_T));
|
||||
mch_memmove(screenattr + r * Columns,
|
||||
memmove(screenattr + r * Columns,
|
||||
ScreenAttrs + LineOffset[cmdline_row + r],
|
||||
(size_t)Columns * sizeof(sattr_T));
|
||||
if (enc_utf8) {
|
||||
mch_memmove(screenlineUC + r * Columns,
|
||||
memmove(screenlineUC + r * Columns,
|
||||
ScreenLinesUC + LineOffset[cmdline_row + r],
|
||||
(size_t)Columns * sizeof(u8char_T));
|
||||
for (i = 0; i < p_mco; ++i)
|
||||
mch_memmove(screenlineC[i] + r * Columns,
|
||||
memmove(screenlineC[i] + r * Columns,
|
||||
ScreenLinesC[r] + LineOffset[cmdline_row + r],
|
||||
(size_t)Columns * sizeof(u8char_T));
|
||||
}
|
||||
if (enc_dbcs == DBCS_JPNU)
|
||||
mch_memmove(screenline2 + r * Columns,
|
||||
memmove(screenline2 + r * Columns,
|
||||
ScreenLines2 + LineOffset[cmdline_row + r],
|
||||
(size_t)Columns * sizeof(schar_T));
|
||||
}
|
||||
@ -338,23 +338,23 @@ int redraw_asap(int type)
|
||||
|
||||
/* Restore the text displayed in the command line area. */
|
||||
for (r = 0; r < rows; ++r) {
|
||||
mch_memmove(current_ScreenLine,
|
||||
memmove(current_ScreenLine,
|
||||
screenline + r * Columns,
|
||||
(size_t)Columns * sizeof(schar_T));
|
||||
mch_memmove(ScreenAttrs + off,
|
||||
memmove(ScreenAttrs + off,
|
||||
screenattr + r * Columns,
|
||||
(size_t)Columns * sizeof(sattr_T));
|
||||
if (enc_utf8) {
|
||||
mch_memmove(ScreenLinesUC + off,
|
||||
memmove(ScreenLinesUC + off,
|
||||
screenlineUC + r * Columns,
|
||||
(size_t)Columns * sizeof(u8char_T));
|
||||
for (i = 0; i < p_mco; ++i)
|
||||
mch_memmove(ScreenLinesC[i] + off,
|
||||
memmove(ScreenLinesC[i] + off,
|
||||
screenlineC[i] + r * Columns,
|
||||
(size_t)Columns * sizeof(u8char_T));
|
||||
}
|
||||
if (enc_dbcs == DBCS_JPNU)
|
||||
mch_memmove(ScreenLines2 + off,
|
||||
memmove(ScreenLines2 + off,
|
||||
screenline2 + r * Columns,
|
||||
(size_t)Columns * sizeof(schar_T));
|
||||
SCREEN_LINE(cmdline_row + r, 0, Columns, Columns, FALSE);
|
||||
@ -2034,7 +2034,7 @@ static void copy_text_attr(int off, char_u *buf, int len, int attr)
|
||||
{
|
||||
int i;
|
||||
|
||||
mch_memmove(ScreenLines + off, buf, (size_t)len);
|
||||
memmove(ScreenLines + off, buf, (size_t)len);
|
||||
if (enc_utf8)
|
||||
memset(ScreenLinesUC + off, 0, sizeof(u8char_T) * (size_t)len);
|
||||
for (i = 0; i < len; ++i)
|
||||
@ -2434,13 +2434,13 @@ win_line (
|
||||
/* Short line, use it completely and append the start of the
|
||||
* next line. */
|
||||
nextlinecol = 0;
|
||||
mch_memmove(nextline, line, (size_t)v);
|
||||
memmove(nextline, line, (size_t)v);
|
||||
STRMOVE(nextline + v, nextline + SPWORDLEN);
|
||||
nextline_idx = v + 1;
|
||||
} else {
|
||||
/* Long line, use only the last SPWORDLEN bytes. */
|
||||
nextlinecol = v - SPWORDLEN;
|
||||
mch_memmove(nextline, line + nextlinecol, SPWORDLEN);
|
||||
memmove(nextline, line + nextlinecol, SPWORDLEN);
|
||||
nextline_idx = SPWORDLEN + 1;
|
||||
}
|
||||
}
|
||||
@ -6224,25 +6224,25 @@ give_up:
|
||||
* may be invalid now. Also when p_mco changes. */
|
||||
if (!(enc_utf8 && ScreenLinesUC == NULL)
|
||||
&& p_mco == Screen_mco)
|
||||
mch_memmove(new_ScreenLines + new_LineOffset[new_row],
|
||||
memmove(new_ScreenLines + new_LineOffset[new_row],
|
||||
ScreenLines + LineOffset[old_row],
|
||||
(size_t)len * sizeof(schar_T));
|
||||
if (enc_utf8 && ScreenLinesUC != NULL
|
||||
&& p_mco == Screen_mco) {
|
||||
mch_memmove(new_ScreenLinesUC + new_LineOffset[new_row],
|
||||
memmove(new_ScreenLinesUC + new_LineOffset[new_row],
|
||||
ScreenLinesUC + LineOffset[old_row],
|
||||
(size_t)len * sizeof(u8char_T));
|
||||
for (i = 0; i < p_mco; ++i)
|
||||
mch_memmove(new_ScreenLinesC[i]
|
||||
memmove(new_ScreenLinesC[i]
|
||||
+ new_LineOffset[new_row],
|
||||
ScreenLinesC[i] + LineOffset[old_row],
|
||||
(size_t)len * sizeof(u8char_T));
|
||||
}
|
||||
if (enc_dbcs == DBCS_JPNU && ScreenLines2 != NULL)
|
||||
mch_memmove(new_ScreenLines2 + new_LineOffset[new_row],
|
||||
memmove(new_ScreenLines2 + new_LineOffset[new_row],
|
||||
ScreenLines2 + LineOffset[old_row],
|
||||
(size_t)len * sizeof(schar_T));
|
||||
mch_memmove(new_ScreenAttrs + new_LineOffset[new_row],
|
||||
memmove(new_ScreenAttrs + new_LineOffset[new_row],
|
||||
ScreenAttrs + LineOffset[old_row],
|
||||
(size_t)len * sizeof(sattr_T));
|
||||
}
|
||||
@ -6386,21 +6386,21 @@ static void linecopy(int to, int from, win_T *wp)
|
||||
unsigned off_to = LineOffset[to] + wp->w_wincol;
|
||||
unsigned off_from = LineOffset[from] + wp->w_wincol;
|
||||
|
||||
mch_memmove(ScreenLines + off_to, ScreenLines + off_from,
|
||||
memmove(ScreenLines + off_to, ScreenLines + off_from,
|
||||
wp->w_width * sizeof(schar_T));
|
||||
if (enc_utf8) {
|
||||
int i;
|
||||
|
||||
mch_memmove(ScreenLinesUC + off_to, ScreenLinesUC + off_from,
|
||||
memmove(ScreenLinesUC + off_to, ScreenLinesUC + off_from,
|
||||
wp->w_width * sizeof(u8char_T));
|
||||
for (i = 0; i < p_mco; ++i)
|
||||
mch_memmove(ScreenLinesC[i] + off_to, ScreenLinesC[i] + off_from,
|
||||
memmove(ScreenLinesC[i] + off_to, ScreenLinesC[i] + off_from,
|
||||
wp->w_width * sizeof(u8char_T));
|
||||
}
|
||||
if (enc_dbcs == DBCS_JPNU)
|
||||
mch_memmove(ScreenLines2 + off_to, ScreenLines2 + off_from,
|
||||
memmove(ScreenLines2 + off_to, ScreenLines2 + off_from,
|
||||
wp->w_width * sizeof(schar_T));
|
||||
mch_memmove(ScreenAttrs + off_to, ScreenAttrs + off_from,
|
||||
memmove(ScreenAttrs + off_to, ScreenAttrs + off_from,
|
||||
wp->w_width * sizeof(sattr_T));
|
||||
}
|
||||
|
||||
|
@ -10,6 +10,8 @@
|
||||
* search.c: code for normal mode searching commands
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "vim.h"
|
||||
#include "search.h"
|
||||
#include "charset.h"
|
||||
@ -247,7 +249,7 @@ char_u *reverse_text(char_u *s)
|
||||
|
||||
mb_len = (*mb_ptr2len)(s + s_i);
|
||||
rev_i -= mb_len;
|
||||
mch_memmove(rev + rev_i, s + s_i, mb_len);
|
||||
memmove(rev + rev_i, s + s_i, mb_len);
|
||||
s_i += mb_len - 1;
|
||||
} else
|
||||
rev[--rev_i] = s[s_i];
|
||||
|
36
src/spell.c
36
src/spell.c
@ -3639,7 +3639,7 @@ static void set_sal_first(slang_T *lp)
|
||||
++i;
|
||||
--n;
|
||||
tsal = smp[i + n];
|
||||
mch_memmove(smp + i + 1, smp + i,
|
||||
memmove(smp + i + 1, smp + i,
|
||||
sizeof(salitem_T) * n);
|
||||
smp[i] = tsal;
|
||||
}
|
||||
@ -3894,7 +3894,7 @@ char_u *did_set_spelllang(win_T *wp)
|
||||
if (p != NULL && ASCII_ISALPHA(p[1]) && ASCII_ISALPHA(p[2])
|
||||
&& !ASCII_ISALPHA(p[3])) {
|
||||
vim_strncpy(region_cp, p + 1, 2);
|
||||
mch_memmove(p, p + 3, len - (p - lang) - 2);
|
||||
memmove(p, p + 3, len - (p - lang) - 2);
|
||||
len -= 3;
|
||||
region = region_cp;
|
||||
} else
|
||||
@ -9251,7 +9251,7 @@ void spell_suggest(int count)
|
||||
+ stp->st_wordlen + 1);
|
||||
if (p != NULL) {
|
||||
c = (int)(sug.su_badptr - line);
|
||||
mch_memmove(p, line, c);
|
||||
memmove(p, line, c);
|
||||
STRCPY(p + c, stp->st_word);
|
||||
STRCAT(p, sug.su_badptr + stp->st_orglen);
|
||||
ml_replace(curwin->w_cursor.lnum, p, FALSE);
|
||||
@ -9376,7 +9376,7 @@ void ex_spellrepall(exarg_T *eap)
|
||||
p = alloc((unsigned)STRLEN(line) + addlen + 1);
|
||||
if (p == NULL)
|
||||
break;
|
||||
mch_memmove(p, line, curwin->w_cursor.col);
|
||||
memmove(p, line, curwin->w_cursor.col);
|
||||
STRCPY(p + curwin->w_cursor.col, repl_to);
|
||||
STRCAT(p, line + curwin->w_cursor.col + STRLEN(repl_from));
|
||||
ml_replace(curwin->w_cursor.lnum, p, FALSE);
|
||||
@ -10642,7 +10642,7 @@ static void suggest_trie_walk(suginfo_T *su, langp_T *lp, char_u *fword, int sou
|
||||
l = 1;
|
||||
if (fword_ends) {
|
||||
/* Copy the skipped character to preword. */
|
||||
mch_memmove(preword + sp->ts_prewordlen,
|
||||
memmove(preword + sp->ts_prewordlen,
|
||||
fword + sp->ts_fidx, l);
|
||||
sp->ts_prewordlen += l;
|
||||
preword[sp->ts_prewordlen] = NUL;
|
||||
@ -11050,7 +11050,7 @@ static void suggest_trie_walk(suginfo_T *su, langp_T *lp, char_u *fword, int sou
|
||||
++depth;
|
||||
if (has_mbyte) {
|
||||
fl = mb_char2len(c2);
|
||||
mch_memmove(p, p + n, fl);
|
||||
memmove(p, p + n, fl);
|
||||
mb_char2bytes(c, p + fl);
|
||||
stack[depth].ts_fidxtry = sp->ts_fidx + n + fl;
|
||||
} else {
|
||||
@ -11069,7 +11069,7 @@ static void suggest_trie_walk(suginfo_T *su, langp_T *lp, char_u *fword, int sou
|
||||
if (has_mbyte) {
|
||||
n = MB_BYTE2LEN(*p);
|
||||
c = mb_ptr2char(p + n);
|
||||
mch_memmove(p + MB_BYTE2LEN(p[n]), p, n);
|
||||
memmove(p + MB_BYTE2LEN(p[n]), p, n);
|
||||
mb_char2bytes(c, p);
|
||||
} else {
|
||||
c = *p;
|
||||
@ -11121,7 +11121,7 @@ static void suggest_trie_walk(suginfo_T *su, langp_T *lp, char_u *fword, int sou
|
||||
++depth;
|
||||
if (has_mbyte) {
|
||||
tl = mb_char2len(c3);
|
||||
mch_memmove(p, p + n + fl, tl);
|
||||
memmove(p, p + n + fl, tl);
|
||||
mb_char2bytes(c2, p + tl);
|
||||
mb_char2bytes(c, p + fl + tl);
|
||||
stack[depth].ts_fidxtry = sp->ts_fidx + n + fl + tl;
|
||||
@ -11143,7 +11143,7 @@ static void suggest_trie_walk(suginfo_T *su, langp_T *lp, char_u *fword, int sou
|
||||
fl = MB_BYTE2LEN(p[n]);
|
||||
c = mb_ptr2char(p + n + fl);
|
||||
tl = MB_BYTE2LEN(p[n + fl]);
|
||||
mch_memmove(p + fl + tl, p, n);
|
||||
memmove(p + fl + tl, p, n);
|
||||
mb_char2bytes(c, p);
|
||||
mb_char2bytes(c2, p + tl);
|
||||
p = p + tl;
|
||||
@ -11179,7 +11179,7 @@ static void suggest_trie_walk(suginfo_T *su, langp_T *lp, char_u *fword, int sou
|
||||
c = mb_ptr2char(p);
|
||||
fl = mb_cptr2len(p + n);
|
||||
fl += mb_cptr2len(p + n + fl);
|
||||
mch_memmove(p, p + n, fl);
|
||||
memmove(p, p + n, fl);
|
||||
mb_char2bytes(c, p + fl);
|
||||
stack[depth].ts_fidxtry = sp->ts_fidx + n + fl;
|
||||
} else {
|
||||
@ -11201,7 +11201,7 @@ static void suggest_trie_walk(suginfo_T *su, langp_T *lp, char_u *fword, int sou
|
||||
n += MB_BYTE2LEN(p[n]);
|
||||
c = mb_ptr2char(p + n);
|
||||
tl = MB_BYTE2LEN(p[n]);
|
||||
mch_memmove(p + tl, p, n);
|
||||
memmove(p + tl, p, n);
|
||||
mb_char2bytes(c, p);
|
||||
} else {
|
||||
c = p[2];
|
||||
@ -11228,7 +11228,7 @@ static void suggest_trie_walk(suginfo_T *su, langp_T *lp, char_u *fword, int sou
|
||||
n += mb_cptr2len(p + n);
|
||||
c = mb_ptr2char(p + n);
|
||||
tl = mb_cptr2len(p + n);
|
||||
mch_memmove(p + tl, p, n);
|
||||
memmove(p + tl, p, n);
|
||||
mb_char2bytes(c, p);
|
||||
stack[depth].ts_fidxtry = sp->ts_fidx + n + tl;
|
||||
} else {
|
||||
@ -11250,7 +11250,7 @@ static void suggest_trie_walk(suginfo_T *su, langp_T *lp, char_u *fword, int sou
|
||||
tl = MB_BYTE2LEN(*p);
|
||||
n = MB_BYTE2LEN(p[tl]);
|
||||
n += MB_BYTE2LEN(p[tl + n]);
|
||||
mch_memmove(p, p + tl, n);
|
||||
memmove(p, p + tl, n);
|
||||
mb_char2bytes(c, p + n);
|
||||
} else {
|
||||
c = *p;
|
||||
@ -11324,7 +11324,7 @@ static void suggest_trie_walk(suginfo_T *su, langp_T *lp, char_u *fword, int sou
|
||||
STRMOVE(p + tl, p + fl);
|
||||
repextra += tl - fl;
|
||||
}
|
||||
mch_memmove(p, ftp->ft_to, tl);
|
||||
memmove(p, ftp->ft_to, tl);
|
||||
stack[depth].ts_fidxtry = sp->ts_fidx + tl;
|
||||
stack[depth].ts_tcharlen = 0;
|
||||
break;
|
||||
@ -11351,7 +11351,7 @@ static void suggest_trie_walk(suginfo_T *su, langp_T *lp, char_u *fword, int sou
|
||||
STRMOVE(p + fl, p + tl);
|
||||
repextra -= tl - fl;
|
||||
}
|
||||
mch_memmove(p, ftp->ft_from, fl);
|
||||
memmove(p, ftp->ft_from, fl);
|
||||
sp->ts_state = STATE_REP;
|
||||
break;
|
||||
|
||||
@ -12367,7 +12367,7 @@ check_suggestions (
|
||||
vim_free(stp[i].st_word);
|
||||
--gap->ga_len;
|
||||
if (i < gap->ga_len)
|
||||
mch_memmove(stp + i, stp + i + 1,
|
||||
memmove(stp + i, stp + i + 1,
|
||||
sizeof(suggest_T) * (gap->ga_len - i));
|
||||
}
|
||||
}
|
||||
@ -13070,7 +13070,7 @@ static void spell_soundfold_wsal(slang_T *slang, char_u *inword, char_u *res)
|
||||
ws++;
|
||||
}
|
||||
if (k > k0)
|
||||
mch_memmove(word + i + k0, word + i + k,
|
||||
memmove(word + i + k0, word + i + k,
|
||||
sizeof(int) * (wordlen - (i + k) + 1));
|
||||
|
||||
/* new "actual letter" */
|
||||
@ -13094,7 +13094,7 @@ static void spell_soundfold_wsal(slang_T *slang, char_u *inword, char_u *res)
|
||||
if (strstr((char *)s, "^^") != NULL) {
|
||||
if (c != NUL)
|
||||
wres[reslen++] = c;
|
||||
mch_memmove(word, word + i + 1,
|
||||
memmove(word, word + i + 1,
|
||||
sizeof(int) * (wordlen - (i + 1) + 1));
|
||||
i = 0;
|
||||
z0 = 1;
|
||||
|
@ -3219,7 +3219,7 @@ static void syn_remove_pattern(synblock_T *block, int idx)
|
||||
if (spp->sp_flags & HL_FOLD)
|
||||
--block->b_syn_folditems;
|
||||
syn_clear_pattern(block, idx);
|
||||
mch_memmove(spp, spp + 1,
|
||||
memmove(spp, spp + 1,
|
||||
sizeof(synpat_T) * (block->b_syn_patterns.ga_len - idx - 1));
|
||||
--block->b_syn_patterns.ga_len;
|
||||
}
|
||||
@ -4316,7 +4316,7 @@ static void syn_cmd_keyword(exarg_T *eap, int syncing)
|
||||
if (has_mbyte) {
|
||||
int l = (*mb_ptr2len)(p + 1);
|
||||
|
||||
mch_memmove(p, p + 1, l);
|
||||
memmove(p, p + 1, l);
|
||||
p += l;
|
||||
} else {
|
||||
p[0] = p[1];
|
||||
@ -5394,7 +5394,7 @@ static short *copy_id_list(short *list)
|
||||
len = (count + 1) * sizeof(short);
|
||||
retval = (short *)alloc((unsigned)len);
|
||||
if (retval != NULL)
|
||||
mch_memmove(retval, list, (size_t)len);
|
||||
memmove(retval, list, (size_t)len);
|
||||
|
||||
return retval;
|
||||
}
|
||||
@ -7739,7 +7739,7 @@ int highlight_changed(void)
|
||||
hlt[hlcnt + i].sg_cterm = highlight_attr[HLF_SNC];
|
||||
hlt[hlcnt + i].sg_gui = highlight_attr[HLF_SNC];
|
||||
} else
|
||||
mch_memmove(&hlt[hlcnt + i],
|
||||
memmove(&hlt[hlcnt + i],
|
||||
&hlt[id_SNC - 1],
|
||||
sizeof(struct hl_group));
|
||||
hlt[hlcnt + i].sg_link = 0;
|
||||
|
@ -2026,7 +2026,7 @@ findtag_end:
|
||||
/* To avoid allocating memory again we turn the struct
|
||||
* match_found into a string. For help the priority was not
|
||||
* included in the length. */
|
||||
mch_memmove(mfp, mfp->match,
|
||||
memmove(mfp, mfp->match,
|
||||
(size_t)(mfp->len + (help_only ? ML_HELP_LEN : 0)));
|
||||
matches[match_count++] = (char_u *)mfp;
|
||||
}
|
||||
@ -2984,14 +2984,14 @@ expand_tags (
|
||||
for (i = 0; i < *num_file; i++) {
|
||||
parse_match((*file)[i], &t_p);
|
||||
c = (int)(t_p.tagname_end - t_p.tagname);
|
||||
mch_memmove(tagnm, t_p.tagname, (size_t)c);
|
||||
memmove(tagnm, t_p.tagname, (size_t)c);
|
||||
tagnm[c++] = 0;
|
||||
tagnm[c++] = (t_p.tagkind != NULL && *t_p.tagkind)
|
||||
? *t_p.tagkind : 'f';
|
||||
tagnm[c++] = 0;
|
||||
mch_memmove((*file)[i] + c, t_p.fname, t_p.fname_end - t_p.fname);
|
||||
memmove((*file)[i] + c, t_p.fname, t_p.fname_end - t_p.fname);
|
||||
(*file)[i][c + (t_p.fname_end - t_p.fname)] = 0;
|
||||
mch_memmove((*file)[i], tagnm, (size_t)c);
|
||||
memmove((*file)[i], tagnm, (size_t)c);
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
|
10
src/term.c
10
src/term.c
@ -23,6 +23,8 @@
|
||||
*/
|
||||
|
||||
#define tgetstr tgetstr_defined_wrong
|
||||
#include <string.h>
|
||||
|
||||
#include "vim.h"
|
||||
#include "term.h"
|
||||
#include "buffer.h"
|
||||
@ -4138,22 +4140,22 @@ int check_termcode(int max_offset, char_u *buf, int bufsize, int *buflen)
|
||||
* Careful: del_typebuf() and ins_typebuf() may have reallocated
|
||||
* typebuf.tb_buf[]!
|
||||
*/
|
||||
mch_memmove(typebuf.tb_buf + typebuf.tb_off + offset, string,
|
||||
memmove(typebuf.tb_buf + typebuf.tb_off + offset, string,
|
||||
(size_t)new_slen);
|
||||
} else {
|
||||
if (extra < 0)
|
||||
/* remove matched characters */
|
||||
mch_memmove(buf + offset, buf + offset - extra,
|
||||
memmove(buf + offset, buf + offset - extra,
|
||||
(size_t)(*buflen + offset + extra));
|
||||
else if (extra > 0) {
|
||||
/* Insert the extra space we need. If there is insufficient
|
||||
* space return -1. */
|
||||
if (*buflen + extra + new_slen >= bufsize)
|
||||
return -1;
|
||||
mch_memmove(buf + offset + extra, buf + offset,
|
||||
memmove(buf + offset + extra, buf + offset,
|
||||
(size_t)(*buflen - offset));
|
||||
}
|
||||
mch_memmove(buf + offset, string, (size_t)new_slen);
|
||||
memmove(buf + offset, string, (size_t)new_slen);
|
||||
*buflen = *buflen + extra + new_slen;
|
||||
}
|
||||
return retval == 0 ? (len + extra + offset) : retval;
|
||||
|
22
src/ui.c
22
src/ui.c
@ -16,6 +16,8 @@
|
||||
* 3. Input buffer stuff.
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "vim.h"
|
||||
#include "ui.h"
|
||||
#include "diff.h"
|
||||
@ -78,11 +80,11 @@ void ui_inchar_undo(char_u *s, int len)
|
||||
new = alloc(newlen);
|
||||
if (new != NULL) {
|
||||
if (ta_str != NULL) {
|
||||
mch_memmove(new, ta_str + ta_off, (size_t)(ta_len - ta_off));
|
||||
mch_memmove(new + ta_len - ta_off, s, (size_t)len);
|
||||
memmove(new, ta_str + ta_off, (size_t)(ta_len - ta_off));
|
||||
memmove(new + ta_len - ta_off, s, (size_t)len);
|
||||
vim_free(ta_str);
|
||||
} else
|
||||
mch_memmove(new, s, (size_t)len);
|
||||
memmove(new, s, (size_t)len);
|
||||
ta_str = new;
|
||||
ta_len = newlen;
|
||||
ta_off = 0;
|
||||
@ -358,7 +360,7 @@ char_u *get_input_buf(void)
|
||||
/* Add one to avoid a zero size. */
|
||||
gap->ga_data = alloc((unsigned)inbufcount + 1);
|
||||
if (gap->ga_data != NULL)
|
||||
mch_memmove(gap->ga_data, inbuf, (size_t)inbufcount);
|
||||
memmove(gap->ga_data, inbuf, (size_t)inbufcount);
|
||||
gap->ga_len = inbufcount;
|
||||
}
|
||||
trash_input_buf();
|
||||
@ -375,7 +377,7 @@ void set_input_buf(char_u *p)
|
||||
|
||||
if (gap != NULL) {
|
||||
if (gap->ga_data != NULL) {
|
||||
mch_memmove(inbuf, gap->ga_data, gap->ga_len);
|
||||
memmove(inbuf, gap->ga_data, gap->ga_len);
|
||||
inbufcount = gap->ga_len;
|
||||
vim_free(gap->ga_data);
|
||||
}
|
||||
@ -461,10 +463,10 @@ int read_from_input_buf(char_u *buf, long maxlen)
|
||||
fill_input_buf(TRUE);
|
||||
if (maxlen > inbufcount)
|
||||
maxlen = inbufcount;
|
||||
mch_memmove(buf, inbuf, (size_t)maxlen);
|
||||
memmove(buf, inbuf, (size_t)maxlen);
|
||||
inbufcount -= maxlen;
|
||||
if (inbufcount)
|
||||
mch_memmove(inbuf, inbuf + maxlen, (size_t)inbufcount);
|
||||
memmove(inbuf, inbuf + maxlen, (size_t)inbufcount);
|
||||
return (int)maxlen;
|
||||
}
|
||||
|
||||
@ -497,13 +499,13 @@ void fill_input_buf(int exit_on_error)
|
||||
unconverted = INBUFLEN - inbufcount;
|
||||
else
|
||||
unconverted = restlen;
|
||||
mch_memmove(inbuf + inbufcount, rest, unconverted);
|
||||
memmove(inbuf + inbufcount, rest, unconverted);
|
||||
if (unconverted == restlen) {
|
||||
vim_free(rest);
|
||||
rest = NULL;
|
||||
} else {
|
||||
restlen -= unconverted;
|
||||
mch_memmove(rest, rest + unconverted, restlen);
|
||||
memmove(rest, rest + unconverted, restlen);
|
||||
}
|
||||
inbufcount += unconverted;
|
||||
} else
|
||||
@ -570,7 +572,7 @@ void fill_input_buf(int exit_on_error)
|
||||
*/
|
||||
if (inbuf[inbufcount] == 3 && ctrl_c_interrupts) {
|
||||
/* remove everything typed before the CTRL-C */
|
||||
mch_memmove(inbuf, inbuf + inbufcount, (size_t)(len + 1));
|
||||
memmove(inbuf, inbuf + inbufcount, (size_t)(len + 1));
|
||||
inbufcount = 0;
|
||||
got_int = TRUE;
|
||||
}
|
||||
|
@ -486,7 +486,7 @@ int u_savecommon(linenr_T top, linenr_T bot, linenr_T newbot, int reload)
|
||||
((curbuf->b_ml.ml_flags & ML_EMPTY) ? UH_EMPTYBUF : 0);
|
||||
|
||||
/* save named marks and Visual marks for undo */
|
||||
mch_memmove(uhp->uh_namedm, curbuf->b_namedm, sizeof(pos_T) * NMARKS);
|
||||
memmove(uhp->uh_namedm, curbuf->b_namedm, sizeof(pos_T) * NMARKS);
|
||||
uhp->uh_visual = curbuf->b_visual;
|
||||
|
||||
curbuf->b_u_newhead = uhp;
|
||||
@ -719,7 +719,7 @@ char_u *u_get_undo_file_name(char_u *buf_ffname, int reading)
|
||||
if (undo_file_name == NULL)
|
||||
break;
|
||||
p = gettail(undo_file_name);
|
||||
mch_memmove(p + 1, p, STRLEN(p) + 1);
|
||||
memmove(p + 1, p, STRLEN(p) + 1);
|
||||
*p = '.';
|
||||
STRCAT(p, ".un~");
|
||||
} else {
|
||||
@ -2096,7 +2096,7 @@ static void u_undoredo(int undo)
|
||||
/*
|
||||
* save marks before undo/redo
|
||||
*/
|
||||
mch_memmove(namedm, curbuf->b_namedm, sizeof(pos_T) * NMARKS);
|
||||
memmove(namedm, curbuf->b_namedm, sizeof(pos_T) * NMARKS);
|
||||
visualinfo = curbuf->b_visual;
|
||||
curbuf->b_op_start.lnum = curbuf->b_ml.ml_line_count;
|
||||
curbuf->b_op_start.col = 0;
|
||||
|
13
src/vim.h
13
src/vim.h
@ -1058,7 +1058,7 @@ typedef enum {
|
||||
#endif
|
||||
|
||||
/* Like strcpy() but allows overlapped source and destination. */
|
||||
#define STRMOVE(d, s) mch_memmove((d), (s), STRLEN(s) + 1)
|
||||
#define STRMOVE(d, s) memmove((d), (s), STRLEN(s) + 1)
|
||||
|
||||
#ifdef HAVE_STRNCASECMP
|
||||
# define STRNICMP(d, s, n) strncasecmp((char *)(d), (char *)(s), (size_t)(n))
|
||||
@ -1144,17 +1144,6 @@ typedef unsigned short disptick_T; /* display tick type */
|
||||
|
||||
typedef void *vim_acl_T; /* dummy to pass an ACL to a function */
|
||||
|
||||
/*
|
||||
* Include a prototype for mch_memmove(), it may not be in alloc.pro.
|
||||
*/
|
||||
#ifdef VIM_MEMMOVE
|
||||
void mch_memmove(void *, void *, size_t);
|
||||
#else
|
||||
# ifndef mch_memmove
|
||||
# define mch_memmove(to, from, len) memmove(to, from, len)
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
* fnamecmp() is used to compare file names.
|
||||
* On some systems case in a file name does not matter, on others it does.
|
||||
|
Loading…
Reference in New Issue
Block a user