clang-format this repo

Use the proper-clang-format file on this repository as required by
the openbmc documentation.

Change-Id: I4f1e0d707388605f1e818dfdc647533a335e5f2d
Signed-off-by: Ed Tanous <ed.tanous@intel.com>
diff --git a/.clang-format b/.clang-format
new file mode 100644
index 0000000..37469de
--- /dev/null
+++ b/.clang-format
@@ -0,0 +1,84 @@
+---
+Language:        Cpp
+# BasedOnStyle:  LLVM
+AccessModifierOffset: -2
+AlignAfterOpenBracket: Align
+AlignConsecutiveAssignments: false
+AlignConsecutiveDeclarations: false
+AlignEscapedNewlinesLeft: false
+AlignOperands:   true
+AlignTrailingComments: true
+AllowAllParametersOfDeclarationOnNextLine: true
+AllowShortBlocksOnASingleLine: false
+AllowShortCaseLabelsOnASingleLine: false
+AllowShortFunctionsOnASingleLine: None
+AllowShortIfStatementsOnASingleLine: false
+AllowShortLoopsOnASingleLine: false
+AlwaysBreakAfterDefinitionReturnType: None
+AlwaysBreakAfterReturnType: None
+AlwaysBreakBeforeMultilineStrings: false
+AlwaysBreakTemplateDeclarations: false
+BinPackArguments: true
+BinPackParameters: true
+BraceWrapping:
+  AfterClass:      true
+  AfterControlStatement: true
+  AfterEnum:       true
+  AfterFunction:   true
+  AfterNamespace:  true
+  AfterObjCDeclaration: true
+  AfterStruct:     true
+  AfterUnion:      true
+  BeforeCatch:     true
+  BeforeElse:      true
+  IndentBraces:    false
+BreakBeforeBinaryOperators: None
+BreakBeforeBraces: Custom
+BreakBeforeTernaryOperators: true
+BreakConstructorInitializers: AfterColon
+ColumnLimit:     80
+CommentPragmas:  '^ IWYU pragma:'
+ConstructorInitializerAllOnOneLineOrOnePerLine: false
+ConstructorInitializerIndentWidth: 4
+ContinuationIndentWidth: 4
+Cpp11BracedListStyle: true
+DerivePointerAlignment: true
+PointerAlignment: Left
+DisableFormat:   false
+ExperimentalAutoDetectBinPacking: false
+FixNamespaceComments: true
+ForEachMacros:   [ foreach, Q_FOREACH, BOOST_FOREACH ]
+IndentCaseLabels: true
+IndentWidth:     4
+IndentWrappedFunctionNames: true
+KeepEmptyLinesAtTheStartOfBlocks: true
+MacroBlockBegin: ''
+MacroBlockEnd:   ''
+MaxEmptyLinesToKeep: 1
+NamespaceIndentation: None
+ObjCBlockIndentWidth: 2
+ObjCSpaceAfterProperty: false
+ObjCSpaceBeforeProtocolList: true
+PenaltyBreakBeforeFirstCallParameter: 19
+PenaltyBreakComment: 300
+PenaltyBreakFirstLessLess: 120
+PenaltyBreakString: 1000
+PenaltyExcessCharacter: 1000000
+PenaltyReturnTypeOnItsOwnLine: 60
+PointerAlignment: Right
+ReflowComments:  true
+SortIncludes:    false
+SpaceAfterCStyleCast: false
+SpaceBeforeAssignmentOperators: true
+SpaceBeforeParens: ControlStatements
+SpaceInEmptyParentheses: false
+SpacesBeforeTrailingComments: 1
+SpacesInAngles:  false
+SpacesInContainerLiterals: true
+SpacesInCStyleCastParentheses: false
+SpacesInParentheses: false
+SpacesInSquareBrackets: false
+Standard:        Cpp11
+TabWidth:        4
+UseTab:          Never
+...
diff --git a/fail-monitor/argument.cpp b/fail-monitor/argument.cpp
index 4f9003c..daf0177 100644
--- a/fail-monitor/argument.cpp
+++ b/fail-monitor/argument.cpp
@@ -73,20 +73,18 @@
     std::cerr << std::flush;
 }
 
-const option ArgumentParser::options[] =
-{
-    { "source",  required_argument, NULL, 's' },
-    { "action", required_argument, NULL, 'a' },
-    { "target", required_argument, NULL, 't' },
-    { "help",   no_argument,       NULL, 'h' },
-    { 0, 0, 0, 0},
+const option ArgumentParser::options[] = {
+    {"source", required_argument, NULL, 's'},
+    {"action", required_argument, NULL, 'a'},
+    {"target", required_argument, NULL, 't'},
+    {"help", no_argument, NULL, 'h'},
+    {0, 0, 0, 0},
 };
 
 const char* ArgumentParser::optionStr = "s:a:t:h?";
 
 const std::string ArgumentParser::trueString = "true";
 const std::string ArgumentParser::emptyString = "";
-
 }
 }
 }
diff --git a/fail-monitor/argument.hpp b/fail-monitor/argument.hpp
index 2d08a2f..00f3755 100644
--- a/fail-monitor/argument.hpp
+++ b/fail-monitor/argument.hpp
@@ -16,53 +16,52 @@
  */
 class ArgumentParser
 {
-    public:
-        ArgumentParser() = delete;
-        ~ArgumentParser() = default;
-        ArgumentParser(const ArgumentParser&) = delete;
-        ArgumentParser& operator=(const ArgumentParser&) = delete;
-        ArgumentParser(ArgumentParser&&) = default;
-        ArgumentParser& operator=(ArgumentParser&&) = default;
+  public:
+    ArgumentParser() = delete;
+    ~ArgumentParser() = default;
+    ArgumentParser(const ArgumentParser&) = delete;
+    ArgumentParser& operator=(const ArgumentParser&) = delete;
+    ArgumentParser(ArgumentParser&&) = default;
+    ArgumentParser& operator=(ArgumentParser&&) = default;
 
-        /** @brief Contructs Argument object
-         *
-         *  @param argc - the main function's argc passed as is
-         *  @param argv - the main function's argv passed as is
-         *  @return Object constructed
-         */
-        ArgumentParser(int argc, char** argv);
+    /** @brief Contructs Argument object
+     *
+     *  @param argc - the main function's argc passed as is
+     *  @param argv - the main function's argv passed as is
+     *  @return Object constructed
+     */
+    ArgumentParser(int argc, char** argv);
 
-        /** @brief Given an option, returns its argument(optarg)
-         *
-         *  @param opt - command line option string
-         *
-         *  @return argument which is a standard optarg
-         */
-        const std::string& operator[](const std::string& opt);
+    /** @brief Given an option, returns its argument(optarg)
+     *
+     *  @param opt - command line option string
+     *
+     *  @return argument which is a standard optarg
+     */
+    const std::string& operator[](const std::string& opt);
 
-        /** @brief Displays usage
-         *
-         *  @param argv - the main function's argv passed as is
-         */
-        static void usage(char** argv);
+    /** @brief Displays usage
+     *
+     *  @param argv - the main function's argv passed as is
+     */
+    static void usage(char** argv);
 
-        /** @brief Set to 'true' when an option is passed */
-        static const std::string trueString;
+    /** @brief Set to 'true' when an option is passed */
+    static const std::string trueString;
 
-        /** @brief Set to '' when an option is not passed */
-        static const std::string emptyString;
+    /** @brief Set to '' when an option is not passed */
+    static const std::string emptyString;
 
-    private:
-        /** @brief Option to argument mapping */
-        std::map<const std::string, std::string> arguments;
+  private:
+    /** @brief Option to argument mapping */
+    std::map<const std::string, std::string> arguments;
 
-        /** @brief Array of struct options as needed by getopt_long */
-        static const option options[];
+    /** @brief Array of struct options as needed by getopt_long */
+    static const option options[];
 
-        /** @brief optstring as needed by getopt_long */
-        static const char* optionStr;
+    /** @brief optstring as needed by getopt_long */
+    static const char* optionStr;
 };
-
 }
 }
 }
diff --git a/fail-monitor/main.cpp b/fail-monitor/main.cpp
index 1c47b98..2c3bc59 100644
--- a/fail-monitor/main.cpp
+++ b/fail-monitor/main.cpp
@@ -40,11 +40,8 @@
     exit(EXIT_FAILURE);
 }
 
