Removing conditional directives that split up parts of statements, which might influence code understanding, maintainability and error-proneness negatively.

This commit is contained in:
Flavio Medeiros 2015-11-03 10:06:26 -03:00
commit 3d1f0c11b3
3 changed files with 9 additions and 8 deletions

View file

@ -431,11 +431,11 @@ int mkpath(const char *path, int mode)
dir = g_strndup(path, (int) (p-path));
if (stat(dir, &statbuf) != 0) {
#ifndef WIN32
if (mkdir(dir, mode) == -1)
gboolean failed = (mkdir(dir, mode) == -1);
#else
if (_mkdir(dir) == -1)
gboolean failed = (_mkdir(dir) == -1);
#endif
{
if (failed) {
g_free(dir);
return -1;
}

View file

@ -212,11 +212,11 @@ GIOChannel *net_connect_ip(IPADDR *ip, int port, IPADDR *my_ip)
ret = connect(handle, &so.sa, SIZEOF_SOCKADDR(so));
#ifndef WIN32
if (ret < 0 && errno != EINPROGRESS)
gboolean failed = (ret < 0 && errno != EINPROGRESS);
#else
if (ret < 0 && WSAGetLastError() != WSAEWOULDBLOCK)
gboolean failed = (ret < 0 && WSAGetLastError() != WSAEWOULDBLOCK);
#endif
{
if (failed) {
int old_errno = errno;
close(handle);
errno = old_errno;

View file

@ -398,10 +398,11 @@ void term_gets(GArray *buffer, int *line_count)
for (;;) {
#ifdef WIDEC_CURSES
if (get_wch(&key) == ERR)
gboolean failed = (get_wch(&key) == ERR);
#else
if ((key = getch()) == ERR)
gboolean failed = ((key = getch()) == ERR);
#endif
if (failed)
break;
#ifdef KEY_RESIZE
if (key == KEY_RESIZE)