clang-format: update c/cc coding style
Update all cc code using .clang-format; please do so as well for future PRs etc.; emacs has a handy 'clang-format' mode to make this automatic. For comparing old changes with git blame, we can disregard this one using --ignore-rev (see https://www.moxio.com/blog/43/ignoring-bulk-change-commits-with-git-blame )
This commit is contained in:
@ -24,55 +24,57 @@
|
||||
#include "mu-container.hh"
|
||||
|
||||
static gboolean
|
||||
container_has_children (const MuContainer *c)
|
||||
container_has_children(const MuContainer* c)
|
||||
{
|
||||
return c && c->child;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
container_is_sibling_of (const MuContainer *c, const MuContainer *sibling)
|
||||
container_is_sibling_of(const MuContainer* c, const MuContainer* sibling)
|
||||
{
|
||||
const MuContainer *cur;
|
||||
const MuContainer* cur;
|
||||
|
||||
for (cur = c; cur; cur = cur->next) {
|
||||
if (cur == sibling)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return container_is_sibling_of (sibling, c);
|
||||
return container_is_sibling_of(sibling, c);
|
||||
}
|
||||
|
||||
static void
|
||||
test_mu_container_splice_children_when_parent_has_no_siblings (void)
|
||||
test_mu_container_splice_children_when_parent_has_no_siblings(void)
|
||||
{
|
||||
MuContainer *child, *parent, *root_set;
|
||||
|
||||
child = mu_container_new (NULL, 0, "child");
|
||||
parent = mu_container_new (NULL, 0, "parent");
|
||||
parent = mu_container_append_children (parent, child);
|
||||
child = mu_container_new(NULL, 0, "child");
|
||||
parent = mu_container_new(NULL, 0, "parent");
|
||||
parent = mu_container_append_children(parent, child);
|
||||
|
||||
root_set = parent;
|
||||
root_set = mu_container_splice_children (root_set, parent);
|
||||
root_set = mu_container_splice_children(root_set, parent);
|
||||
|
||||
g_assert (root_set != NULL);
|
||||
g_assert (!container_has_children(parent));
|
||||
g_assert (container_is_sibling_of (root_set, child));
|
||||
g_assert(root_set != NULL);
|
||||
g_assert(!container_has_children(parent));
|
||||
g_assert(container_is_sibling_of(root_set, child));
|
||||
|
||||
mu_container_destroy(parent);
|
||||
mu_container_destroy(child);
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
main(int argc, char* argv[])
|
||||
{
|
||||
g_test_init (&argc, &argv, NULL);
|
||||
g_test_init(&argc, &argv, NULL);
|
||||
|
||||
g_test_add_func ("/mu-container/mu-container-splice-children-when-parent-has-no-siblings",
|
||||
test_mu_container_splice_children_when_parent_has_no_siblings);
|
||||
g_test_add_func("/mu-container/mu-container-splice-children-when-parent-has-no-siblings",
|
||||
test_mu_container_splice_children_when_parent_has_no_siblings);
|
||||
|
||||
g_log_set_handler (NULL,
|
||||
(GLogLevelFlags)(G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL| G_LOG_FLAG_RECURSION),
|
||||
(GLogFunc)black_hole, NULL);
|
||||
g_log_set_handler(
|
||||
NULL,
|
||||
(GLogLevelFlags)(G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL | G_LOG_FLAG_RECURSION),
|
||||
(GLogFunc)black_hole,
|
||||
NULL);
|
||||
|
||||
return g_test_run ();
|
||||
return g_test_run();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user