-static const std::map<std::string, Monitor::Action> actions =
-{
-    {"start", Monitor::Action::start},
-    {"stop", Monitor::Action::stop}
-};
+static const std::map<std::string, Monitor::Action> actions = {
+    {"start", Monitor::Action::start}, {"stop", Monitor::Action::stop}};
 
 int main(int argc, char** argv)
 {
diff --git a/fail-monitor/monitor.cpp b/fail-monitor/monitor.cpp
index 1936e27..9a0722a 100644
--- a/fail-monitor/monitor.cpp
+++ b/fail-monitor/monitor.cpp
@@ -29,13 +29,12 @@
 constexpr auto START_METHOD = "StartUnit";
 constexpr auto STOP_METHOD = "StopUnit";
 
-constexpr auto SYSTEMD_SERVICE   = "org.freedesktop.systemd1";
-constexpr auto SYSTEMD_OBJ_PATH  = "/org/freedesktop/systemd1";
+constexpr auto SYSTEMD_SERVICE = "org.freedesktop.systemd1";
+constexpr auto SYSTEMD_OBJ_PATH = "/org/freedesktop/systemd1";
 constexpr auto SYSTEMD_INTERFACE = "org.freedesktop.systemd1.Manager";
 constexpr auto SYSTEMD_PROPERTY_INTERFACE = "org.freedesktop.DBus.Properties";
 constexpr auto SYSTEMD_UNIT_INTERFACE = "org.freedesktop.systemd1.Unit";
 
-
 void Monitor::analyze()
 {
     if (inFailedState(std::move(getSourceUnitPath())))
@@ -44,15 +43,12 @@
     }
 }
 
-
 bool Monitor::inFailedState(const std::string&& path)
 {
     sdbusplus::message::variant<std::string> property;
 
-    auto method = bus.new_method_call(SYSTEMD_SERVICE,
-                                      path.c_str(),
-                                      SYSTEMD_PROPERTY_INTERFACE,
-                                      "Get");
+    auto method = bus.new_method_call(SYSTEMD_SERVICE, path.c_str(),
+                                      SYSTEMD_PROPERTY_INTERFACE, "Get");
 
     method.append(SYSTEMD_UNIT_INTERFACE, "ActiveState");
 
@@ -60,7 +56,7 @@
     if (reply.is_method_error())
     {
         log<level::ERR>("Failed reading ActiveState DBus property",
-                entry("UNIT=%s", source.c_str()));
+                        entry("UNIT=%s", source.c_str()));
         // TODO openbmc/openbmc#851 - Once available, throw returned error
         throw std::runtime_error("Failed reading ActiveState DBus property");
     }
@@ -71,22 +67,19 @@
     return (value == FAILED_STATE);
 }
 
-
 std::string Monitor::getSourceUnitPath()
 {
     sdbusplus::message::object_path path;
 
-    auto method = bus.new_method_call(SYSTEMD_SERVICE,
-                                      SYSTEMD_OBJ_PATH,
-                                      SYSTEMD_INTERFACE,
-                                      "GetUnit");
+    auto method = bus.new_method_call(SYSTEMD_SERVICE, SYSTEMD_OBJ_PATH,
+                                      SYSTEMD_INTERFACE, "GetUnit");
     method.append(source);
     auto reply = bus.call(method);
 
     if (reply.is_method_error())
     {
         log<level::ERR>("Failed GetUnit DBus method call",
-                entry("UNIT=%s", source.c_str()));
+                        entry("UNIT=%s", source.c_str()));
         // TODO openbmc/openbmc#851 - Once available, throw returned error
         throw std::runtime_error("Failed GetUnit DBus method call");
     }
@@ -96,12 +89,10 @@
     return static_cast<std::string>(path);
 }
 
-
 void Monitor::runTargetAction()
 {
-    //Start or stop the target unit
-    auto methodCall = (action == Action::start) ?
-                      START_METHOD : STOP_METHOD;
+    // Start or stop the target unit
+    auto methodCall = (action == Action::start) ? START_METHOD : STOP_METHOD;
 
     log<level::INFO>("The source unit is in failed state, "
                      "running target action",
@@ -109,10 +100,8 @@
                      entry("TARGET=%s", target.c_str()),
                      entry("ACTION=%s", methodCall));
 
-    auto method = this->bus.new_method_call(SYSTEMD_SERVICE,
-                                            SYSTEMD_OBJ_PATH,
-                                            SYSTEMD_INTERFACE,
-                                            methodCall);
+    auto method = this->bus.new_method_call(SYSTEMD_SERVICE, SYSTEMD_OBJ_PATH,
+                                            SYSTEMD_INTERFACE, methodCall);
     method.append(target);
     method.append("replace");
 
@@ -121,12 +110,11 @@
     if (reply.is_method_error())
     {
         log<level::ERR>("Failed to run action on the target unit",
-                entry("UNIT=%s", target.c_str()));
+                        entry("UNIT=%s", target.c_str()));
         // TODO openbmc/openbmc#851 - Once available, throw returned error
         throw std::runtime_error("Failed to run action on the target unit");
     }
 }
-
 }
 }
 }
diff --git a/fail-monitor/monitor.hpp b/fail-monitor/monitor.hpp
index 5aa2170..0c2b33a 100644
--- a/fail-monitor/monitor.hpp
+++ b/fail-monitor/monitor.hpp
@@ -23,91 +23,85 @@
  */
 class Monitor
 {
-    public:
+  public:
+    /**
+     * The valid actions - either starting or stopping a unit
+     */
+    enum class Action
+    {
+        start,
+        stop
+    };
 
-        /**
-         * The valid actions - either starting or stopping a unit
-         */
-        enum class Action
-        {
-            start,
-            stop
-        };
+    Monitor() = delete;
+    Monitor(const Monitor&) = delete;
+    Monitor(Monitor&&) = default;
+    Monitor& operator=(const Monitor&) = delete;
+    Monitor& operator=(Monitor&&) = default;
+    ~Monitor() = default;
 
-        Monitor() = delete;
-        Monitor(const Monitor&) = delete;
-        Monitor(Monitor&&) = default;
-        Monitor& operator=(const Monitor&) = delete;
-        Monitor& operator=(Monitor&&) = default;
-        ~Monitor() = default;
+    /**
+     * Constructor
+     *
+     * @param[in] sourceUnit - the source unit
+     * @param[in] targetUnit - the target unit
+     * @param[in] action - the action to run on the target
+     */
+    Monitor(const std::string& sourceUnit, const std::string& targetUnit,
+            Action action) :
+        bus(std::move(sdbusplus::bus::new_default())),
+        source(sourceUnit), target(targetUnit), action(action)
+    {
+    }
 
-        /**
-         * Constructor
-         *
-         * @param[in] sourceUnit - the source unit
-         * @param[in] targetUnit - the target unit
-         * @param[in] action - the action to run on the target
-         */
-        Monitor(const std::string& sourceUnit,
-                const std::string& targetUnit,
-                Action action) :
-            bus(std::move(sdbusplus::bus::new_default())),
-            source(sourceUnit),
-            target(targetUnit),
-            action(action)
-            {
-            }
+    /**
+     * Analyzes the source unit to check if it is in a failed state.
+     * If it is, then it runs the action on the target unit.
+     */
+    void analyze();
 
-        /**
-         * Analyzes the source unit to check if it is in a failed state.
-         * If it is, then it runs the action on the target unit.
-         */
-        void analyze();
+  private:
+    /**
+     * Returns the dbus object path of the source unit
+     */
+    std::string getSourceUnitPath();
 
-    private:
+    /**
+     * Says if the unit object passed in has an
+     * ActiveState property equal to 'failed'.
+     *
+     * @param[in] path - the unit object path to check
+     *
+     * @return - true if this unit is in the failed state
+     */
+    bool inFailedState(const std::string&& path);
 
-        /**
-         * Returns the dbus object path of the source unit
-         */
-        std::string getSourceUnitPath();
+    /**
+     * Runs the action on the target unit.
+     */
+    void runTargetAction();
 
-        /**
-         * Says if the unit object passed in has an
-         * ActiveState property equal to 'failed'.
-         *
-         * @param[in] path - the unit object path to check
-         *
-         * @return - true if this unit is in the failed state
-         */
-        bool inFailedState(const std::string&& path);
+    /**
+     * The dbus object
+     */
+    sdbusplus::bus::bus bus;
 
-        /**
-         * Runs the action on the target unit.
-         */
-        void runTargetAction();
+    /**
+     * The source unit
+     */
+    const std::string source;
 
-        /**
-         * The dbus object
-         */
-        sdbusplus::bus::bus bus;
+    /**
+     * The target unit
+     */
+    const std::string target;
 
-        /**
-         * The source unit
-         */
-        const std::string source;
-
-        /**
-         * The target unit
-         */
-        const std::string target;
-
-        /**
-         * The action to run on the target if the source
-         * unit is in failed state.
-         */
-        const Action action;
+    /**
+     * The action to run on the target if the source
+     * unit is in failed state.
+     */
+    const Action action;
 };
