Commit fa0c6963 authored by Chris Allegretta's avatar Chris Allegretta
Browse files

Fixed null_at to ACTUALLY DO SOMETHING with its arg. Again, this was causing...

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/trunk/nano@866 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
No related merge requests found
Showing with 17 additions and 12 deletions
+17 -12
...@@ -5,6 +5,9 @@ CVS code - ...@@ -5,6 +5,9 @@ CVS code -
currshortcut and currslen #ifdefs to depend on both currshortcut and currslen #ifdefs to depend on both
DISABLE_HELP and DISABLE_MOUSE being defined to not DISABLE_HELP and DISABLE_MOUSE being defined to not
include. Changed all the shortcuts and lengths. include. Changed all the shortcuts and lengths.
- 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.
- cut.c: - cut.c:
do_cut_text() do_cut_text()
- Check to see whether marked text is contained within edit - Check to see whether marked text is contained within edit
......
...@@ -157,7 +157,7 @@ void cut_marked_segment(filestruct * top, int top_x, filestruct * bot, ...@@ -157,7 +157,7 @@ void cut_marked_segment(filestruct * top, int top_x, filestruct * bot,
screwed somewhere. Not doing this causes update_line to annihilate screwed somewhere. Not doing this causes update_line to annihilate
the last line copied into the cutbuffer when the mark is set ?!?!? */ the last line copied into the cutbuffer when the mark is set ?!?!? */
botcopy = copy_node(bot); botcopy = copy_node(bot);
null_at(botcopy->data, bot_x); null_at(&botcopy->data, bot_x);
next = botcopy->next; next = botcopy->next;
add_to_cutbuffer(botcopy); add_to_cutbuffer(botcopy);
...@@ -451,7 +451,7 @@ int do_uncut_text(void) ...@@ -451,7 +451,7 @@ int do_uncut_text(void)
tmp->data = charalloc(strlen(&current->data[current_x]) + 1); tmp->data = charalloc(strlen(&current->data[current_x]) + 1);
strcpy(tmp->data, &current->data[current_x]); strcpy(tmp->data, &current->data[current_x]);
splice_node(current, tmp, current->next); splice_node(current, tmp, current->next);
null_at(current->data, current_x); null_at(&current->data, current_x);
current = current->next; current = current->next;
current_x = 0; current_x = 0;
placewewant = 0; placewewant = 0;
......
...@@ -495,8 +495,8 @@ int add_open_file(int update, int dup_fix) ...@@ -495,8 +495,8 @@ int add_open_file(int update, int dup_fix)
open_files = open_files->next; open_files = open_files->next;
/* if open_files->file is NULL at the nrealloc() below, we get a /* if open_files->file is NULL at the nrealloc() below, we get a
segfault */ segfault
open_files->file = open_files; open_files->file = open_files; */
} }
/* save current filename */ /* save current filename */
...@@ -524,7 +524,7 @@ int add_open_file(int update, int dup_fix) ...@@ -524,7 +524,7 @@ int add_open_file(int update, int dup_fix)
open_files->lineno = current->lineno; open_files->lineno = current->lineno;
/* save current filestruct */ /* save current filestruct */
open_files->file = nrealloc(open_files->file, sizeof(filestruct)); open_files->file = nmalloc(sizeof(filestruct));
while (current->prev) while (current->prev)
current = current->prev; current = current->prev;
open_files->file = copy_filestruct(current); open_files->file = copy_filestruct(current);
...@@ -912,7 +912,7 @@ char *get_full_path(char *origpath) ...@@ -912,7 +912,7 @@ char *get_full_path(char *origpath)
/* otherwise, remove all non-path elements from d_there /* otherwise, remove all non-path elements from d_there
(i. e. everything after the last slash) */ (i. e. everything after the last slash) */
last_slash_index = strlen(d_there) - strlen(last_slash); last_slash_index = strlen(d_there) - strlen(last_slash);
null_at(d_there, last_slash_index + 1); null_at(&d_there, last_slash_index + 1);
/* and remove all non-file elements from d_there_file (i. e. /* and remove all non-file elements from d_there_file (i. e.
everything before and including the last slash); if we everything before and including the last slash); if we
......
...@@ -393,10 +393,12 @@ void align(char **strp) ...@@ -393,10 +393,12 @@ void align(char **strp)
} }
/* Null a string at a certain index and align it */ /* 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) void usage(void)
...@@ -1024,7 +1026,7 @@ void do_wrap(filestruct * inptr, char input_char) ...@@ -1024,7 +1026,7 @@ void do_wrap(filestruct * inptr, char input_char)
down = 1; down = 1;
} }
null_at(inptr->data, current_x); null_at(&inptr->data, current_x);
if (ISSET(MARK_ISSET) && (mark_beginbuf == inptr)) { if (ISSET(MARK_ISSET) && (mark_beginbuf == inptr)) {
mark_beginbuf = temp; mark_beginbuf = temp;
...@@ -1085,7 +1087,7 @@ void do_wrap(filestruct * inptr, char input_char) ...@@ -1085,7 +1087,7 @@ void do_wrap(filestruct * inptr, char input_char)
i = current_word_start - 1; i = current_word_start - 1;
current_x = current_word_start; current_x = current_word_start;
null_at(inptr->data, current_word_start); null_at(&inptr->data, current_word_start);
/* Increment totsize to account for the new line that /* Increment totsize to account for the new line that
will be added below, so that it won't end up being will be added below, so that it won't end up being
......
...@@ -165,7 +165,7 @@ void die_save_file(char *die_filename); ...@@ -165,7 +165,7 @@ void die_save_file(char *die_filename);
void new_file(void); void new_file(void);
void new_magicline(void); void new_magicline(void);
void splice_node(filestruct *begin, filestruct *newnode, filestruct *end); 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(void); void page_up(void);
void blank_edit(void); void blank_edit(void);
void search_init_globals(void); void search_init_globals(void);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment