1
1

Avoid compiler errors like: error: variable 'xxx' set but not used [-Werror=unused-but-set-variable]

Signed-off-by: Slava Zanko <slavazanko@gmail.com>
Этот коммит содержится в:
Slava Zanko 2013-01-17 15:21:35 +03:00
родитель d5afda1188
Коммит ee8aaf6181
22 изменённых файлов: 43 добавлений и 34 удалений

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

@ -208,6 +208,7 @@ mc_util_write_backup_content (const char *from_file_name, const char *to_file_na
int ret2;
ret2 = fflush (backup_fd);
ret2 = fclose (backup_fd);
(void) ret2;
}
g_free (contents);
return ret1;
@ -1063,6 +1064,7 @@ list_append_unique (GList * list, char *text)
g_free (lc_link->data);
tmp = g_list_remove_link (list, lc_link);
(void) tmp;
g_list_free_1 (lc_link);
}
lc_link = newlink;

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

@ -1512,6 +1512,8 @@ vfs_s_get_line (struct vfs_class *me, int sock, char *buf, int buf_len, char ter
int ret2;
ret1 = fwrite (buf, 1, 1, logfile);
ret2 = fflush (logfile);
(void) ret1;
(void) ret2;
}
if (*buf == term)
{
@ -1530,6 +1532,8 @@ vfs_s_get_line (struct vfs_class *me, int sock, char *buf, int buf_len, char ter
int ret2;
ret1 = fwrite (&c, 1, 1, logfile);
ret2 = fflush (logfile);
(void) ret1;
(void) ret2;
}
if (c == '\n')
return 1;

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

@ -457,9 +457,6 @@ mc_readdir (DIR * dirp)
struct vfs_class *vfs;
struct dirent *entry = NULL;
vfs_path_element_t *vfs_path_element;
#ifdef HAVE_CHARSET
estr_t state;
#endif
if (!mc_readdir_result)
{
@ -496,8 +493,7 @@ mc_readdir (DIR * dirp)
g_string_set_size (vfs_str_buffer, 0);
#ifdef HAVE_CHARSET
state =
str_vfs_convert_from (vfs_path_element->dir.converter, entry->d_name, vfs_str_buffer);
str_vfs_convert_from (vfs_path_element->dir.converter, entry->d_name, vfs_str_buffer);
#else
g_string_assign (vfs_str_buffer, entry->d_name);
#endif

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

@ -243,13 +243,12 @@ vfs_path_url_split (vfs_path_element_t * path_element, const char *path)
{
char *pcopy;
const char *pend;
char *dir, *colon, *inner_colon, *at, *rest;
char *colon, *inner_colon, *at, *rest;
path_element->port = 0;
pcopy = g_strdup (path);
pend = pcopy + strlen (pcopy);
dir = pcopy;
/* search for any possible user */
at = strrchr (pcopy, '@');

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

@ -380,6 +380,7 @@ background_attention (int fd, void *closure)
g_free (data[i]);
repaint_screen ();
(void) ret;
return 0;
}
@ -409,6 +410,7 @@ parent_call_header (void *routine, int argc, enum ReturnType type, FileOpContext
if (have_ctx)
ret = write (parent_fd, ctx, sizeof (FileOpContext));
(void) ret;
}
/* --------------------------------------------------------------------------------------------- */
@ -436,6 +438,7 @@ parent_va_call (void *routine, gpointer data, int argc, va_list ap)
if (ctx)
ret = read (from_parent_fd, ctx, sizeof (FileOpContext));
(void) ret;
return i;
}

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

@ -65,7 +65,6 @@ clipboard_file_to_ext_clip (const gchar * event_group_name, const gchar * event_
gpointer init_data, gpointer data)
{
char *tmp, *cmd;
int res = 0;
const char *d = getenv ("DISPLAY");
(void) event_group_name;
@ -80,7 +79,7 @@ clipboard_file_to_ext_clip (const gchar * event_group_name, const gchar * event_
cmd = g_strconcat (clipboard_store_path, " ", tmp, " 2>/dev/null", (char *) NULL);
if (cmd != NULL)
res = my_system (EXECUTE_AS_SHELL, mc_global.tty.shell, cmd);
my_system (EXECUTE_AS_SHELL, mc_global.tty.shell, cmd);
g_free (cmd);
g_free (tmp);
@ -95,7 +94,6 @@ clipboard_file_from_ext_clip (const gchar * event_group_name, const gchar * even
gpointer init_data, gpointer data)
{
char *tmp, *cmd;
int res = 0;
const char *d = getenv ("DISPLAY");
(void) event_group_name;
@ -110,7 +108,7 @@ clipboard_file_from_ext_clip (const gchar * event_group_name, const gchar * even
cmd = g_strconcat (clipboard_paste_path, " > ", tmp, " 2>/dev/null", (char *) NULL);
if (cmd != NULL)
res = my_system (EXECUTE_AS_SHELL, mc_global.tty.shell, cmd);
my_system (EXECUTE_AS_SHELL, mc_global.tty.shell, cmd);
g_free (cmd);
g_free (tmp);
@ -126,7 +124,6 @@ clipboard_text_to_file (const gchar * event_group_name, const gchar * event_name
{
int file;
vfs_path_t *fname_vpath = NULL;
ssize_t ret;
size_t str_len;
const char *text = (const char *) data;
@ -146,7 +143,12 @@ clipboard_text_to_file (const gchar * event_group_name, const gchar * event_name
return TRUE;
str_len = strlen (text);
ret = mc_write (file, (char *) text, str_len);
{
ssize_t ret;
ret = mc_write (file, (char *) text, str_len);
(void) ret;
}
mc_close (file);
return TRUE;
}

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

@ -130,6 +130,7 @@ show_console_contents_linux (int starty, unsigned char begin_line, unsigned char
/* Read the value of the mc_global.tty.console_flag */
ret = read (pipefd2[0], &message, 1);
(void) ret;
}
/* --------------------------------------------------------------------------------------------- */
@ -179,6 +180,7 @@ handle_console_linux (console_action_t action)
status = close (pipefd1[1]);
status = close (pipefd2[0]);
ret = waitpid (cons_saver_pid, &status, 0);
(void) ret;
}
}
else
@ -247,6 +249,7 @@ handle_console_linux (console_action_t action)
close (pipefd2[0]);
ret = waitpid (cons_saver_pid, &status, 0);
mc_global.tty.console_flag = '\0';
(void) ret;
}
break;
default:

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

@ -145,6 +145,7 @@ static void __attribute__ ((noreturn)) die (void)
unsigned char zero = 0;
ssize_t ret;
ret = write (1, &zero, 1);
(void) ret;
exit (3);
}

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

@ -2184,7 +2184,6 @@ static void
do_merge_hunk (WDiff * dview, action_direction_t merge_direction)
{
int from1, to1, from2, to2;
int res;
int hunk;
diff_place_t n_merge = (merge_direction == FROM_RIGHT_TO_LEFT) ? DIFF_RIGHT : DIFF_LEFT;
@ -2241,7 +2240,12 @@ do_merge_hunk (WDiff * dview, action_direction_t merge_direction)
}
fflush (merge_file);
fclose (merge_file);
res = rewrite_backup_content (merge_file_name_vpath, dview->file[n_merge]);
{
int res;
res = rewrite_backup_content (merge_file_name_vpath, dview->file[n_merge]);
(void) res;
}
mc_unlink (merge_file_name_vpath);
vfs_path_free (merge_file_name_vpath);
}

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

@ -2033,7 +2033,6 @@ edit_get_word_from_pos (const WEdit * edit, off_t start_pos, off_t * start, gsiz
off_t word_start;
long cut_len = 0;
GString *match_expr;
unsigned char *bufpos;
int c1, c2;
for (word_start = start_pos; word_start != 0; word_start--, cut_len++)
@ -2045,7 +2044,6 @@ edit_get_word_from_pos (const WEdit * edit, off_t start_pos, off_t * start, gsiz
break;
}
bufpos = &edit->buffers1[word_start >> S_EDIT_BUF_SIZE][word_start & M_EDIT_BUF_SIZE];
match_expr = g_string_sized_new (16);
do

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

@ -2439,7 +2439,6 @@ edit_block_move_cmd (WEdit * edit)
off_t current;
unsigned char *copy_buf = NULL;
off_t start_mark, end_mark;
long line;
if (eval_marks (edit, &start_mark, &end_mark))
return;
@ -2447,7 +2446,6 @@ edit_block_move_cmd (WEdit * edit)
if (!edit->column_highlight && edit->curs1 > start_mark && edit->curs1 < end_mark)
return;
line = edit->curs_line;
if (edit->mark2 < 0)
edit_mark_cmd (edit, FALSE);
edit_push_markers (edit);

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

@ -307,11 +307,7 @@ aspell_init (void)
global_speller->speller = NULL;
if (spell_language != NULL)
{
int res;
res = mc_aspell_config_replace (global_speller->config, "lang", spell_language);
}
mc_aspell_config_replace (global_speller->config, "lang", spell_language);
error = mc_new_aspell_speller (global_speller->config);
@ -443,7 +439,6 @@ aspell_set_lang (const char *lang)
{
if (lang != NULL)
{
int res;
AspellCanHaveError *error;
const char *spell_codeset;
@ -457,8 +452,8 @@ aspell_set_lang (const char *lang)
#endif
spell_codeset = str_detect_termencoding ();
res = mc_aspell_config_replace (global_speller->config, "lang", lang);
res = mc_aspell_config_replace (global_speller->config, "encoding", spell_codeset);
mc_aspell_config_replace (global_speller->config, "lang", lang);
mc_aspell_config_replace (global_speller->config, "encoding", spell_codeset);
/* the returned pointer should _not_ need to be deleted */
if (global_speller->speller != NULL)

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

@ -73,7 +73,6 @@ spell_dialog_spell_suggest_show (WEdit * edit, const char *word, char **new_word
WDialog *sug_dlg;
WListbox *sug_list;
int max_btn_len = 0;
int add_len;
int replace_len;
int skip_len;
int cancel_len;
@ -92,7 +91,6 @@ spell_dialog_spell_suggest_show (WEdit * edit, const char *word, char **new_word
ypos -= sug_dlg_h;
add_btn = button_new (5, 28, B_ADD_WORD, NORMAL_BUTTON, _("&Add word"), 0);
add_len = button_get_len (add_btn);
replace_btn = button_new (7, 28, B_ENTER, NORMAL_BUTTON, _("&Replace"), 0);
replace_len = button_get_len (replace_btn);
skip_btn = button_new (9, 28, B_SKIP_WORD, NORMAL_BUTTON, _("&Skip"), 0);

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

@ -1785,6 +1785,7 @@ do_find (const char *start_dir, ssize_t start_dir_len, const char *ignore_dirs,
vfs_path_free (current_panel->cwd_vpath);
current_panel->cwd_vpath = vfs_path_from_str (PATH_SEP_STR);
ret = chdir (PATH_SEP_STR);
(void) ret;
}
panelize_save_panel (current_panel);
}

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

@ -898,6 +898,7 @@ setup_dummy_mc (void)
setup_mc ();
vpath = vfs_path_from_str (d);
ret = mc_chdir (vpath);
(void) ret;
vfs_path_free (vpath);
g_free (d);
}

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

@ -373,6 +373,7 @@ do_external_panelize (char *command)
int ret;
panel_set_cwd (current_panel, PATH_SEP_STR);
ret = chdir (PATH_SEP_STR);
(void) ret;
}
}
else

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

@ -742,7 +742,6 @@ static void
tree_rescan (void *data)
{
WTree *tree = data;
int ret;
vfs_path_t *old_vpath;
old_vpath = vfs_path_clone (vfs_get_raw_current_dir ());
@ -751,8 +750,11 @@ tree_rescan (void *data)
if (tree->selected_ptr != NULL && mc_chdir (tree->selected_ptr->name) == 0)
{
int ret;
tree_store_rescan (tree->selected_ptr->name);
ret = mc_chdir (old_vpath);
(void) ret;
}
vfs_path_free (old_vpath);
}

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

@ -432,6 +432,8 @@ main (int argc, char *argv[])
int ret2;
ret1 = write (last_wd_fd, last_wd_string, strlen (last_wd_string));
ret2 = close (last_wd_fd);
(void) ret1;
(void) ret2;
}
}
g_free (last_wd_string);

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

@ -255,6 +255,7 @@ init_subshell_child (const char *pty_name)
{
int ret;
ret = chdir (mc_config_get_home_dir ()); /* FIXME? What about when we re-run the subshell? */
(void) ret;
}
/* Set MC_SID to prevent running one mc from another */

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

@ -253,6 +253,7 @@ fish_command (struct vfs_class *me, struct vfs_s_super *super, int wait_reply, c
size_t ret;
ret = fwrite (str, strlen (str), 1, logfile);
ret = fflush (logfile);
(void) ret;
}
tty_enable_interrupt_key ();

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

@ -478,6 +478,7 @@ ftpfs_command (struct vfs_class *me, struct vfs_s_super *super, int wait_reply,
{
size_t ret;
ret = fwrite (cmdstr, cmdlen, 1, MEDATA->logfile);
(void) ret;
}
fflush (MEDATA->logfile);

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

@ -249,12 +249,10 @@ START_TEST (test_vfs_parse_ls_lga_reorder)
{
size_t filepos = 0;
struct vfs_s_entry *ent1, *ent2, *ent3;
int i;
vfs_parse_ls_lga_init();
ent1 = vfs_s_generate_entry (&vfs_test_ops1, NULL, vfs_root_inode, 0);
i = ent1->ino->st.st_nlink;
if (! vfs_parse_ls_lga ("drwxrwxr-x 10 500 500 4096 Jun 23 17:09 build_root1",
&ent1->ino->st, &ent1->name, &ent1->ino->linkname, &filepos))
{
@ -266,7 +264,6 @@ START_TEST (test_vfs_parse_ls_lga_reorder)
ent2 = vfs_s_generate_entry (&vfs_test_ops1, NULL, vfs_root_inode, 0);
i = ent2->ino->st.st_nlink;
if (! vfs_parse_ls_lga ("drwxrwxr-x 10 500 500 4096 Jun 23 17:09 build_root2",
&ent2->ino->st, &ent2->name, &ent2->ino->linkname, &filepos))
{
@ -277,7 +274,6 @@ START_TEST (test_vfs_parse_ls_lga_reorder)
vfs_s_insert_entry (&vfs_test_ops1, vfs_root_inode, ent2);
ent3 = vfs_s_generate_entry (&vfs_test_ops1, NULL, vfs_root_inode, 0);
i = ent3->ino->st.st_nlink;
if (! vfs_parse_ls_lga ("drwxrwxr-x 10 500 500 4096 Jun 23 17:09 ..",
&ent3->ino->st, &ent3->name, &ent3->ino->linkname, &filepos))
{