-
 }
 }
 }
diff --git a/libmapper/app.c b/libmapper/app.c
index 3bdd0c6..d926173 100644
--- a/libmapper/app.c
+++ b/libmapper/app.c
@@ -22,248 +22,264 @@
 
 static int call_main(int argc, char *argv[])
 {
-	int r;
-	sd_bus *conn = NULL;
-	char *service = NULL;
-	sd_bus_message *m = NULL, *reply = NULL;
-	sd_bus_error error = SD_BUS_ERROR_NULL;
+    int r;
+    sd_bus *conn = NULL;
+    char *service = NULL;
+    sd_bus_message *m = NULL, *reply = NULL;
+    sd_bus_error error = SD_BUS_ERROR_NULL;
 
-	if(argc < 5) {
-		fprintf(stderr, "Usage: %s call OBJECTPATH INTERFACE "
-				"METHOD [SIGNATURE [ARGUMENT...]\n", argv[0]);
-		r = -1;
-		goto finish;
-	}
+    if (argc < 5)
+    {
+        fprintf(stderr,
+                "Usage: %s call OBJECTPATH INTERFACE "
+                "METHOD [SIGNATURE [ARGUMENT...]\n",
+                argv[0]);
+        r = -1;
+        goto finish;
+    }
 
-	r = sd_bus_default_system(&conn);
-	if(r < 0) {
-		fprintf(stderr, "Error connecting to system bus: %s\n",
-				strerror(-r));
-		goto finish;
-	}
+    r = sd_bus_default_system(&conn);
+    if (r < 0)
+    {
+        fprintf(stderr, "Error connecting to system bus: %s\n", strerror(-r));
+        goto finish;
+    }
 
-	r = mapper_get_service(conn, argv[2], &service);
-	if(r < 0) {
-		fprintf(stderr, "Error finding '%s' service: %s\n",
-				argv[2], strerror(-r));
-		goto finish;
-	}
+    r = mapper_get_service(conn, argv[2], &service);
+    if (r < 0)
+    {
+        fprintf(stderr, "Error finding '%s' service: %s\n", argv[2],
+                strerror(-r));
+        goto finish;
+    }
 
-	r = sd_bus_message_new_method_call(
-			conn, &m, service, argv[2], argv[3], argv[4]);
-	if(r < 0) {
-		fprintf(stderr, "Error populating message: %s\n",
-				strerror(-r));
-		goto finish;
-	}
+    r = sd_bus_message_new_method_call(conn, &m, service, argv[2], argv[3],
+                                       argv[4]);
+    if (r < 0)
+    {
+        fprintf(stderr, "Error populating message: %s\n", strerror(-r));
+        goto finish;
+    }
 
-	if(argc > 5) {
-		char **p;
-		p = argv + 6;
-		r = sd_bus_message_append_cmdline(m, argv[5], &p);
-		if(r < 0) {
-			fprintf(stderr, "Error appending method arguments: %s\n",
-					strerror(-r));
-			goto finish;
-		}
-	}
+    if (argc > 5)
+    {
+        char **p;
+        p = argv + 6;
+        r = sd_bus_message_append_cmdline(m, argv[5], &p);
+        if (r < 0)
+        {
+            fprintf(stderr, "Error appending method arguments: %s\n",
+                    strerror(-r));
+            goto finish;
+        }
+    }
 
-	r = sd_bus_call(conn, m, 0, &error, &reply);
-	if(r < 0) {
-		fprintf(stderr, "Error invoking method: %s\n",
-				strerror(-r));
-		goto finish;
-	}
+    r = sd_bus_call(conn, m, 0, &error, &reply);
+    if (r < 0)
+    {
+        fprintf(stderr, "Error invoking method: %s\n", strerror(-r));
+        goto finish;
+    }
 
 finish:
-	exit(r < 0 ? EXIT_FAILURE : EXIT_SUCCESS);
+    exit(r < 0 ? EXIT_FAILURE : EXIT_SUCCESS);
 }
 
 static void quit(int r, void *loop)
 {
-	sd_event_exit((sd_event *)loop, r);
+    sd_event_exit((sd_event *)loop, r);
 }
 
 static int wait_main(int argc, char *argv[])
 {
-	int r;
-	sd_bus *conn = NULL;
-	sd_event *loop = NULL;
-	mapper_async_wait *wait = NULL;
+    int r;
+    sd_bus *conn = NULL;
+    sd_event *loop = NULL;
+    mapper_async_wait *wait = NULL;
 
-	if(argc < 3) {
-		fprintf(stderr, "Usage: %s wait OBJECTPATH...\n", argv[0]);
-		exit(EXIT_FAILURE);
-	}
+    if (argc < 3)
+    {
+        fprintf(stderr, "Usage: %s wait OBJECTPATH...\n", argv[0]);
+        exit(EXIT_FAILURE);
+    }
 
-	r = sd_bus_default_system(&conn);
-	if(r < 0) {
-		fprintf(stderr, "Error connecting to system bus: %s\n",
-				strerror(-r));
-		goto finish;
-	}
+    r = sd_bus_default_system(&conn);
+    if (r < 0)
+    {
+        fprintf(stderr, "Error connecting to system bus: %s\n", strerror(-r));
+        goto finish;
+    }
 
-	r = sd_event_default(&loop);
-	if (r < 0) {
-		fprintf(stderr, "Error obtaining event loop: %s\n",
-				strerror(-r));
+    r = sd_event_default(&loop);
+    if (r < 0)
+    {
+        fprintf(stderr, "Error obtaining event loop: %s\n", strerror(-r));
 
-		goto finish;
-	}
+        goto finish;
+    }
 
-	r = sd_bus_attach_event(conn, loop, SD_EVENT_PRIORITY_NORMAL);
-	if (r < 0) {
-		fprintf(stderr, "Failed to attach system "
-				"bus to event loop: %s\n",
-				strerror(-r));
-		goto finish;
-	}
+    r = sd_bus_attach_event(conn, loop, SD_EVENT_PRIORITY_NORMAL);
+    if (r < 0)
+    {
+        fprintf(stderr,
+                "Failed to attach system "
+                "bus to event loop: %s\n",
+                strerror(-r));
+        goto finish;
+    }
 
-	r = mapper_wait_async(conn, loop, argv+2, quit, loop, &wait);
-	if(r < 0) {
-		fprintf(stderr, "Error configuring waitlist: %s\n",
-				strerror(-r));
-		goto finish;
-	}
+    r = mapper_wait_async(conn, loop, argv + 2, quit, loop, &wait);
+    if (r < 0)
+    {
+        fprintf(stderr, "Error configuring waitlist: %s\n", strerror(-r));
+        goto finish;
+    }
 
-	r = sd_event_loop(loop);
-	if(r < 0) {
-		fprintf(stderr, "Error starting event loop: %s\n",
-				strerror(-r));
-		goto finish;
-	}
+    r = sd_event_loop(loop);
+    if (r < 0)
+    {
+        fprintf(stderr, "Error starting event loop: %s\n", strerror(-r));
+        goto finish;
+    }
 
 finish:
-	exit(r < 0 ? EXIT_FAILURE : EXIT_SUCCESS);
+    exit(r < 0 ? EXIT_FAILURE : EXIT_SUCCESS);
 }
 
 static int subtree_main(int argc, char *argv[])
 {
-	int r = 0;
-	int op = 0;
-	static const char* token = ":";
-	char* tmp = NULL;
-	char* namespace = NULL;
-	char* interface = NULL;
-	sd_bus *conn = NULL;
-	sd_event *loop = NULL;
-	mapper_async_subtree *subtree = NULL;
+    int r = 0;
+    int op = 0;
+    static const char *token = ":";
+    char *tmp = NULL;
+    char *namespace = NULL;
+    char *interface = NULL;
+    sd_bus *conn = NULL;
+    sd_event *loop = NULL;
+    mapper_async_subtree *subtree = NULL;
 
-	if (argc != 3) {
-		fprintf(stderr, "Usage: %s subtree-remove "
-				"NAMESPACE%sINTERFACE\n", argv[0], token);
-		exit(EXIT_FAILURE);
-	}
+    if (argc != 3)
+    {
+        fprintf(stderr,
+                "Usage: %s subtree-remove "
+                "NAMESPACE%sINTERFACE\n",
+                argv[0], token);
+        exit(EXIT_FAILURE);
+    }
 
-	op = MAPPER_OP_REMOVE;
+    op = MAPPER_OP_REMOVE;
 
-	namespace = strtok_r(argv[2], token, &tmp);
-	interface = strtok_r(NULL, token, &tmp);
-	if ((namespace == NULL) || (interface == NULL)) {
-		fprintf(stderr, "Token '%s' was not found in '%s'\n", token, argv[2]);
-		exit(EXIT_FAILURE);
-	}
+    namespace = strtok_r(argv[2], token, &tmp);
+    interface = strtok_r(NULL, token, &tmp);
+    if ((namespace == NULL) || (interface == NULL))
+    {
+        fprintf(stderr, "Token '%s' was not found in '%s'\n", token, argv[2]);
+        exit(EXIT_FAILURE);
+    }
 
-	r = sd_bus_default_system(&conn);
-	if(r < 0) {
-		fprintf(stderr, "Error connecting to system bus: %s\n",
-				strerror(-r));
-		goto finish;
-	}
+    r = sd_bus_default_system(&conn);
+    if (r < 0)
+    {
+        fprintf(stderr, "Error connecting to system bus: %s\n", strerror(-r));
+        goto finish;
+    }
 
-	r = sd_event_default(&loop);
-	if (r < 0) {
-		fprintf(stderr, "Error obtaining event loop: %s\n",
-				strerror(-r));
-		goto finish;
-	}
+    r = sd_event_default(&loop);
+    if (r < 0)
+    {
+        fprintf(stderr, "Error obtaining event loop: %s\n", strerror(-r));
+        goto finish;
+    }
 
-	r = sd_bus_attach_event(conn, loop, SD_EVENT_PRIORITY_NORMAL);
-	if (r < 0) {
-		fprintf(stderr, "Failed to attach system bus to event loop: %s\n",
-				strerror(-r));
-		goto finish;
-	}
+    r = sd_bus_attach_event(conn, loop, SD_EVENT_PRIORITY_NORMAL);
+    if (r < 0)
+    {
+        fprintf(stderr, "Failed to attach system bus to event loop: %s\n",
+                strerror(-r));
+        goto finish;
+    }
 
-	r = mapper_subtree_async(conn, loop, namespace, interface, quit, loop,
-				&subtree, op);
-	if(r < 0) {
-		fprintf(stderr, "Error configuring subtree list: %s\n",
-				strerror(-r));
-		goto finish;
-	}
+    r = mapper_subtree_async(conn, loop, namespace, interface, quit, loop,
+                             &subtree, op);
+    if (r < 0)
+    {
+        fprintf(stderr, "Error configuring subtree list: %s\n", strerror(-r));
+        goto finish;
+    }
 
-	r = sd_event_loop(loop);
-	if(r < 0) {
-		fprintf(stderr, "Error starting event loop: %s\n",
-				strerror(-r));
-		goto finish;
-	}
+    r = sd_event_loop(loop);
+    if (r < 0)
+    {
+        fprintf(stderr, "Error starting event loop: %s\n", strerror(-r));
+        goto finish;
+    }
 
 finish:
-	exit(r < 0 ? EXIT_FAILURE : EXIT_SUCCESS);
+    exit(r < 0 ? EXIT_FAILURE : EXIT_SUCCESS);
 }
 
 /* print out the distinct dbus service name for the input dbus path */
 static int get_service_main(int argc, char *argv[])
 {
-	int r;
-	sd_bus *conn = NULL;
-	char *service = NULL;
+    int r;
+    sd_bus *conn = NULL;
+    char *service = NULL;
 
-	if(argc != 3) {
-		fprintf(stderr, "Usage: %s get-service OBJECTPATH\n",
-				argv[0]);
-		exit(EXIT_FAILURE);
-	}
+    if (argc != 3)
+    {
+        fprintf(stderr, "Usage: %s get-service OBJECTPATH\n", argv[0]);
+        exit(EXIT_FAILURE);
+    }
 
-	r = sd_bus_default_system(&conn);
-	if(r < 0) {
-		fprintf(stderr, "Error connecting to system bus: %s\n",
-				strerror(-r));
-		goto finish;
-	}
+    r = sd_bus_default_system(&conn);
+    if (r < 0)
+    {
+        fprintf(stderr, "Error connecting to system bus: %s\n", strerror(-r));
+        goto finish;
+    }
 
-	r = mapper_get_service(conn, argv[2], &service);
-	if(r < 0) {
-		fprintf(stderr, "Error finding '%s' service: %s\n",
-				argv[2], strerror(-r));
-		goto finish;
-	}
+    r = mapper_get_service(conn, argv[2], &service);
+    if (r < 0)
+    {
+        fprintf(stderr, "Error finding '%s' service: %s\n", argv[2],
+                strerror(-r));
+        goto finish;
+    }
 
-	printf("%s\n", service);
-
+    printf("%s\n", service);
 
 finish:
-	exit(r < 0 ? EXIT_FAILURE : EXIT_SUCCESS);
+    exit(r < 0 ? EXIT_FAILURE : EXIT_SUCCESS);
 }
 
 int main(int argc, char *argv[])
 {
-	static const char *usage =
-		"Usage: %s {COMMAND} ...\n"
-		"\nCOMMANDS:\n"
-		"  call           invoke the specified method\n"
-		"  wait           wait for the specified objects to appear on the DBus\n"
-		"  subtree-remove\n"
-		"                 wait until the specified interface is not present\n"
-		"                 in any of the subtrees of the specified namespace\n"
-		"  get-service    return the service identifier for input path\n";
+    static const char *usage =
+        "Usage: %s {COMMAND} ...\n"
+        "\nCOMMANDS:\n"
+        "  call           invoke the specified method\n"
+        "  wait           wait for the specified objects to appear on the "
+        "DBus\n"
+        "  subtree-remove\n"
+        "                 wait until the specified interface is not present\n"
+        "                 in any of the subtrees of the specified namespace\n"
+        "  get-service    return the service identifier for input path\n";
 
-	if(argc < 2) {
-		fprintf(stderr, usage, argv[0]);
-		exit(EXIT_FAILURE);
-	}
+    if (argc < 2)
+    {
+        fprintf(stderr, usage, argv[0]);
+        exit(EXIT_FAILURE);
+    }
 
-	if(!strcmp(argv[1], "call"))
-		call_main(argc, argv);
-	if(!strcmp(argv[1], "wait"))
-		wait_main(argc, argv);
-	if(!strcmp(argv[1], "subtree-remove"))
-		subtree_main(argc, argv);
-	if(!strcmp(argv[1], "get-service"))
-		get_service_main(argc, argv);
+    if (!strcmp(argv[1], "call"))
+        call_main(argc, argv);
+    if (!strcmp(argv[1], "wait"))
+        wait_main(argc, argv);
+    if (!strcmp(argv[1], "subtree-remove"))
+        subtree_main(argc, argv);
+    if (!strcmp(argv[1], "get-service"))
+        get_service_main(argc, argv);
 
-	fprintf(stderr, usage, argv[0]);
-	exit(EXIT_FAILURE);
+    fprintf(stderr, usage, argv[0]);
+    exit(EXIT_FAILURE);
 }
