1
1

Code cleanup: removed unused variables amd removed unnedeed code.

Signed-off-by: Slava Zanko <slavazanko@gmail.com>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
Этот коммит содержится в:
Andrew Borodin 2012-07-16 16:14:33 +04:00
родитель 71ebcc5896
Коммит 23c95d36ac
18 изменённых файлов: 39 добавлений и 59 удалений

Просмотреть файл

@ -99,7 +99,6 @@ static void
load_codepages_list_from_file (GPtrArray ** list, const char *fname) load_codepages_list_from_file (GPtrArray ** list, const char *fname)
{ {
FILE *f; FILE *f;
guint i;
char buf[BUF_MEDIUM]; char buf[BUF_MEDIUM];
char *default_codepage = NULL; char *default_codepage = NULL;
@ -107,7 +106,7 @@ load_codepages_list_from_file (GPtrArray ** list, const char *fname)
if (f == NULL) if (f == NULL)
return; return;
for (i = 0; fgets (buf, sizeof buf, f) != NULL;) while (fgets (buf, sizeof buf, f) != NULL)
{ {
/* split string into id and cpname */ /* split string into id and cpname */
char *p = buf; char *p = buf;
@ -141,6 +140,8 @@ load_codepages_list_from_file (GPtrArray ** list, const char *fname)
} }
else else
{ {
unsigned int i;
/* whether id is already present in list */ /* whether id is already present in list */
/* if yes, overwrite description */ /* if yes, overwrite description */
for (i = 0; i < (*list)->len; i++) for (i = 0; i < (*list)->len; i++)

Просмотреть файл

@ -319,7 +319,6 @@ str_8bit_fit_to_term (const char *text, int width, align_crt_t just_mode)
goto finally; goto finally;
memset (actual, ' ', width - length - ident); memset (actual, ' ', width - length - ident);
actual += width - length - ident; actual += width - length - ident;
remain -= width - length - ident;
} }
} }
else else
@ -393,7 +392,6 @@ str_8bit_term_trim (const char *text, int width)
{ {
memset (actual, '.', width); memset (actual, '.', width);
actual += width; actual += width;
remain -= width;
} }
else else
{ {

Просмотреть файл

@ -260,7 +260,6 @@ str_ascii_fit_to_term (const char *text, int width, align_crt_t just_mode)
goto finally; goto finally;
memset (actual, ' ', width - length - ident); memset (actual, ' ', width - length - ident);
actual += width - length - ident; actual += width - length - ident;
remain -= width - length - ident;
} }
} }
else else
@ -340,7 +339,6 @@ str_ascii_term_trim (const char *text, int width)
{ {
memset (actual, '.', width); memset (actual, '.', width);
actual += width; actual += width;
remain -= width;
} }
else else
{ {

Просмотреть файл

@ -104,13 +104,11 @@ mc_def_getlocalcopy (const vfs_path_t * filename_vpath)
fdin = -1; fdin = -1;
if (i == -1) if (i == -1)
goto fail; goto fail;
i = close (fdout); i = close (fdout);
fdout = -1; fdout = -1;
if (i == -1) if (i == -1)
{
fdout = -1;
goto fail; goto fail;
}
if (mc_stat (filename_vpath, &mystat) != -1) if (mc_stat (filename_vpath, &mystat) != -1)
mc_chmod (tmp_vpath, mystat.st_mode); mc_chmod (tmp_vpath, mystat.st_mode);

Просмотреть файл

@ -114,14 +114,12 @@ draw_history_button (WInput * in)
widget_move (&in->widget, 0, in->field_width - HISTORY_BUTTON_WIDTH); widget_move (&in->widget, 0, in->field_width - HISTORY_BUTTON_WIDTH);
tty_setcolor (disabled ? DISABLED_COLOR : in->color[WINPUTC_HISTORY]); tty_setcolor (disabled ? DISABLED_COLOR : in->color[WINPUTC_HISTORY]);
#ifdef LARGE_HISTORY_BUTTON #ifdef LARGE_HISTORY_BUTTON
{ tty_print_string ("[ ]");
Dlg_head *h; widget_move (&in->widget, 0, in->field_width - HISTORY_BUTTON_WIDTH + 1);
h = in->widget.owner;
tty_print_string ("[ ]");
widget_move (&in->widget, 0, in->field_width - HISTORY_BUTTON_WIDTH + 1);
}
#endif #endif
tty_print_char (c); tty_print_char (c);
} }
@ -1137,8 +1135,6 @@ input_handle_char (WInput * in, int key)
cb_ret_t v; cb_ret_t v;
unsigned long command; unsigned long command;
v = MSG_NOT_HANDLED;
if (quote != 0) if (quote != 0)
{ {
input_free_completions (in); input_free_completions (in);

Просмотреть файл

@ -86,7 +86,9 @@ static gboolean parse_mc_v_argument (const gchar * option_name, const gchar * va
static GOptionContext *context; static GOptionContext *context;
#ifdef HAVE_SUBSHELL_SUPPORT
static gboolean mc_args__nouse_subshell = FALSE; static gboolean mc_args__nouse_subshell = FALSE;
#endif /* HAVE_SUBSHELL_SUPPORT */
static gboolean mc_args__show_datadirs = FALSE; static gboolean mc_args__show_datadirs = FALSE;
static gboolean mc_args__show_datadirs_extended = FALSE; static gboolean mc_args__show_datadirs_extended = FALSE;
static gboolean mc_args__show_configure_opts = FALSE; static gboolean mc_args__show_configure_opts = FALSE;

Просмотреть файл

@ -592,31 +592,22 @@ dview_get_utf (char *str, int *char_width, gboolean * result)
if (str == NULL) if (str == NULL)
{ {
*result = FALSE; *result = FALSE;
width = 0;
return 0; return 0;
} }
res = g_utf8_get_char_validated (str, -1); res = g_utf8_get_char_validated (str, -1);
if (res < 0) if (res < 0)
{
ch = *str; ch = *str;
width = 0;
}
else else
{ {
ch = res; ch = res;
/* Calculate UTF-8 char width */ /* Calculate UTF-8 char width */
next_ch = g_utf8_next_char (str); next_ch = g_utf8_next_char (str);
if (next_ch) if (next_ch != NULL)
{
width = next_ch - str; width = next_ch - str;
}
else else
{
ch = 0; ch = 0;
width = 0;
}
} }
*char_width = width; *char_width = width;
return ch; return ch;

Просмотреть файл

@ -555,7 +555,7 @@ edit_block_delete (WEdit * edit)
{ {
long count; long count;
long start_mark, end_mark; long start_mark, end_mark;
int curs_pos, line_width; int curs_pos;
long curs_line, c1, c2; long curs_line, c1, c2;
if (eval_marks (edit, &start_mark, &end_mark)) if (eval_marks (edit, &start_mark, &end_mark))
@ -583,9 +583,6 @@ edit_block_delete (WEdit * edit)
curs_line = edit->curs_line; curs_line = edit->curs_line;
/* calculate line width and cursor position before cut */
line_width = edit_move_forward3 (edit, edit_bol (edit, edit->curs1), 0,
edit_eol (edit, edit->curs1));
curs_pos = edit->curs_col + edit->over_col; curs_pos = edit->curs_col + edit->over_col;
/* move cursor to start of selection */ /* move cursor to start of selection */
@ -596,12 +593,14 @@ edit_block_delete (WEdit * edit)
{ {
if (edit->column_highlight) if (edit->column_highlight)
{ {
int line_width;
if (edit->mark2 < 0) if (edit->mark2 < 0)
edit_mark_cmd (edit, 0); edit_mark_cmd (edit, 0);
edit_delete_column_of_text (edit); edit_delete_column_of_text (edit);
/* move cursor to the saved position */ /* move cursor to the saved position */
edit_move_to_line (edit, curs_line); edit_move_to_line (edit, curs_line);
/* calculate line width after cut */ /* calculate line width and cursor position before cut */
line_width = edit_move_forward3 (edit, edit_bol (edit, edit->curs1), 0, line_width = edit_move_forward3 (edit, edit_bol (edit, edit->curs1), 0,
edit_eol (edit, edit->curs1)); edit_eol (edit, edit->curs1));
if (option_cursor_beyond_eol && curs_pos > line_width) if (option_cursor_beyond_eol && curs_pos > line_width)

Просмотреть файл

@ -258,15 +258,13 @@ do_chown (uid_t u, gid_t g)
static void static void
apply_chowns (uid_t u, gid_t g) apply_chowns (uid_t u, gid_t g)
{ {
char *fname;
need_update = end_chown = 1; need_update = end_chown = 1;
do_chown (u, g); do_chown (u, g);
do do
{ {
fname = next_file (); next_file ();
do_chown (u, g); do_chown (u, g);
} }
while (current_panel->marked); while (current_panel->marked);

Просмотреть файл

@ -236,7 +236,7 @@ select_unselect_cmd (const char *title, const char *history_name, gboolean do_se
if (quick_dialog (&quick_dlg) == B_CANCEL) if (quick_dialog (&quick_dlg) == B_CANCEL)
return; return;
if (!reg_exp) if (reg_exp == NULL)
return; return;
if (!*reg_exp) if (!*reg_exp)
{ {

Просмотреть файл

@ -631,10 +631,7 @@ create_panels (void)
/* 3. Create active panel */ /* 3. Create active panel */
if (current_dir == NULL) if (current_dir == NULL)
{
current_dir = vfs_path_to_str (original_dir);
mc_chdir (original_dir); mc_chdir (original_dir);
}
else else
{ {
vfs_path_t *vpath; vfs_path_t *vpath;

Просмотреть файл

@ -3015,6 +3015,8 @@ subshell_chdir (const vfs_path_t * vpath)
#ifdef HAVE_SUBSHELL_SUPPORT #ifdef HAVE_SUBSHELL_SUPPORT
if (mc_global.tty.use_subshell && vfs_current_is_local ()) if (mc_global.tty.use_subshell && vfs_current_is_local ())
do_subshell_chdir (vpath, FALSE, TRUE); do_subshell_chdir (vpath, FALSE, TRUE);
#else /* HAVE_SUBSHELL_SUPPORT */
(void) vpath;
#endif /* HAVE_SUBSHELL_SUPPORT */ #endif /* HAVE_SUBSHELL_SUPPORT */
} }

Просмотреть файл

@ -408,7 +408,7 @@ tree_store_add_entry (const vfs_path_t * name)
abort (); abort ();
/* Search for the correct place */ /* Search for the correct place */
while (current && (flag = pathcmp (current->name, name)) < 0) while (current != NULL && (flag = pathcmp (current->name, name)) < 0)
{ {
old = current; old = current;
current = current->next; current = current->next;
@ -430,7 +430,8 @@ tree_store_add_entry (const vfs_path_t * name)
} }
else else
{ {
old->next = new; if (old != NULL)
old->next = new;
new->prev = old; new->prev = old;
} }
new->next = NULL; new->next = NULL;
@ -440,7 +441,7 @@ tree_store_add_entry (const vfs_path_t * name)
{ {
/* Insert in to the middle of the list */ /* Insert in to the middle of the list */
new->prev = old; new->prev = old;
if (old) if (old != NULL)
{ {
/* Yes, in the middle */ /* Yes, in the middle */
new->next = old->next; new->next = old->next;

Просмотреть файл

@ -710,18 +710,24 @@ fish_dir_load (struct vfs_class *me, struct vfs_s_inode *dir, char *remote_path)
char *temp; char *temp;
char *data_start = buffer + 1; char *data_start = buffer + 1;
char *filename = data_start; char *filename = data_start;
char *linkname = data_start; char *filename_bound;
char *filename_bound = filename + strlen (filename);
char *linkname_bound = filename_bound; filename_bound = filename + strlen (filename);
if (!strcmp (data_start, "\".\"") || !strcmp (data_start, "\"..\"")) if (!strcmp (data_start, "\".\"") || !strcmp (data_start, "\"..\""))
break; /* We'll do "." and ".." ourselves */ break; /* We'll do "." and ".." ourselves */
if (S_ISLNK (ST.st_mode)) if (S_ISLNK (ST.st_mode))
{ {
char *linkname;
char *linkname_bound;
/* we expect: "escaped-name" -> "escaped-name" /* we expect: "escaped-name" -> "escaped-name"
// -> cannot occur in filenames, // -> cannot occur in filenames,
// because it will be escaped to -\> */ // because it will be escaped to -\> */
linkname_bound = filename_bound;
if (*filename == '"') if (*filename == '"')
++filename; ++filename;

Просмотреть файл

@ -2488,7 +2488,8 @@ ftpfs_netrc_lookup (const char *host, char **login, char **pass)
} }
/* Ignore unsafe passwords */ /* Ignore unsafe passwords */
if (strcmp (*login, "anonymous") && strcmp (*login, "ftp") if (*login != NULL &&
strcmp (*login, "anonymous") != 0 && strcmp (*login, "ftp") != 0
&& ftpfs_netrc_bad_mode (netrcname)) && ftpfs_netrc_bad_mode (netrcname))
{ {
need_break = 1; need_break = 1;

Просмотреть файл

@ -190,7 +190,9 @@ sfs_vfmake (const vfs_path_t * vpath, vfs_path_t * cache_vpath)
COPY_CHAR; COPY_CHAR;
continue; continue;
} }
COPY_STRING (ptr); if (ptr != NULL) {
COPY_STRING (ptr);
}
} }
else else
{ {

Просмотреть файл

@ -811,10 +811,9 @@ tar_open_archive (struct vfs_s_super *archive, const vfs_path_t * vpath,
} }
/* Record of zeroes */ /* Record of zeroes */
case STATUS_EOFMARK: case STATUS_EOFMARK: /* If error after 0's */
status = prev_status; /* If error after 0's */
/* FALL THRU */ /* FALL THRU */
/* exit from loop */
case STATUS_EOF: /* End of archive */ case STATUS_EOF: /* End of archive */
break; break;
} }

Просмотреть файл

@ -88,31 +88,22 @@ utf8_to_int (char *str, int *char_width, gboolean * result)
if (str == NULL) if (str == NULL)
{ {
*result = FALSE; *result = FALSE;
width = 0;
return 0; return 0;
} }
res = g_utf8_get_char_validated (str, -1); res = g_utf8_get_char_validated (str, -1);
if (res < 0) if (res < 0)
{
ch = *str; ch = *str;
width = 0;
}
else else
{ {
ch = res; ch = res;
/* Calculate UTF-8 char width */ /* Calculate UTF-8 char width */
next_ch = g_utf8_next_char (str); next_ch = g_utf8_next_char (str);
if (next_ch) if (next_ch)
{
width = next_ch - str; width = next_ch - str;
}
else else
{
ch = 0; ch = 0;
width = 0;
}
} }
*char_width = width; *char_width = width;
return ch; return ch;