commit 9eff7465d9d21d381b98809943fe3a2000b530d3
parent da8fd8f89442dc74d6fe17b3b44e134a77b7ec61
Author: David Lawrence Ramsey <pooka109@gmail.com>
Date: Tue, 16 Sep 2003 02:04:00 +0000
all our memmove() function calls work on char*'s, so we can use the
charmove() macro for them instead
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1554 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
Diffstat:
4 files changed, 13 insertions(+), 11 deletions(-)
diff --git a/ChangeLog b/ChangeLog
@@ -52,6 +52,8 @@ CVS code -
for a backwards search in the refactored code, and enclose
dump_buffer() and dump_buffer_reverse() in one ENABLE_DEBUG
#ifdef instead of two.
+ - Convert memmove() function calls to charmove() macro calls, as
+ the former all work on char*'s. (DLR)
- files.c:
do_browser()
- Some of the Pico compatibility options in the file browser
diff --git a/src/cut.c b/src/cut.c
@@ -117,7 +117,7 @@ void cut_marked_segment(filestruct *top, size_t top_x, filestruct *bot,
/* Make the first cut line manually. */
tmp = copy_node(top);
newsize = (top == bot ? bot_x - top_x : strlen(top->data + top_x));
- memmove(tmp->data, top->data + top_x, newsize);
+ charmove(tmp->data, top->data + top_x, newsize);
null_at(&tmp->data, newsize);
add_to_cutbuffer(tmp);
@@ -131,7 +131,7 @@ void cut_marked_segment(filestruct *top, size_t top_x, filestruct *bot,
if (top == bot) {
/* In this case, the remainder line is shorter, so we must
move text from the end forward first. */
- memmove(top->data + top_x, bot->data + bot_x,
+ charmove(top->data + top_x, bot->data + bot_x,
newsize - top_x);
top->data = charealloc(top->data, newsize);
} else {
@@ -140,7 +140,7 @@ void cut_marked_segment(filestruct *top, size_t top_x, filestruct *bot,
/* Here, the remainder line might get longer, so we
realloc() it first. */
top->data = charealloc(top->data, newsize);
- memmove(top->data + top_x, bot->data + bot_x,
+ charmove(top->data + top_x, bot->data + bot_x,
newsize - top_x);
}
}
@@ -364,7 +364,7 @@ int do_uncut_text(void)
size_t cur_len = strlen(current->data);
current->data = charealloc(current->data, cur_len + buf_len + 1);
- memmove(current->data + current_x + buf_len,
+ charmove(current->data + current_x + buf_len,
current->data + current_x, cur_len - current_x + 1);
strncpy(current->data + current_x, cutbuffer->data, buf_len);
/* Use strncpy() to not copy the terminal '\0'. */
diff --git a/src/nano.c b/src/nano.c
@@ -990,7 +990,7 @@ void do_char(char ch)
/* more dangerousness fun =) */
current->data = charealloc(current->data, current_len + 2);
assert(current_x <= current_len);
- memmove(¤t->data[current_x + 1],
+ charmove(¤t->data[current_x + 1],
¤t->data[current_x],
current_len - current_x + 1);
current->data[current_x] = ch;
@@ -1043,7 +1043,7 @@ int do_delete(void)
if (current_x != strlen(current->data)) {
/* Let's get dangerous */
- memmove(¤t->data[current_x], ¤t->data[current_x + 1],
+ charmove(¤t->data[current_x], ¤t->data[current_x + 1],
strlen(current->data) - current_x);
align(¤t->data);
@@ -2463,7 +2463,7 @@ int do_para_operation(int operation)
current->next->data = charealloc(current->next->data,
next_line_len + line_len - break_pos + 1);
- memmove(current->next->data + indent_len + line_len - break_pos,
+ charmove(current->next->data + indent_len + line_len - break_pos,
current->next->data + indent_len,
next_line_len - indent_len + 1);
strcpy(current->next->data + indent_len,
@@ -2537,7 +2537,7 @@ int do_para_operation(int operation)
totsize -= indent_len;
current_y--;
} else {
- memmove(current->next->data + indent_len,
+ charmove(current->next->data + indent_len,
current->next->data + indent_len + break_pos + 1,
next_line_len - break_pos - indent_len);
null_at(¤t->next->data,
diff --git a/src/winio.c b/src/winio.c
@@ -635,7 +635,7 @@ int nanogetstr(int allowtabs, const char *buf, const char *def,
break;
case NANO_DELETE_KEY:
if (x < xend) {
- memmove(answer + x, answer + x + 1, xend - x);
+ charmove(answer + x, answer + x + 1, xend - x);
xend--;
}
break;
@@ -647,7 +647,7 @@ int nanogetstr(int allowtabs, const char *buf, const char *def,
break;
case NANO_BACKSPACE_KEY:
if (x > 0) {
- memmove(answer + x - 1, answer + x, xend - x + 1);
+ charmove(answer + x - 1, answer + x, xend - x + 1);
x--;
xend--;
}
@@ -791,7 +791,7 @@ int nanogetstr(int allowtabs, const char *buf, const char *def,
if (kbinput < 32 || kbinput == 127)
break;
answer = charealloc(answer, xend + 2);
- memmove(answer + x + 1, answer + x, xend - x + 1);
+ charmove(answer + x + 1, answer + x, xend - x + 1);
xend++;
answer[x] = kbinput;
x++;