diff --git a/libmapper/mapper.c b/libmapper/mapper.c
index 34c053c..8bb42e9 100644
--- a/libmapper/mapper.c
+++ b/libmapper/mapper.c
@@ -25,660 +25,616 @@
 #include "mapper.h"
 
 static const char *async_wait_introspection_match =
-	"type='signal',"
-	"sender='xyz.openbmc_project.ObjectMapper',"
-	"interface='xyz.openbmc_project.ObjectMapper.Private',"
-	"member='IntrospectionComplete'";
+    "type='signal',"
+    "sender='xyz.openbmc_project.ObjectMapper',"
+    "interface='xyz.openbmc_project.ObjectMapper.Private',"
+    "member='IntrospectionComplete'";
 
 static const char *async_wait_interfaces_added_match =
-	"type='signal',"
-	"interface='org.freedesktop.DBus.ObjectManager',"
-	"member='InterfacesAdded'";
+    "type='signal',"
+    "interface='org.freedesktop.DBus.ObjectManager',"
+    "member='InterfacesAdded'";
 
 static const char *interfaces_removed_match =
-	"type='signal',"
-	"interface='org.freedesktop.DBus.ObjectManager',"
-	"member='InterfacesRemoved'";
+    "type='signal',"
+    "interface='org.freedesktop.DBus.ObjectManager',"
+    "member='InterfacesRemoved'";
 
 static const int mapper_busy_retries = 5;
 static const uint64_t mapper_busy_delay_interval_usec = 1000000;
 
 struct mapper_async_wait
 {
-	char **objs;
-	void (*callback)(int, void *);
-	void *userdata;
-	sd_event *loop;
-	sd_bus *conn;
-	sd_bus_slot *introspection_slot;
-	sd_bus_slot *intf_slot;
-	int *status;
-	int count;
-	int finished;
-	int r;
+    char **objs;
+    void (*callback)(int, void *);
+    void *userdata;
+    sd_event *loop;
+    sd_bus *conn;
+    sd_bus_slot *introspection_slot;
+    sd_bus_slot *intf_slot;
+    int *status;
+    int count;
+    int finished;
+    int r;
 };
 
 struct async_wait_callback_data
 {
-	mapper_async_wait *wait;
-	const char *path;
-	sd_event_source *event_source;
-	int retry;
+    mapper_async_wait *wait;
+    const char *path;
+    sd_event_source *event_source;
+    int retry;
 };
 
 struct mapper_async_subtree
 {
-	char *namespace;
-	char *interface;
-	void (*callback)(int, void *);
-	void *userdata;
-	sd_event *loop;
-	sd_bus *conn;
-	sd_bus_slot *slot;
-	sd_event_source *event_source;
-	int finished;
-	int op;
-	int retry;
+    char *namespace;
+    char *interface;
+    void (*callback)(int, void *);
+    void *userdata;
+    sd_event *loop;
+    sd_bus *conn;
+    sd_bus_slot *slot;
+    sd_event_source *event_source;
+    int finished;
+    int op;
+    int retry;
 };
 
 static int async_wait_match_introspection_complete(sd_bus_message *, void *,
-		sd_bus_error *);
+                                                   sd_bus_error *);
 static int async_wait_check_done(mapper_async_wait *);
 static void async_wait_done(int r, mapper_async_wait *);
 static int async_wait_get_objects(mapper_async_wait *);
