From 6716e7ecffedb68a550dcae0b4eb4ed899b239a0 Mon Sep 17 00:00:00 2001 From: Pavel Roskin Date: Sun, 15 Dec 2002 06:53:52 +0000 Subject: [PATCH] * edit.c (init_dynamic_edit_buffers): Remove unused code to support loading text from buffer. --- edit/ChangeLog | 5 +++++ edit/edit.c | 35 ++++++++++++----------------------- 2 files changed, 17 insertions(+), 23 deletions(-) diff --git a/edit/ChangeLog b/edit/ChangeLog index 01838fffb..9e6fce4b5 100644 --- a/edit/ChangeLog +++ b/edit/ChangeLog @@ -1,3 +1,8 @@ +2002-12-15 Pavel Roskin + + * edit.c (init_dynamic_edit_buffers): Remove unused code to + support loading text from buffer. + 2002-12-14 Pavel Roskin * editcmd.c (edit_split_filename): Rename to edit_set_filename, diff --git a/edit/edit.c b/edit/edit.c index 2334cf3f1..2fdcdba41 100644 --- a/edit/edit.c +++ b/edit/edit.c @@ -144,8 +144,7 @@ int edit_get_byte (WEdit * edit, long byte_index) * Return 1 on error. */ static int -init_dynamic_edit_buffers (WEdit *edit, const char *filename, - const char *text) +init_dynamic_edit_buffers (WEdit *edit, const char *filename) { long buf; int j, file = -1, buf2; @@ -165,37 +164,27 @@ init_dynamic_edit_buffers (WEdit *edit, const char *filename, filename, " ", 0))); return 1; } + edit->curs1 = 0; edit->curs2 = edit->last_byte; buf2 = edit->curs2 >> S_EDIT_BUF_SIZE; edit->buffers2[buf2] = g_malloc (EDIT_BUF_SIZE); - if (filename) { - mc_read (file, - (char *) edit->buffers2[buf2] + EDIT_BUF_SIZE - - (edit->curs2 & M_EDIT_BUF_SIZE), - edit->curs2 & M_EDIT_BUF_SIZE); - } else { - memcpy (edit->buffers2[buf2] + EDIT_BUF_SIZE - - (edit->curs2 & M_EDIT_BUF_SIZE), text, - edit->curs2 & M_EDIT_BUF_SIZE); - text += edit->curs2 & M_EDIT_BUF_SIZE; - } + if (!filename) + return 0; + + mc_read (file, + (char *) edit->buffers2[buf2] + EDIT_BUF_SIZE - + (edit->curs2 & M_EDIT_BUF_SIZE), + edit->curs2 & M_EDIT_BUF_SIZE); for (buf = buf2 - 1; buf >= 0; buf--) { edit->buffers2[buf] = g_malloc (EDIT_BUF_SIZE); - if (filename) { - mc_read (file, (char *) edit->buffers2[buf], EDIT_BUF_SIZE); - } else { - memcpy (edit->buffers2[buf], text, EDIT_BUF_SIZE); - text += EDIT_BUF_SIZE; - } + mc_read (file, (char *) edit->buffers2[buf], EDIT_BUF_SIZE); } - edit->curs1 = 0; - if (file != -1) - mc_close (file); + mc_close (file); return 0; } @@ -411,7 +400,7 @@ edit_open_file (WEdit *edit, const char *filename) filename = 0; #endif } - return init_dynamic_edit_buffers (edit, filename, ""); + return init_dynamic_edit_buffers (edit, filename); } /* Restore saved cursor position in the file */