mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-22 12:32:40 +03:00
Use str_move() where possible.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
parent
8b6f4ef2c2
commit
2a973f7a46
@ -155,14 +155,12 @@ delete_region (WInput * in, int x_first, int x_last)
|
||||
{
|
||||
int first = MIN (x_first, x_last);
|
||||
int last = MAX (x_first, x_last);
|
||||
size_t len;
|
||||
|
||||
input_mark_cmd (in, FALSE);
|
||||
in->point = first;
|
||||
last = str_offset_to_pos (in->buffer, last);
|
||||
first = str_offset_to_pos (in->buffer, first);
|
||||
len = strlen (&in->buffer[last]) + 1;
|
||||
memmove (&in->buffer[first], &in->buffer[last], len);
|
||||
str_move (in->buffer + first, in->buffer + last);
|
||||
in->charpoint = 0;
|
||||
in->need_push = TRUE;
|
||||
}
|
||||
|
@ -887,11 +887,8 @@ try_complete_find_start_sign (try_complete_automation_state_t * state)
|
||||
/* don't substitute variable in \$ case */
|
||||
if (strutils_is_char_escaped (state->word, state->q))
|
||||
{
|
||||
size_t qlen;
|
||||
|
||||
qlen = strlen (state->q);
|
||||
/* drop '\\' */
|
||||
memmove (state->q - 1, state->q, qlen + 1);
|
||||
str_move (state->q - 1, state->q);
|
||||
/* adjust flags */
|
||||
state->flags &= ~INPUT_COMPLETE_VARIABLES;
|
||||
state->q = NULL;
|
||||
|
@ -96,6 +96,7 @@ What to do with this?
|
||||
|
||||
#include "lib/global.h"
|
||||
#include "lib/util.h"
|
||||
#include "lib/strutil.h" /* str_move() */
|
||||
#include "lib/mcconfig.h"
|
||||
|
||||
#include "lib/tty/tty.h" /* enable/disable interrupt key */
|
||||
@ -327,7 +328,7 @@ ftpfs_translate_path (struct vfs_class *me, struct vfs_s_super *super, const cha
|
||||
/* replace first occurrence of ":/" with ":" */
|
||||
p = strchr (ret, ':');
|
||||
if (p != NULL && IS_PATH_SEP (p[1]))
|
||||
memmove (p + 1, p + 2, strlen (p + 2) + 1);
|
||||
str_move (p + 1, p + 2);
|
||||
|
||||
/* strip trailing "/." */
|
||||
p = strrchr (ret, PATH_SEP);
|
||||
|
Loading…
Reference in New Issue
Block a user