-static int async_wait_getobject_callback(sd_bus_message *,
-		void *, sd_bus_error *);
+static int async_wait_getobject_callback(sd_bus_message *, void *,
+                                         sd_bus_error *);
 
 static int async_subtree_match_callback(sd_bus_message *, void *,
-		sd_bus_error *);
+                                        sd_bus_error *);
 static void async_subtree_done(int r, mapper_async_subtree *);
 static int async_subtree_getpaths(mapper_async_subtree *);
-static int async_subtree_getpaths_callback(sd_bus_message *,
-		void *, sd_bus_error *);
+static int async_subtree_getpaths_callback(sd_bus_message *, void *,
+                                           sd_bus_error *);
 
 static int sarraylen(char *array[])
 {
-	int count = 0;
-	char **p = array;
+    int count = 0;
+    char **p = array;
 
-	while(*p != NULL) {
-		++count;
-		++p;
-	}
+    while (*p != NULL)
+    {
+        ++count;
+        ++p;
+    }
 
-	return count;
+    return count;
 }
 
 static void sarrayfree(char *array[])
 {
-	char **p = array;
-	while(*p != NULL) {
-		free(*p);
-		++p;
-	}
-	free(array);
+    char **p = array;
+    while (*p != NULL)
+    {
+        free(*p);
+        ++p;
+    }
+    free(array);
 }
 
 static char **sarraydup(char *array[])
 {
-	int count = sarraylen(array);
-	int i;
-	char **ret = NULL;
+    int count = sarraylen(array);
+    int i;
+    char **ret = NULL;
 
-	ret = malloc(sizeof(*ret) * count);
-	if(!ret)
-		return NULL;
+    ret = malloc(sizeof(*ret) * count);
+    if (!ret)
+        return NULL;
 
-	for(i=0; i<count; ++i) {
-		ret[i] = strdup(array[i]);
-		if(!ret[i])
-			goto error;
-	}
+    for (i = 0; i < count; ++i)
+    {
+        ret[i] = strdup(array[i]);
+        if (!ret[i])
+            goto error;
+    }
 
-	return ret;
+    return ret;
 
 error:
-	sarrayfree(ret);
-	return NULL;
+    sarrayfree(ret);
+    return NULL;
 }
 
-static int async_wait_timeout_callback(sd_event_source *s,
-		uint64_t usec, void *userdata)
+static int async_wait_timeout_callback(sd_event_source *s, uint64_t usec,
+                                       void *userdata)
 {
-	int r;
-	struct async_wait_callback_data *data = userdata;
-	mapper_async_wait *wait = data->wait;
+    int r;
+    struct async_wait_callback_data *data = userdata;
+    mapper_async_wait *wait = data->wait;
 
-	sd_event_source_unref(data->event_source);
-	r = sd_bus_call_method_async(
-			wait->conn,
-			NULL,
-			MAPPER_BUSNAME,
-			MAPPER_PATH,
-			MAPPER_INTERFACE,
-			"GetObject",
-			async_wait_getobject_callback,
-			data,
-			"sas",
-			data->path,
-			0,
-			NULL);
-	if(r < 0) {
-		async_wait_done(r, wait);
-		free(data);
-	}
+    sd_event_source_unref(data->event_source);
+    r = sd_bus_call_method_async(wait->conn, NULL, MAPPER_BUSNAME, MAPPER_PATH,
+                                 MAPPER_INTERFACE, "GetObject",
+                                 async_wait_getobject_callback, data, "sas",
+                                 data->path, 0, NULL);
+    if (r < 0)
+    {
+        async_wait_done(r, wait);
+        free(data);
+    }
 
-	return 0;
+    return 0;
 }
 
