diff options
author | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2012-02-10 12:44:19 +0000 |
---|---|---|
committer | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2012-02-13 17:39:16 +0000 |
commit | 05cc2c3348e406027837e60a2c1015b997760c83 (patch) | |
tree | 75433da241fcfe21df45615179a2eb37d4a3b558 /bus/bus.c | |
parent | 267dbff1ea6f738de415d3ad61d8391146908d1f (diff) | |
download | dbus-05cc2c3348e406027837e60a2c1015b997760c83.tar.gz |
Replace a series of booleans, all (apparently) alike, with flags
This makes it a bit clearer what's going on.
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: Lennart Poettering <lennart@poettering.net>
Diffstat (limited to 'bus/bus.c')
-rw-r--r-- | bus/bus.c | 22 |
1 files changed, 13 insertions, 9 deletions
@@ -269,8 +269,7 @@ static dbus_bool_t process_config_first_time_only (BusContext *context, BusConfigParser *parser, const DBusString *address, - dbus_bool_t systemd_activation, - dbus_bool_t write_pidfile, + BusContextFlags flags, DBusError *error) { DBusString log_prefix; @@ -290,7 +289,10 @@ process_config_first_time_only (BusContext *context, _dbus_init_system_log (); - context->systemd_activation = systemd_activation; + if (flags & BUS_CONTEXT_FLAG_SYSTEMD_ACTIVATION) + context->systemd_activation = TRUE; + else + context->systemd_activation = FALSE; /* Check for an existing pid file. Of course this is a race; * we'd have to use fcntl() locks on the pid file to @@ -298,7 +300,7 @@ process_config_first_time_only (BusContext *context, * before overwriting any existing sockets, etc. */ - if (write_pidfile) + if (flags & BUS_CONTEXT_FLAG_WRITE_PID_FILE) pidfile = bus_config_parser_get_pidfile (parser); if (pidfile != NULL) @@ -698,17 +700,18 @@ process_config_postinit (BusContext *context, BusContext* bus_context_new (const DBusString *config_file, - ForceForkSetting force_fork, + BusContextFlags flags, DBusPipe *print_addr_pipe, DBusPipe *print_pid_pipe, const DBusString *address, - dbus_bool_t systemd_activation, - dbus_bool_t write_pidfile, DBusError *error) { BusContext *context; BusConfigParser *parser; + _dbus_assert ((flags & BUS_CONTEXT_FLAG_FORK_NEVER) == 0 || + (flags & BUS_CONTEXT_FLAG_FORK_ALWAYS) == 0); + _DBUS_ASSERT_ERROR_IS_CLEAR (error); context = NULL; @@ -757,7 +760,7 @@ bus_context_new (const DBusString *config_file, goto failed; } - if (!process_config_first_time_only (context, parser, address, systemd_activation, write_pidfile, error)) + if (!process_config_first_time_only (context, parser, address, flags, error)) { _DBUS_ASSERT_ERROR_IS_SET (error); goto failed; @@ -852,7 +855,8 @@ bus_context_new (const DBusString *config_file, if (context->pidfile) _dbus_string_init_const (&u, context->pidfile); - if ((force_fork != FORK_NEVER && context->fork) || force_fork == FORK_ALWAYS) + if (((flags & BUS_CONTEXT_FLAG_FORK_NEVER) == 0 && context->fork) || + (flags & BUS_CONTEXT_FLAG_FORK_ALWAYS)) { _dbus_verbose ("Forking and becoming daemon\n"); |