Skip to content

Commit

Permalink
Cosmetic: Unify formatting of function declarations
Browse files Browse the repository at this point in the history
  • Loading branch information
gollux committed Feb 22, 2018
1 parent 7dbc4e1 commit f713c30
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 12 deletions.
6 changes: 4 additions & 2 deletions cg.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,15 @@ static const struct cg_controller_desc cg_controllers[CG_NUM_CONTROLLERS+1] = {
for (cg_controller (_controller) = 0; \
(_controller) < CG_NUM_CONTROLLERS; (_controller)++)

static const char *cg_controller_name(cg_controller c)
static const char *
cg_controller_name(cg_controller c)
{
assert(c < CG_NUM_CONTROLLERS);
return cg_controllers[c].name;
}

static int cg_controller_optional(cg_controller c)
static int
cg_controller_optional(cg_controller c)
{
assert(c < CG_NUM_CONTROLLERS);
return cg_controllers[c].optional;
Expand Down
15 changes: 10 additions & 5 deletions rules.c
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,8 @@ static const char * const dir_flag_names[] = { "rw", "noexec", "fs", "maybe", "d
static struct dir_rule *first_dir_rule;
static struct dir_rule **last_dir_rule = &first_dir_rule;

static char *sanitize_dir_path(char *path)
static char *
sanitize_dir_path(char *path)
{
// Strip leading slashes
while (*path == '/')
Expand All @@ -203,7 +204,8 @@ static char *sanitize_dir_path(char *path)
return path;
}

static int add_dir_rule(char *in, char *out, unsigned int flags)
static int
add_dir_rule(char *in, char *out, unsigned int flags)
{
// Make sure that "in" does not try to escape the box
in = sanitize_dir_path(in);
Expand Down Expand Up @@ -242,15 +244,17 @@ static int add_dir_rule(char *in, char *out, unsigned int flags)
return 1;
}

static unsigned int parse_dir_option(char *opt)
static unsigned int
parse_dir_option(char *opt)
{
for (unsigned int i = 0; i < ARRAY_SIZE(dir_flag_names); i++)
if (!strcmp(opt, dir_flag_names[i]))
return 1U << i;
die("Unknown directory option %s", opt);
}

int set_dir_action(char *arg)
int
set_dir_action(char *arg)
{
arg = xstrdup(arg);

Expand Down Expand Up @@ -280,7 +284,8 @@ int set_dir_action(char *arg)
}
}

void init_dir_rules(void)
void
init_dir_rules(void)
{
set_dir_action("box=./box:rw");
set_dir_action("bin");
Expand Down
11 changes: 6 additions & 5 deletions util.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ dir_exists(char *path)
return (stat(path, &st) >= 0 && S_ISDIR(st.st_mode));
}

void make_dir(char *path)
void
make_dir(char *path)
{
char *sep = (path[0] == '/' ? path+1 : path);

Expand Down Expand Up @@ -70,8 +71,8 @@ void make_dir(char *path)
}


static int rmtree_helper(const char *fpath, const struct stat *sb,
int typeflag UNUSED, struct FTW *ftwbuf UNUSED)
static int
rmtree_helper(const char *fpath, const struct stat *sb, int typeflag UNUSED, struct FTW *ftwbuf UNUSED)
{
if (S_ISDIR(sb->st_mode))
{
Expand All @@ -95,8 +96,8 @@ rmtree(char *path)
static uid_t chown_uid;
static gid_t chown_gid;

static int chowntree_helper(const char *fpath, const struct stat *sb UNUSED,
int typeflag UNUSED, struct FTW *ftwbuf UNUSED)
static int
chowntree_helper(const char *fpath, const struct stat *sb UNUSED, int typeflag UNUSED, struct FTW *ftwbuf UNUSED)
{
if (lchown(fpath, chown_uid, chown_gid) < 0)
die("Cannot chown %s: %m", fpath);
Expand Down

0 comments on commit f713c30

Please sign in to comment.