-static int async_wait_getobject_callback(sd_bus_message *m,
-		void *userdata,
-		sd_bus_error *e)
+static int async_wait_getobject_callback(sd_bus_message *m, void *userdata,
+                                         sd_bus_error *e)
 {
-	int i, r;
-	struct async_wait_callback_data *data = userdata;
-	mapper_async_wait *wait = data->wait;
-	uint64_t now;
+    int i, r;
+    struct async_wait_callback_data *data = userdata;
+    mapper_async_wait *wait = data->wait;
+    uint64_t now;
 
-	if(wait->finished)
-		goto exit;
+    if (wait->finished)
+        goto exit;
 
-	r = sd_bus_message_get_errno(m);
-	if(r == ENOENT)
-		goto exit;
+    r = sd_bus_message_get_errno(m);
+    if (r == ENOENT)
+        goto exit;
 
-	if(r == EBUSY && data->retry < mapper_busy_retries) {
-		r = sd_event_now(wait->loop,
-				CLOCK_MONOTONIC,
-				&now);
-		if(r < 0) {
-			async_wait_done(r, wait);
-			goto exit;
-		}
+    if (r == EBUSY && data->retry < mapper_busy_retries)
+    {
+        r = sd_event_now(wait->loop, CLOCK_MONOTONIC, &now);
+        if (r < 0)
+        {
+            async_wait_done(r, wait);
+            goto exit;
+        }
 
-		++data->retry;
-		r = sd_event_add_time(wait->loop,
-				&data->event_source,
-				CLOCK_MONOTONIC,
-				now + mapper_busy_delay_interval_usec,
-				0,
-				async_wait_timeout_callback,
-				data);
-		if(r < 0) {
-			async_wait_done(r, wait);
-			goto exit;
-		}
+        ++data->retry;
+        r = sd_event_add_time(wait->loop, &data->event_source, CLOCK_MONOTONIC,
+                              now + mapper_busy_delay_interval_usec, 0,
+                              async_wait_timeout_callback, data);
+        if (r < 0)
+        {
+            async_wait_done(r, wait);
+            goto exit;
+        }
 
-		return 0;
-	}
+        return 0;
+    }
 
-	if(r) {
-		async_wait_done(-r, wait);
-		goto exit;
-	}
+    if (r)
+    {
+        async_wait_done(-r, wait);
+        goto exit;
+    }
 
-	for(i=0; i<wait->count; ++i) {
-		if(!strcmp(data->path, wait->objs[i])) {
-			wait->status[i] = 1;
-		}
-	}
+    for (i = 0; i < wait->count; ++i)
+    {
+        if (!strcmp(data->path, wait->objs[i]))
+        {
+            wait->status[i] = 1;
+        }
+    }
 
-	if(async_wait_check_done(wait))
-		async_wait_done(0, wait);
+    if (async_wait_check_done(wait))
+        async_wait_done(0, wait);
 
 exit:
-	free(data);
-	return 0;
+    free(data);
+    return 0;
 }
 
 static int async_wait_get_objects(mapper_async_wait *wait)
 {
-	int i, r;
-	struct async_wait_callback_data *data = NULL;
+    int i, r;
+    struct async_wait_callback_data *data = NULL;
 
-	for(i=0; i<wait->count; ++i) {
-		if(wait->status[i])
-			continue;
-		data = malloc(sizeof(*data));
-		data->wait = wait;
-		data->path = wait->objs[i];
-		data->retry = 0;
-		data->event_source = NULL;
-		r = sd_bus_call_method_async(
-				wait->conn,
-				NULL,
-				MAPPER_BUSNAME,
-				MAPPER_PATH,
-				MAPPER_INTERFACE,
-				"GetObject",
-				async_wait_getobject_callback,
-				data,
-				"sas",
-				wait->objs[i],
-				0,
-				NULL);
-		if(r < 0) {
-			free(data);
-			fprintf(stderr, "Error invoking method: %s\n",
-					strerror(-r));
-			return r;
-		}
-	}
+    for (i = 0; i < wait->count; ++i)
+    {
+        if (wait->status[i])
+            continue;
+        data = malloc(sizeof(*data));
+        data->wait = wait;
+        data->path = wait->objs[i];
+        data->retry = 0;
+        data->event_source = NULL;
+        r = sd_bus_call_method_async(wait->conn, NULL, MAPPER_BUSNAME,
+                                     MAPPER_PATH, MAPPER_INTERFACE, "GetObject",
+                                     async_wait_getobject_callback, data, "sas",
+                                     wait->objs[i], 0, NULL);
+        if (r < 0)
+        {
+            free(data);
+            fprintf(stderr, "Error invoking method: %s\n", strerror(-r));
+            return r;
+        }
+    }
 
-	return 0;
+    return 0;
 }
 
 static int async_wait_match_introspection_complete(sd_bus_message *m, void *w,
-		sd_bus_error *e)
+                                                   sd_bus_error *e)
 {
-	int r;
+    int r;
 
-	mapper_async_wait *wait = w;
-	if(wait->finished)
-		return 0;
+    mapper_async_wait *wait = w;
+    if (wait->finished)
+        return 0;
 
-	r = async_wait_get_objects(wait);
-	if(r < 0)
-		async_wait_done(r, wait);
+    r = async_wait_get_objects(wait);
+    if (r < 0)
+        async_wait_done(r, wait);
 
-	return 0;
+    return 0;
 }
 
 static void async_wait_done(int r, mapper_async_wait *w)
 {
-	if(w->finished)
-		return;
+    if (w->finished)
+        return;
 
-	w->finished = 1;
-	sd_bus_slot_unref(w->introspection_slot);
-	sd_bus_slot_unref(w->intf_slot);
+    w->finished = 1;
+    sd_bus_slot_unref(w->introspection_slot);
+    sd_bus_slot_unref(w->intf_slot);
 
-	if(w->callback)
-		w->callback(r, w->userdata);
+    if (w->callback)
+        w->callback(r, w->userdata);
 }
 
 static int async_wait_check_done(mapper_async_wait *w)
 {
-	int i;
+    int i;
 
-	if(w->finished)
-		return 1;
+    if (w->finished)
+        return 1;
 
-	for(i=0; i<w->count; ++i)
-		if(!w->status[i])
-			return 0;
+    for (i = 0; i < w->count; ++i)
+        if (!w->status[i])
+            return 0;
 
-	return 1;
+    return 1;
 }
 
 void mapper_wait_async_free(mapper_async_wait *w)
 {
-	free(w->status);
-	sarrayfree(w->objs);
-	free(w);
+    free(w->status);
+    sarrayfree(w->objs);
+    free(w);
 }
 
-int mapper_wait_async(sd_bus *conn,
-		sd_event *loop,
-		char *objs[],
-		void (*callback)(int, void *),
-		void *userdata,
-		mapper_async_wait **w)
+int mapper_wait_async(sd_bus *conn, sd_event *loop, char *objs[],
+                      void (*callback)(int, void *), void *userdata,
+                      mapper_async_wait **w)
 {
-	int r;
-	mapper_async_wait *wait = NULL;
+    int r;
+    mapper_async_wait *wait = NULL;
 
-	wait = malloc(sizeof(*wait));
-	if(!wait)
-		return -ENOMEM;
+    wait = malloc(sizeof(*wait));
+    if (!wait)
+        return -ENOMEM;
 
-	memset(wait, 0, sizeof(*wait));
-	wait->conn = conn;
-	wait->loop = loop;
-	wait->callback = callback;
-	wait->userdata = userdata;
-	wait->count = sarraylen(objs);
-	if(!wait->count)
-		return 0;
+    memset(wait, 0, sizeof(*wait));
+    wait->conn = conn;
+    wait->loop = loop;
+    wait->callback = callback;
+    wait->userdata = userdata;
+    wait->count = sarraylen(objs);
+    if (!wait->count)
+        return 0;
 
-	wait->objs = sarraydup(objs);
-	if(!wait->objs) {
-		r = -ENOMEM;
-		goto free_wait;
-	}
+    wait->objs = sarraydup(objs);
+    if (!wait->objs)
+    {
+        r = -ENOMEM;
+        goto free_wait;
+    }
 
-	wait->status = malloc(sizeof(*wait->status) * wait->count);
-	if(!wait->status) {
-		r = -ENOMEM;
-		goto free_objs;
-	}
-	memset(wait->status, 0, sizeof(*wait->status) * wait->count);
+    wait->status = malloc(sizeof(*wait->status) * wait->count);
+    if (!wait->status)
+    {
+        r = -ENOMEM;
+        goto free_objs;
+    }
+    memset(wait->status, 0, sizeof(*wait->status) * wait->count);
 
-	r = sd_bus_add_match(conn,
-			&wait->introspection_slot,
-			async_wait_introspection_match,
-			async_wait_match_introspection_complete,
-			wait);
-	if(r < 0) {
-		fprintf(stderr, "Error adding match rule: %s\n",
-				strerror(-r));
-		goto free_status;
-	}
+    r = sd_bus_add_match(conn, &wait->introspection_slot,
+                         async_wait_introspection_match,
+                         async_wait_match_introspection_complete, wait);
+    if (r < 0)
+    {
+        fprintf(stderr, "Error adding match rule: %s\n", strerror(-r));
+        goto free_status;
+    }
 
-	r = sd_bus_add_match(conn,
-                        &wait->intf_slot,
-			async_wait_interfaces_added_match,
-                        async_wait_match_introspection_complete,
-                        wait);
-	if(r < 0) {
-		fprintf(stderr, "Error adding match rule: %s\n",
-				strerror(-r));
-		goto unref_name_slot;
-	}
+    r = sd_bus_add_match(conn, &wait->intf_slot,
+                         async_wait_interfaces_added_match,
+                         async_wait_match_introspection_complete, wait);
+    if (r < 0)
+    {
+        fprintf(stderr, "Error adding match rule: %s\n", strerror(-r));
+        goto unref_name_slot;
+    }
 
-	r = async_wait_get_objects(wait);
-	if(r < 0) {
-		fprintf(stderr, "Error calling method: %s\n",
-				strerror(-r));
-		goto unref_intf_slot;
-	}
+    r = async_wait_get_objects(wait);
+    if (r < 0)
+    {
+        fprintf(stderr, "Error calling method: %s\n", strerror(-r));
+        goto unref_intf_slot;
+    }
 
-	*w = wait;
+    *w = wait;
 
-	return 0;
+    return 0;
 
 unref_intf_slot:
-	sd_bus_slot_unref(wait->intf_slot);
+    sd_bus_slot_unref(wait->intf_slot);
 unref_name_slot:
-	sd_bus_slot_unref(wait->introspection_slot);
+    sd_bus_slot_unref(wait->introspection_slot);
 free_status:
-	free(wait->status);
+    free(wait->status);
 free_objs:
-	sarrayfree(wait->objs);
+    sarrayfree(wait->objs);
 free_wait:
-	free(wait);
+    free(wait);
 
-	return r;
+    return r;
 }
 
