* edit.h (edit_execute_cmd): Declare it here.

* edit.c: Remove edit_execute_cmd declaration.
(edit_execute_cmd): Use edit_print_string instead of edit_printf.

* editcmd.c:  Remove edit_execute_cmd declaration.
(edit_search_dialog): Eliminate tsearch_text.
(edit_search_cmd): edit_search_dialog gives g_malloc()ed exp.
Use g_strdup/g_free instead of strdup/free.
(edit_mail_dialog): quick_dialog use g_strdup, so g_free
must be used.

* bookmark.c (book_mark_clear): Eliminate rend.
It's only written but never read.
(book_mark_flush): Likewise.
(book_mark_inc): Likewise.
(book_mark_dec): Likewise.
This commit is contained in:
Andrew V. Samoilov 2001-11-05 09:23:05 +00:00
parent dd5ccea5d6
commit 328cbcb954
5 changed files with 37 additions and 30 deletions

View File

@ -1,3 +1,23 @@
2001-11-05 Andrew V. Samoilov <kai@cmail.ru>
* edit.h (edit_execute_cmd): Declare it here.
* edit.c: Remove edit_execute_cmd declaration.
(edit_execute_cmd): Use edit_print_string instead of edit_printf.
* editcmd.c: Remove edit_execute_cmd declaration.
(edit_search_dialog): Eliminate tsearch_text.
(edit_search_cmd): edit_search_dialog gives g_malloc()ed exp.
Use g_strdup/g_free instead of strdup/free.
(edit_mail_dialog): quick_dialog use g_strdup, so g_free
must be used.
* bookmark.c (book_mark_clear): Eliminate rend.
It's only written but never read.
(book_mark_flush): Likewise.
(book_mark_inc): Likewise.
(book_mark_dec): Likewise.
2001-10-23 Pavel Roskin <proski@gnu.org>
* edit.c (user_menu): If the error file is missing, treat it as
@ -275,7 +295,8 @@
* edit.c [HAVE_CHARSET]: Include charsets.h and selcodepage.h.
* editcmd.c [HAVE_CHARSET]: Add charset conversion support.
* editdraw.c [HAVE_CHARSET]: Likewise.
From Walery Studennikov <hqsoftware@mail.ru>.
From Andrew V. Samoilov <sav@bcs.zp.ua>
and Walery Studennikov <hqsoftware@mail.ru>.
2001-06-01 Pavel Roskin <proski@gnu.org>

View File

@ -146,7 +146,6 @@ int book_mark_clear (WEdit * edit, int line, int c)
{
struct _book_mark *p, *q;
int r = 1;
int rend = 0;
if (!edit->book_mark)
return r;
for (p = book_mark_find (edit, line); p; p = q) {
@ -158,7 +157,6 @@ int book_mark_clear (WEdit * edit, int line, int c)
p->prev->next = p->next;
if (p->next)
p->next->prev = p->prev;
rend = 1;
free (p);
break;
}
@ -175,7 +173,6 @@ int book_mark_clear (WEdit * edit, int line, int c)
void book_mark_flush (WEdit * edit, int c)
{
struct _book_mark *p, *q;
int rend = 0;
if (!edit->book_mark)
return;
edit->force |= REDRAW_PAGE;
@ -187,7 +184,6 @@ void book_mark_flush (WEdit * edit, int c)
q->prev->next = q->next;
if (p)
p->prev = q->prev;
rend = 1;
free (q);
}
}
@ -200,13 +196,11 @@ void book_mark_flush (WEdit * edit, int c)
/* shift down bookmarks after this line */
void book_mark_inc (WEdit * edit, int line)
{
int rend = 0;
if (edit->book_mark) {
struct _book_mark *p;
p = book_mark_find (edit, line);
for (p = p->next; p; p = p->next) {
p->line++;
rend = 1;
}
}
}
@ -214,13 +208,11 @@ void book_mark_inc (WEdit * edit, int line)
/* shift up bookmarks after this line */
void book_mark_dec (WEdit * edit, int line)
{
int rend = 0;
if (edit->book_mark) {
struct _book_mark *p;
p = book_mark_find (edit, line);
for (p = p->next; p; p = p->next) {
p->line--;
rend = 1;
}
}
}

View File

