0
0
mirror of https://github.com/vim/vim.git synced 2025-10-25 09:04:09 -04:00

patch 9.0.1246: code is indented more than necessary

Problem:    Code is indented more than necessary.
Solution:   Use an early return where it makes sense. (Yegappan Lakshmanan,
            closes #11887)
This commit is contained in:
Yegappan Lakshmanan
2023-01-26 12:00:00 +00:00
committed by Bram Moolenaar
parent 032713f829
commit 142ed77898
13 changed files with 510 additions and 515 deletions

View File

@@ -205,18 +205,18 @@ batfile_thisversion(char *path)
int found = FALSE;
fd = fopen(path, "r");
if (fd != NULL)
if (fd == NULL)
return FALSE;
while (fgets(line, sizeof(line), fd) != NULL)
{
while (fgets(line, sizeof(line), fd) != NULL)
if (strncmp(line, VIMBAT_UNINSTKEY, key_len) == 0)
{
if (strncmp(line, VIMBAT_UNINSTKEY, key_len) == 0)
{
found = TRUE;
break;
}
found = TRUE;
break;
}
fclose(fd);
}
fclose(fd);
return found;
}
@@ -261,12 +261,12 @@ remove_if_exists(char *path, char *filename)
sprintf(buf, "%s\\%s", path, filename);
fd = fopen(buf, "r");
if (fd != NULL)
{
fclose(fd);
printf("removing %s\n", buf);
remove(buf);
}
if (fd == NULL)
return;
fclose(fd);
printf("removing %s\n", buf);
remove(buf);
}
static void
@@ -287,21 +287,21 @@ remove_start_menu(void)
int i;
struct stat st;
if (get_shell_folder_path(path, VIM_STARTMENU))
if (get_shell_folder_path(path, VIM_STARTMENU) == FAIL)
return;
for (i = 1; i < TARGET_COUNT; ++i)
remove_if_exists(path, targets[i].lnkname);
remove_if_exists(path, "uninstall.lnk");
remove_if_exists(path, "Help.lnk");
// Win95 uses .pif, WinNT uses .lnk
remove_if_exists(path, "Vim tutor.pif");
remove_if_exists(path, "Vim tutor.lnk");
remove_if_exists(path, "Vim online.url");
if (stat(path, &st) == 0)
{
for (i = 1; i < TARGET_COUNT; ++i)
remove_if_exists(path, targets[i].lnkname);
remove_if_exists(path, "uninstall.lnk");
remove_if_exists(path, "Help.lnk");
// Win95 uses .pif, WinNT uses .lnk
remove_if_exists(path, "Vim tutor.pif");
remove_if_exists(path, "Vim tutor.lnk");
remove_if_exists(path, "Vim online.url");
if (stat(path, &st) == 0)
{
printf("removing %s\n", path);
rmdir(path);
}
printf("removing %s\n", path);
rmdir(path);
}
}