-static int async_subtree_timeout_callback(sd_event_source *s,
-		uint64_t usec, void *userdata)
+static int async_subtree_timeout_callback(sd_event_source *s, uint64_t usec,
+                                          void *userdata)
 {
-	int r;
-	struct mapper_async_subtree *subtree = userdata;
+    int r;
+    struct mapper_async_subtree *subtree = userdata;
 
-	sd_event_source_unref(subtree->event_source);
-	r = sd_bus_call_method_async(
-			subtree->conn,
-			NULL,
-			MAPPER_BUSNAME,
-			MAPPER_PATH,
-			MAPPER_INTERFACE,
-			"GetSubTreePaths",
-			async_subtree_getpaths_callback,
-			subtree,
-			"sias",
-			subtree->namespace,
-			0, 1,
-			subtree->interface);
-	if(r < 0)
-		async_subtree_done(r, subtree);
+    sd_event_source_unref(subtree->event_source);
+    r = sd_bus_call_method_async(
+        subtree->conn, NULL, MAPPER_BUSNAME, MAPPER_PATH, MAPPER_INTERFACE,
+        "GetSubTreePaths", async_subtree_getpaths_callback, subtree, "sias",
+        subtree->namespace, 0, 1, subtree->interface);
+    if (r < 0)
+        async_subtree_done(r, subtree);
 
-	return 0;
+    return 0;
 }
 
-static int async_subtree_getpaths_callback(sd_bus_message *m,
-		void *userdata,
-		sd_bus_error *e)
+static int async_subtree_getpaths_callback(sd_bus_message *m, void *userdata,
+                                           sd_bus_error *e)
 {
-	int r;
-	char *intf = NULL;
-	struct mapper_async_subtree *subtree = userdata;
-	uint64_t now;
+    int r;
+    char *intf = NULL;
+    struct mapper_async_subtree *subtree = userdata;
+    uint64_t now;
 
-	if(subtree->finished)
-		goto exit;
+    if (subtree->finished)
+        goto exit;
 
-	r = sd_bus_message_get_errno(m);
+    r = sd_bus_message_get_errno(m);
 
-	if(r == ENOENT) {
-		if (subtree->op == MAPPER_OP_REMOVE)
-			r = 0;
-		else
-			goto exit;
-	}
+    if (r == ENOENT)
+    {
+        if (subtree->op == MAPPER_OP_REMOVE)
+            r = 0;
+        else
+            goto exit;
+    }
 
-	if(r == EBUSY && subtree->retry < mapper_busy_retries) {
-		r = sd_event_now(subtree->loop,
-				CLOCK_MONOTONIC,
-				&now);
-		if(r < 0) {
-			async_subtree_done(r, subtree);
-			goto exit;
-		}
+    if (r == EBUSY && subtree->retry < mapper_busy_retries)
+    {
+        r = sd_event_now(subtree->loop, CLOCK_MONOTONIC, &now);
+        if (r < 0)
+        {
+            async_subtree_done(r, subtree);
+            goto exit;
+        }
 
-		++subtree->retry;
-		r = sd_event_add_time(subtree->loop,
-				&subtree->event_source,
-				CLOCK_MONOTONIC,
-				now + mapper_busy_delay_interval_usec,
-				0,
-				async_subtree_timeout_callback,
-				subtree);
-		if(r < 0) {
-			async_subtree_done(r, subtree);
-			goto exit;
-		}
+        ++subtree->retry;
+        r = sd_event_add_time(subtree->loop, &subtree->event_source,
+                              CLOCK_MONOTONIC,
+                              now + mapper_busy_delay_interval_usec, 0,
+                              async_subtree_timeout_callback, subtree);
+        if (r < 0)
+        {
+            async_subtree_done(r, subtree);
+            goto exit;
+        }
 
-		return 0;
-	}
+        return 0;
+    }
 
-	if(r) {
-		async_subtree_done(-r, subtree);
-		goto exit;
-	}
+    if (r)
+    {
+        async_subtree_done(-r, subtree);
+        goto exit;
+    }
 
-	sd_bus_message_read(m, "as", 1, &intf);
-	if (subtree->op == MAPPER_OP_REMOVE) {
-		/* For remove, operation is complete when the interface is not present */
-		if (intf == NULL)
-			async_subtree_done(0, subtree);
-	}
+    sd_bus_message_read(m, "as", 1, &intf);
+    if (subtree->op == MAPPER_OP_REMOVE)
+    {
+        /* For remove, operation is complete when the interface is not present
+         */
+        if (intf == NULL)
+            async_subtree_done(0, subtree);
+    }
 
 exit:
-	return 0;
+    return 0;
 }
 
 static int async_subtree_getpaths(mapper_async_subtree *subtree)
 {
-	int r = 0;
+    int r = 0;
 
-	subtree->retry = 0;
-	subtree->event_source = NULL;
-	r = sd_bus_call_method_async(
-			subtree->conn,
-			NULL,
-			MAPPER_BUSNAME,
-			MAPPER_PATH,
-			MAPPER_INTERFACE,
-			"GetSubTreePaths",
-			async_subtree_getpaths_callback,
-			subtree,
-			"sias",
-			subtree->namespace,
-			0, 1,
-			subtree->interface);
-	if (r < 0) {
-		fprintf(stderr, "Error invoking method: %s\n", strerror(-r));
-		return r;
-	}
+    subtree->retry = 0;
+    subtree->event_source = NULL;
+    r = sd_bus_call_method_async(
+        subtree->conn, NULL, MAPPER_BUSNAME, MAPPER_PATH, MAPPER_INTERFACE,
+        "GetSubTreePaths", async_subtree_getpaths_callback, subtree, "sias",
+        subtree->namespace, 0, 1, subtree->interface);
+    if (r < 0)
+    {
+        fprintf(stderr, "Error invoking method: %s\n", strerror(-r));
+        return r;
+    }
 
-	return 0;
+    return 0;
 }
 
-static int async_subtree_match_callback(sd_bus_message *m,
-		void *t,
-		sd_bus_error *e)
+static int async_subtree_match_callback(sd_bus_message *m, void *t,
+                                        sd_bus_error *e)
 {
-	int r;
+    int r;
 
-	mapper_async_subtree *subtree = t;
-	if(subtree->finished)
-		return 0;
+    mapper_async_subtree *subtree = t;
+    if (subtree->finished)
+        return 0;
 
-	r = async_subtree_getpaths(subtree);
-	if(r < 0)
-		async_subtree_done(r, subtree);
+    r = async_subtree_getpaths(subtree);
+    if (r < 0)
+        async_subtree_done(r, subtree);
 
-	return 0;
+    return 0;
 }
 
 static void async_subtree_done(int r, mapper_async_subtree *t)
 {
-	if(t->finished)
-		return;
+    if (t->finished)
+        return;
 
-	t->finished = 1;
-	sd_bus_slot_unref(t->slot);
+    t->finished = 1;
+    sd_bus_slot_unref(t->slot);
 
-	if(t->callback)
-		t->callback(r, t->userdata);
+    if (t->callback)
+        t->callback(r, t->userdata);
 }
 
