From 22bae9812c12e20481f669d2c68ac5bb7db5b5be Mon Sep 17 00:00:00 2001 From: Chris Allegretta Date: Mon, 22 Oct 2001 23:32:58 +0000 Subject: [PATCH] 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 --- ChangeLog | 4 ++++ cut.c | 4 ++-- nano.c | 12 +++++++----- proto.h | 2 +- 4 files changed, 14 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index dbdf7a16..861c624f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -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). diff --git a/cut.c b/cut.c index 2dd8697a..7d1fd992 100644 --- a/cut.c +++ b/cut.c @@ -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(¤t->data[current_x]) + 1); strcpy(tmp->data, ¤t->data[current_x]); splice_node(current, tmp, current->next); - null_at(current->data, current_x); + null_at(¤t->data, current_x); current = current->next; current_x = 0; placewewant = 0; diff --git a/nano.c b/nano.c index 1802cff5..3132f509 100644 --- a/nano.c +++ b/nano.c @@ -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])) { diff --git a/proto.h b/proto.h index aa0a53bc..9827115d 100644 --- a/proto.h +++ b/proto.h @@ -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); -- 2.39.5