From bd457ec7804b82b7383cb60ba88580f9a51ea261 Mon Sep 17 00:00:00 2001
From: Vit Rosin <vit_r@list.ru>
Date: Sat, 28 Nov 2009 12:40:48 +0000
Subject: [PATCH] UNneeded_goto
---
edit/edit.c | 43 ++++++++++++++++++-------------------------
1 files changed, 18 insertions(+), 25 deletions(-)
diff --git a/edit/edit.c b/edit/edit.c
index 0b0b1eb..04528b8 100644
a
|
b
|
edit_execute_macro (WEdit *edit, struct macro macro[], int n) |
3276 | 3276 | edit->macro_depth--; |
3277 | 3277 | } |
3278 | 3278 | |
3279 | | /* User edit menu, like user menu (F2) but only in editor. */ |
| 3279 | /* On file selected (i.e. by arrows) (F4) invokes the editor |
| 3280 | then (F11) or (S-F1) invokes user menu */ |
3280 | 3281 | static void |
3281 | 3282 | user_menu (WEdit * edit) |
3282 | 3283 | { |
3283 | 3284 | FILE *fd; |
3284 | | int nomark; |
3285 | | struct stat status; |
| 3285 | int nomark, rc = 0; |
3286 | 3286 | long start_mark, end_mark; |
| 3287 | struct stat status; |
3287 | 3288 | char *block_file = concat_dir_and_file (home_dir, EDIT_BLOCK_FILE); |
3288 | | int rc = 0; |
3289 | 3289 | |
| 3290 | /* remember marked or not */ |
3290 | 3291 | nomark = eval_marks (edit, &start_mark, &end_mark); |
3291 | | if (!nomark) /* remember marked or not */ |
3292 | | edit_save_block (edit, block_file, start_mark, end_mark); |
| 3292 | if (!nomark) |
| 3293 | edit_save_block (edit, block_file, start_mark, end_mark); |
3293 | 3294 | |
3294 | 3295 | /* run shell scripts from menu */ |
3295 | 3296 | user_menu_cmd (edit); |
3296 | 3297 | |
3297 | | if (mc_stat (block_file, &status) != 0 || !status.st_size) { |
3298 | | /* no block messages */ |
3299 | | goto cleanup; |
3300 | | } |
| 3298 | if (mc_stat (block_file, &status) == 0 || status.st_size) { |
| 3299 | /* there are block messages */ |
| 3300 | if (!nomark) /* i.e. we have marked block */ |
| 3301 | rc = edit_block_delete_cmd (edit); |
3301 | 3302 | |
3302 | | if (!nomark) { |
3303 | | /* i.e. we have marked block */ |
3304 | | rc = edit_block_delete_cmd (edit); |
3305 | | } |
| 3303 | if (!rc) |
| 3304 | edit_insert_file (edit, block_file); |
3306 | 3305 | |
3307 | | if (!rc) { |
3308 | | edit_insert_file (edit, block_file); |
3309 | | } |
| 3306 | fd = fopen (block_file, "w"); |
| 3307 | if (fd) /* truncate block file */ |
| 3308 | fclose (fd); |
3310 | 3309 | |
3311 | | /* truncate block file */ |
3312 | | if ((fd = fopen (block_file, "w"))) { |
3313 | | fclose (fd); |
| 3310 | edit_refresh_cmd (edit); |
| 3311 | edit->force |= REDRAW_COMPLETELY; |
3314 | 3312 | } |
3315 | | |
3316 | | edit_refresh_cmd (edit); |
3317 | | edit->force |= REDRAW_COMPLETELY; |
3318 | | |
3319 | | cleanup: |
3320 | 3313 | g_free (block_file); |
3321 | 3314 | } |
3322 | 3315 | |