util: Fix code style

The C code introduced in 49d8ff38e did not follow
GNOME Shell's C code style. This commit adjusts it
to comply with the correct code style.
This commit is contained in:
Georges Basile Stavracas Neto 2018-07-30 21:17:44 -03:00
parent 49d8ff38e7
commit 2991f9f102

View File

@ -524,7 +524,8 @@ shell_util_composite_capture_images (ClutterCapture *captures,
#ifndef HAVE_FDWALK #ifndef HAVE_FDWALK
static int static int
fdwalk (int (*cb)(void *data, int fd), void *data) fdwalk (int (*cb)(void *data, int fd),
void *data)
{ {
gint open_max; gint open_max;
gint fd; gint fd;
@ -537,31 +538,33 @@ fdwalk (int (*cb)(void *data, int fd), void *data)
#ifdef __linux__ #ifdef __linux__
DIR *d; DIR *d;
if ((d = opendir("/proc/self/fd"))) { if ((d = opendir("/proc/self/fd")))
{
struct dirent *de; struct dirent *de;
while ((de = readdir(d))) { while ((de = readdir(d)))
{
glong l; glong l;
gchar *e = NULL; gchar *e = NULL;
if (de->d_name[0] == '.') if (de->d_name[0] == '.')
continue; continue;
errno = 0; errno = 0;
l = strtol(de->d_name, &e, 10); l = strtol(de->d_name, &e, 10);
if (errno != 0 || !e || *e) if (errno != 0 || !e || *e)
continue; continue;
fd = (gint) l; fd = (gint) l;
if ((glong) fd != l) if ((glong) fd != l)
continue; continue;
if (fd == dirfd(d)) if (fd == dirfd(d))
continue; continue;
if ((res = cb (data, fd)) != 0) if ((res = cb (data, fd)) != 0)
break; break;
} }
closedir(d); closedir(d);
@ -574,22 +577,23 @@ fdwalk (int (*cb)(void *data, int fd), void *data)
#endif #endif
#ifdef HAVE_SYS_RESOURCE_H #ifdef HAVE_SYS_RESOURCE_H
if (getrlimit(RLIMIT_NOFILE, &rl) == 0 && rl.rlim_max != RLIM_INFINITY) if (getrlimit (RLIMIT_NOFILE, &rl) == 0 && rl.rlim_max != RLIM_INFINITY)
open_max = rl.rlim_max; open_max = rl.rlim_max;
else else
#endif #endif
open_max = sysconf (_SC_OPEN_MAX); open_max = sysconf (_SC_OPEN_MAX);
for (fd = 0; fd < open_max; fd++) for (fd = 0; fd < open_max; fd++)
if ((res = cb (data, fd)) != 0) if ((res = cb (data, fd)) != 0)
break; break;
return res; return res;
} }
#endif #endif
static int static int
check_cloexec(void *data, gint fd) check_cloexec (void *data,
gint fd)
{ {
int r; int r;