* edit.c (edit_clean): g_free handles NULL argument too,

no need for the comparison.
            (edit_move_backward_lots): Likewise.
        * editcmd.c (edit_set_filename): Likewise.
            (edit_replace_cmd): Likewise.
            (edit_search_cmd): Likewise.
            (edit_sort_cmd): Likewise.
            (edit_mail_dialog): Likewise.
        * syntax.c (syntax_g_free): Likewise.
            (edit_read_syntax_rules): Likewise.
This commit is contained in:
Andrew V. Samoilov 2004-09-24 22:37:00 +00:00
parent 68a7c1dfab
commit 12d24222db
4 changed files with 32 additions and 37 deletions

View File

@ -1,3 +1,16 @@
2004-09-25 Pavel S. Shirshov <pavelsh@mail.ru>
* edit.c (edit_clean): g_free handles NULL argument too,
no need for the comparison.
(edit_move_backward_lots): Likewise.
* editcmd.c (edit_set_filename): Likewise.
(edit_replace_cmd): Likewise.
(edit_search_cmd): Likewise.
(edit_sort_cmd): Likewise.
(edit_mail_dialog): Likewise.
* syntax.c (syntax_g_free): Likewise.
(edit_read_syntax_rules): Likewise.
2004-09-24 Roland Illig <roland.illig@gmx.de>
* editdraw.c (status_string): Removed unused parameter.

View File

@ -593,9 +593,7 @@ edit_clean (WEdit *edit)
edit_free_syntax_rules (edit);
book_mark_flush (edit, -1);
for (; j <= MAXBUFF; j++) {
if (edit->buffers1[j] != NULL)
g_free (edit->buffers1[j]);
if (edit->buffers2[j] != NULL)
g_free (edit->buffers2[j]);
}
@ -1053,7 +1051,6 @@ edit_move_backward_lots (WEdit *edit, long increment)
edit->buffers2[edit->curs2 >> S_EDIT_BUF_SIZE] =
g_malloc (EDIT_BUF_SIZE);
} else {
if (p)
g_free (p);
}

View File

@ -440,7 +440,6 @@ void menu_save_mode_cmd (void)
void
edit_set_filename (WEdit *edit, const char *f)
{
if (edit->filename)
g_free (edit->filename);
if (!f)
f = "";
@ -1759,18 +1758,12 @@ edit_replace_cmd (WEdit *edit, int again)
int argord[NUM_REPL_ARGS];
if (!edit) {
if (old1) {
g_free (old1);
old1 = 0;
}
if (old2) {
g_free (old2);
old2 = 0;
}
if (old3) {
g_free (old3);
old3 = 0;
}
return;
}
last_search = edit->last_byte;
@ -2008,10 +2001,8 @@ void edit_search_cmd (WEdit * edit, int again)
char *exp = "";
if (!edit) {
if (old) {
g_free (old);
old = 0;
}
return;
}
exp = old ? old : exp;
@ -2039,7 +2030,6 @@ void edit_search_cmd (WEdit * edit, int again)
if (exp) {
if (*exp) {
int len = 0;
if (old)
g_free (old);
old = g_strdup (exp);
@ -2378,7 +2368,6 @@ int edit_sort_cmd (WEdit * edit)
if (!exp)
return 1;
if (old)
g_free (old);
old = exp;
@ -2624,11 +2613,8 @@ void edit_mail_dialog (WEdit * edit)
Quick_input.widgets = quick_widgets;
if (quick_dialog (&Quick_input) != B_CANCEL) {
if (mail_cc_last)
g_free (mail_cc_last);
if (mail_subject_last)
g_free (mail_subject_last);
if (mail_to_last)
g_free (mail_to_last);
mail_cc_last = tmail_cc;
mail_subject_last = tmail_subject;

View File

@ -86,7 +86,7 @@ struct _syntax_marker {
int option_syntax_highlighting = 1;
#define syntax_g_free(x) do {if(x) {g_free(x); (x)=0;}} while (0)
#define syntax_g_free(x) do {g_free(x); (x)=0;} while (0)
static gint
mc_defines_destroy (gpointer key, gpointer value, gpointer data)
@ -673,7 +673,6 @@ edit_read_syntax_rules (WEdit *edit, FILE *f, char **args)
g = 0;
line = save_line + 1;
syntax_g_free (error_file_name);
if (l)
syntax_g_free (l);
if (!read_one_line (&l, f))
break;