mirror of
git://git.sv.gnu.org/nano.git
synced 2025-02-03 23:15:41 +03:00
Eliding an unneeded variable.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5432 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
This commit is contained in:
parent
6007d6227b
commit
81f3177a33
@ -2,6 +2,7 @@
|
|||||||
* src/text.c (add_undo): Delete a condition that will never occur --
|
* src/text.c (add_undo): Delete a condition that will never occur --
|
||||||
this function is only ever called with PASTE when cutbuffer != NULL.
|
this function is only ever called with PASTE when cutbuffer != NULL.
|
||||||
* src/text.c: Rewrap, rewrite, rename, and reorder some things.
|
* src/text.c: Rewrap, rewrite, rename, and reorder some things.
|
||||||
|
* src/text.c (do_undo, do_redo): Elide an unneeded variable.
|
||||||
|
|
||||||
2015-11-21 Benno Schulenberg <bensberg@justemail.net>
|
2015-11-21 Benno Schulenberg <bensberg@justemail.net>
|
||||||
* src/nano.c (main): Let the value of a --fill option on the
|
* src/nano.c (main): Let the value of a --fill option on the
|
||||||
|
19
src/text.c
19
src/text.c
@ -478,8 +478,7 @@ void redo_cut(undo *u)
|
|||||||
void do_undo(void)
|
void do_undo(void)
|
||||||
{
|
{
|
||||||
undo *u = openfile->current_undo;
|
undo *u = openfile->current_undo;
|
||||||
filestruct *t = 0;
|
filestruct *t = NULL;
|
||||||
size_t len = 0;
|
|
||||||
char *data, *undidmsg = NULL;
|
char *data, *undidmsg = NULL;
|
||||||
|
|
||||||
if (!u) {
|
if (!u) {
|
||||||
@ -502,8 +501,7 @@ void do_undo(void)
|
|||||||
switch (u->type) {
|
switch (u->type) {
|
||||||
case ADD:
|
case ADD:
|
||||||
undidmsg = _("text add");
|
undidmsg = _("text add");
|
||||||
len = strlen(f->data) - strlen(u->strdata) + 1;
|
data = charalloc(strlen(f->data) - strlen(u->strdata) + 1);
|
||||||
data = charalloc(len);
|
|
||||||
strncpy(data, f->data, u->begin);
|
strncpy(data, f->data, u->begin);
|
||||||
strcpy(&data[u->begin], &f->data[u->begin + strlen(u->strdata)]);
|
strcpy(&data[u->begin], &f->data[u->begin + strlen(u->strdata)]);
|
||||||
free(f->data);
|
free(f->data);
|
||||||
@ -513,8 +511,7 @@ void do_undo(void)
|
|||||||
case BACK:
|
case BACK:
|
||||||
case DEL:
|
case DEL:
|
||||||
undidmsg = _("text delete");
|
undidmsg = _("text delete");
|
||||||
len = strlen(f->data) + strlen(u->strdata) + 1;
|
data = charalloc(strlen(f->data) + strlen(u->strdata) + 1);
|
||||||
data = charalloc(len);
|
|
||||||
strncpy(data, f->data, u->begin);
|
strncpy(data, f->data, u->begin);
|
||||||
strcpy(&data[u->begin], u->strdata);
|
strcpy(&data[u->begin], u->strdata);
|
||||||
strcpy(&data[u->begin + strlen(u->strdata)], &f->data[u->begin]);
|
strcpy(&data[u->begin + strlen(u->strdata)], &f->data[u->begin]);
|
||||||
@ -625,7 +622,6 @@ void do_undo(void)
|
|||||||
/* Redo the last thing(s) we undid. */
|
/* Redo the last thing(s) we undid. */
|
||||||
void do_redo(void)
|
void do_redo(void)
|
||||||
{
|
{
|
||||||
size_t len = 0;
|
|
||||||
char *data, *redidmsg = NULL;
|
char *data, *redidmsg = NULL;
|
||||||
undo *u = openfile->undotop;
|
undo *u = openfile->undotop;
|
||||||
|
|
||||||
@ -657,8 +653,7 @@ void do_redo(void)
|
|||||||
switch (u->type) {
|
switch (u->type) {
|
||||||
case ADD:
|
case ADD:
|
||||||
redidmsg = _("text add");
|
redidmsg = _("text add");
|
||||||
len = strlen(f->data) + strlen(u->strdata) + 1;
|
data = charalloc(strlen(f->data) + strlen(u->strdata) + 1);
|
||||||
data = charalloc(len);
|
|
||||||
strncpy(data, f->data, u->begin);
|
strncpy(data, f->data, u->begin);
|
||||||
strcpy(&data[u->begin], u->strdata);
|
strcpy(&data[u->begin], u->strdata);
|
||||||
strcpy(&data[u->begin + strlen(u->strdata)], &f->data[u->begin]);
|
strcpy(&data[u->begin + strlen(u->strdata)], &f->data[u->begin]);
|
||||||
@ -669,8 +664,7 @@ void do_redo(void)
|
|||||||
case BACK:
|
case BACK:
|
||||||
case DEL:
|
case DEL:
|
||||||
redidmsg = _("text delete");
|
redidmsg = _("text delete");
|
||||||
len = strlen(f->data) + strlen(u->strdata) + 1;
|
data = charalloc(strlen(f->data) + strlen(u->strdata) + 1);
|
||||||
data = charalloc(len);
|
|
||||||
strncpy(data, f->data, u->begin);
|
strncpy(data, f->data, u->begin);
|
||||||
strcpy(&data[u->begin], &f->data[u->begin + strlen(u->strdata)]);
|
strcpy(&data[u->begin], &f->data[u->begin + strlen(u->strdata)]);
|
||||||
free(f->data);
|
free(f->data);
|
||||||
@ -706,8 +700,7 @@ void do_redo(void)
|
|||||||
#endif
|
#endif
|
||||||
case JOIN:
|
case JOIN:
|
||||||
redidmsg = _("line join");
|
redidmsg = _("line join");
|
||||||
len = strlen(f->data) + strlen(u->strdata) + 1;
|
f->data = charealloc(f->data, strlen(f->data) + strlen(u->strdata) + 1);
|
||||||
f->data = charealloc(f->data, len);
|
|
||||||
strcat(f->data, u->strdata);
|
strcat(f->data, u->strdata);
|
||||||
if (f->next != NULL) {
|
if (f->next != NULL) {
|
||||||
filestruct *tmp = f->next;
|
filestruct *tmp = f->next;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user