-int mapper_subtree_async(sd_bus *conn,
-		sd_event *loop,
-		char *namespace,
-		char *interface,
-		void (*callback)(int, void *),
-		void *userdata,
-		mapper_async_subtree **t,
-		int op)
+int mapper_subtree_async(sd_bus *conn, sd_event *loop, char *namespace,
+                         char *interface, void (*callback)(int, void *),
+                         void *userdata, mapper_async_subtree **t, int op)
 {
-	int r = 0;
-	mapper_async_subtree *subtree = NULL;
+    int r = 0;
+    mapper_async_subtree *subtree = NULL;
 
-	subtree = malloc(sizeof(*subtree));
-	if(!subtree)
-		return -ENOMEM;
+    subtree = malloc(sizeof(*subtree));
+    if (!subtree)
+        return -ENOMEM;
 
-	memset(subtree, 0, sizeof(*subtree));
-	subtree->conn = conn;
-	subtree->loop = loop;
-	subtree->namespace = namespace;
-	subtree->interface = interface;
-	subtree->callback = callback;
-	subtree->userdata = userdata;
-	subtree->op = op;
+    memset(subtree, 0, sizeof(*subtree));
+    subtree->conn = conn;
+    subtree->loop = loop;
+    subtree->namespace = namespace;
+    subtree->interface = interface;
+    subtree->callback = callback;
+    subtree->userdata = userdata;
+    subtree->op = op;
 
-	if (subtree->op == MAPPER_OP_REMOVE) {
-		r = sd_bus_add_match(
-				conn,
-				&subtree->slot,
-				interfaces_removed_match,
-				async_subtree_match_callback,
-				subtree);
-		if(r < 0) {
-			fprintf(stderr, "Error adding match rule: %s\n",
-					strerror(-r));
-			goto unref_slot;
-		}
-	} else {
-		/* Operation not supported */
-		r = -EINVAL;
-		goto free_subtree;
-	}
+    if (subtree->op == MAPPER_OP_REMOVE)
+    {
+        r = sd_bus_add_match(conn, &subtree->slot, interfaces_removed_match,
+                             async_subtree_match_callback, subtree);
+        if (r < 0)
+        {
+            fprintf(stderr, "Error adding match rule: %s\n", strerror(-r));
+            goto unref_slot;
+        }
+    }
+    else
+    {
+        /* Operation not supported */
+        r = -EINVAL;
+        goto free_subtree;
+    }
 
-	r = async_subtree_getpaths(subtree);
-	if(r < 0) {
-		fprintf(stderr, "Error calling method: %s\n",
-				strerror(-r));
-		goto unref_slot;
-	}
+    r = async_subtree_getpaths(subtree);
+    if (r < 0)
+    {
+        fprintf(stderr, "Error calling method: %s\n", strerror(-r));
+        goto unref_slot;
+    }
 
-	*t = subtree;
+    *t = subtree;
 
-	return 0;
+    return 0;
 
 unref_slot:
-	sd_bus_slot_unref(subtree->slot);
+    sd_bus_slot_unref(subtree->slot);
 free_subtree:
-	free(subtree);
+    free(subtree);
 
-	return r;
+    return r;
 }
 
 int mapper_get_object(sd_bus *conn, const char *obj, sd_bus_message **reply)
 {
-	sd_bus_error error = SD_BUS_ERROR_NULL;
-	sd_bus_message *request = NULL;
-	int r, retry = 0;
+    sd_bus_error error = SD_BUS_ERROR_NULL;
+    sd_bus_message *request = NULL;
+    int r, retry = 0;
 
-	r = sd_bus_message_new_method_call(
-			conn,
-			&request,
-			MAPPER_BUSNAME,
-			MAPPER_PATH,
-			MAPPER_INTERFACE,
-			"GetObject");
-	if (r < 0)
-		goto exit;
+    r = sd_bus_message_new_method_call(conn, &request, MAPPER_BUSNAME,
+                                       MAPPER_PATH, MAPPER_INTERFACE,
+                                       "GetObject");
+    if (r < 0)
+        goto exit;
 
-	r = sd_bus_message_append(request, "s", obj);
-	if (r < 0)
-		goto exit;
-	r = sd_bus_message_append(request, "as", 0, NULL);
-	if (r < 0)
-		goto exit;
+    r = sd_bus_message_append(request, "s", obj);
+    if (r < 0)
+        goto exit;
+    r = sd_bus_message_append(request, "as", 0, NULL);
+    if (r < 0)
+        goto exit;
 
-	while(retry < mapper_busy_retries) {
-		sd_bus_error_free(&error);
-		r = sd_bus_call(conn, request, 0, &error, reply);
-		if (r < 0 && sd_bus_error_get_errno(&error) == EBUSY) {
-			++retry;
+    while (retry < mapper_busy_retries)
+    {
+        sd_bus_error_free(&error);
+        r = sd_bus_call(conn, request, 0, &error, reply);
+        if (r < 0 && sd_bus_error_get_errno(&error) == EBUSY)
+        {
+            ++retry;
 
-			if(retry != mapper_busy_retries)
-				usleep(mapper_busy_delay_interval_usec);
-			continue;
-		}
-		break;
-	}
+            if (retry != mapper_busy_retries)
+                usleep(mapper_busy_delay_interval_usec);
+            continue;
+        }
+        break;
+    }
 
-	if (r < 0)
-		goto exit;
+    if (r < 0)
+        goto exit;
 
 exit:
-	sd_bus_error_free(&error);
-	sd_bus_message_unref(request);
+    sd_bus_error_free(&error);
+    sd_bus_message_unref(request);
 
-	return r;
+    return r;
 }
 
 int mapper_get_service(sd_bus *conn, const char *obj, char **service)
 {
-	sd_bus_message *reply = NULL;
-	const char *tmp;
-	int r;
+    sd_bus_message *reply = NULL;
+    const char *tmp;
+    int r;
 
-	r = mapper_get_object(conn, obj, &reply);
-	if (r < 0)
-		goto exit;
+    r = mapper_get_object(conn, obj, &reply);
+    if (r < 0)
+        goto exit;
 
-	r = sd_bus_message_enter_container(reply, 0, NULL);
-	if (r < 0)
-		goto exit;
+    r = sd_bus_message_enter_container(reply, 0, NULL);
+    if (r < 0)
+        goto exit;
 
-	r = sd_bus_message_enter_container(reply, 0, NULL);
-	if (r < 0)
-		goto exit;
+    r = sd_bus_message_enter_container(reply, 0, NULL);
+    if (r < 0)
+        goto exit;
 
-	r = sd_bus_message_read(reply, "s", &tmp);
-	if (r < 0)
-		goto exit;
+    r = sd_bus_message_read(reply, "s", &tmp);
+    if (r < 0)
+        goto exit;
 
-	*service = strdup(tmp);
+    *service = strdup(tmp);
 
 exit:
-	sd_bus_message_unref(reply);
+    sd_bus_message_unref(reply);
 
-	return r;
+    return r;
 }
diff --git a/libmapper/mapper.h b/libmapper/mapper.h
index 8fa5db6..854f40c 100644
--- a/libmapper/mapper.h
+++ b/libmapper/mapper.h
@@ -4,19 +4,17 @@
 #ifdef __cplusplus
 extern "C" {
 #endif
-typedef enum mapper_operation
-{
-	MAPPER_OP_REMOVE = 1
-} mapper_operation;
+typedef enum mapper_operation { MAPPER_OP_REMOVE = 1 } mapper_operation;
 typedef struct mapper_async_wait mapper_async_wait;
 typedef struct mapper_async_subtree mapper_async_subtree;
 void mapper_wait_async_free(mapper_async_wait *);
 void mapper_subtree_async_free(mapper_async_subtree *);
 
-int mapper_wait_async(sd_bus *, sd_event *, char *[],
-		void (*)(int, void *), void *, mapper_async_wait **);
+int mapper_wait_async(sd_bus *, sd_event *, char *[], void (*)(int, void *),
+                      void *, mapper_async_wait **);
 int mapper_subtree_async(sd_bus *, sd_event *, char *, char *,
-		void (*)(int, void *), void *, mapper_async_subtree **, int);
+                         void (*)(int, void *), void *, mapper_async_subtree **,
+                         int);
 int mapper_get_service(sd_bus *conn, const char *obj, char **service);
 int mapper_get_object(sd_bus *conn, const char *obj, sd_bus_message **reply);
 #ifdef __cplusplus
diff --git a/libmapper/workaround/systemd.h b/libmapper/workaround/systemd.h
index 1b32753..51fb2e3 100644
--- a/libmapper/workaround/systemd.h
+++ b/libmapper/workaround/systemd.h
@@ -2,5 +2,8 @@
 #include <systemd/sd-bus.h>
 
 int sd_bus_message_append_cmdline(sd_bus_message *m, const char *signature,
-    char ***x) { return 0; }
+                                  char ***x)
+{
+    return 0;
+}
 #endif