Fixed null_at to ACTUALLY DO SOMETHING with its arg. Again, this was causing nasty errors if the call to nrealloc moved where the data was located

git-svn-id: svn://svn.savannah.gnu.org/nano/branches/nano_1_0_branch/nano@867 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
This commit is contained in:
Chris Allegretta 2001-10-22 23:32:58 +00:00
parent d37c49d108
commit 22bae9812c
4 changed files with 14 additions and 8 deletions

View File

@ -1,4 +1,8 @@
CVS code -
- General
- Fixed null_at to ACTUALLY DO SOMETHING with its arg. Again,
this was causing nasty errors if the call to nrealloc moved
where the data was located.
- po/de.po:
- Updated German translation (Karl Eichwalder).

4
cut.c
View File

@ -96,7 +96,7 @@ void cut_marked_segment(filestruct * top, int top_x, filestruct * bot,
free(top->data);
top->data = tmpstr;
null_at(bot->data, bot_x);
null_at(&bot->data, bot_x);
next = bot->next;
/* We explicitly don't decrement totlines here because we don't snarf
@ -399,7 +399,7 @@ int do_uncut_text(void)
tmp->data = nmalloc(strlen(&current->data[current_x]) + 1);
strcpy(tmp->data, &current->data[current_x]);
splice_node(current, tmp, current->next);
null_at(current->data, current_x);
null_at(&current->data, current_x);
current = current->next;
current_x = 0;
placewewant = 0;

12
nano.c
View File

@ -346,10 +346,12 @@ void align(char **strp)
}
/* Null a string at a certain index and align it */
void null_at(char *data, int index)
void null_at(char **data, int index)
{
data[index] = 0;
align(&data);
/* Ahh! Damn dereferencing */
(*data)[index] = 0;
align(data);
}
void usage(void)
@ -828,7 +830,7 @@ void do_wrap(filestruct * inptr, char input_char)
down = 1;
}
null_at(inptr->data, current_x);
null_at(&inptr->data, current_x);
if (ISSET(MARK_ISSET) && (mark_beginbuf == inptr)) {
mark_beginbuf = temp;
@ -884,7 +886,7 @@ void do_wrap(filestruct * inptr, char input_char)
&& (current_x == current_word_start)) {
current_x = current_word_start;
null_at(inptr->data, current_word_start);
null_at(&inptr->data, current_word_start);
} else {
while (isspace((int) inptr->data[i])) {

View File

@ -131,7 +131,7 @@ void die(char *msg, ...);
void new_file(void);
void new_magicline(void);
void splice_node(filestruct *begin, filestruct *newnode, filestruct *end);
void null_at(char *data, int index);
void null_at(char **data, int index);
void page_up_center(void);
void blank_edit(void);
void search_init_globals(void);