@ -2008,9 +2008,6 @@ static void check_and_wrap_line (WEdit * edit)
void edit_execute_macro (WEdit * edit, struct macro macro[], int n);
/* either command or char_for_insertion must be passed as -1 */
int edit_execute_cmd (WEdit * edit, int command, int char_for_insertion);
int edit_translate_key (WEdit * edit, unsigned int x_keycode, long x_key, int x_state, int *cmd, int *ch)
{
int command = -1;
@ -2520,9 +2517,9 @@ int edit_execute_cmd (WEdit * edit, int command, int char_for_insertion)
time (&t);
#ifdef HAVE_STRFTIME
strftime (s, sizeof (s), time_format, localtime (&t));
edit_printf (edit, s);
edit_print_string (edit, s);
#else
edit_printf (edit, ctime (&t));
edit_print_string (edit, ctime (&t));
#endif
edit->force |= REDRAW_PAGE;
break;

View File

@ -322,6 +322,9 @@ void book_mark_dec (WEdit * edit, int line);
void user_menu (WEdit *edit);
/* either command or char_for_insertion must be passed as -1 */
int edit_execute_cmd (WEdit * edit, int command, int char_for_insertion);
#define CPushFont(x,y)
#define CPopFont()
#define FIXED_FONT 1

View File

@ -1179,7 +1179,6 @@ void edit_search_dialog (WEdit * edit, char **search_text)
int treplace_case = replace_case;
int treplace_backwards = replace_backwards;
char *tsearch_text;
QuickWidget quick_widgets[] =
{
{quick_button, 6, 10, 7, SEARCH_DLG_HEIGHT, N_("&Cancel"), 0, B_CANCEL, 0,
@ -1207,7 +1206,7 @@ void edit_search_dialog (WEdit * edit, char **search_text)
quick_widgets[4].result = &treplace_regexp;
quick_widgets[5].result = &treplace_whole;
quick_widgets[6].result = &treplace_case;
quick_widgets[7].str_result = &tsearch_text;
quick_widgets[7].str_result = search_text;
quick_widgets[7].text = *search_text;
{
@ -1218,16 +1217,13 @@ void edit_search_dialog (WEdit * edit, char **search_text)
Quick_input.widgets = quick_widgets;
if (quick_dialog (&Quick_input) != B_CANCEL) {
*search_text = *(quick_widgets[7].str_result);
replace_scanf = treplace_scanf;
replace_backwards = treplace_backwards;
replace_regexp = treplace_regexp;
replace_whole = treplace_whole;
replace_case = treplace_case;
return;
} else {
*search_text = NULL;
return;
}
}
}
@ -1838,7 +1834,7 @@ void edit_search_cmd (WEdit * edit, int again)
if (!edit) {
if (old) {
free (old);
g_free (old);
old = 0;
}
return;
@ -1847,7 +1843,7 @@ void edit_search_cmd (WEdit * edit, int again)
if (again) { /*ctrl-hotkey for search again. */
if (!old)
return;
exp = (char *) strdup (old);
exp = (char *) g_strdup (old);
} else {
#ifdef HAVE_CHARSET
@ -1869,8 +1865,8 @@ void edit_search_cmd (WEdit * edit, int again)
if (*exp) {
int len = 0;
if (old)
free (old);
old = (char *) strdup (exp);
g_free (old);
old = (char *) g_strdup (exp);
if (search_create_bookmark) {
int found = 0, books = 0;
@ -1928,7 +1924,7 @@ void edit_search_cmd (WEdit * edit, int again)
}
}
}
free (exp);
g_free (exp);
}
edit->force |= REDRAW_COMPLETELY;
edit_scroll_screen_over_cursor (edit);
@ -2169,7 +2165,7 @@ int edit_sort_cmd (WEdit * edit)
if (!exp)
return 1;
if (old)
free (old);
g_free (old);
old = exp;
e = system (catstrs (" sort ", exp, " ", home_dir, BLOCK_FILE, " > ", home_dir, TEMP_FILE, 0));
@ -2292,8 +2288,6 @@ void edit_block_process_cmd (WEdit * edit, const char *shell_cmd, int block)
return;
}
int edit_execute_cmd (WEdit * edit, int command, int char_for_insertion);
/* prints at the cursor */
/* returns the number of chars printed */
int edit_print_string (WEdit * e, const char *s)
@ -2389,11 +2383,11 @@ void edit_mail_dialog (WEdit * edit)
if (quick_dialog (&Quick_input) != B_CANCEL) {
if (mail_cc_last)
free (mail_cc_last);
g_free (mail_cc_last);
if (mail_subject_last)
free (mail_subject_last);
g_free (mail_subject_last);
if (mail_to_last)
free (mail_to_last);
g_free (mail_to_last);
mail_cc_last = *(quick_widgets[2].str_result);
mail_subject_last = *(quick_widgets[4].str_result);
mail_to_last = *(quick_widgets[6].str_result);