From: Aki Tuomi Date: Fri, 9 Jun 2017 11:08:22 +0000 (+0300) Subject: lib: Fix test-path-util.c formatting to conform coding style X-Git-Tag: 2.3.0.rc1~1464 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=7ebda61d3fd228451530ca8faa33380105230ebe;p=thirdparty%2Fdovecot%2Fcore.git lib: Fix test-path-util.c formatting to conform coding style --- diff --git a/src/lib/test-path-util.c b/src/lib/test-path-util.c index e0db0b6550..0d1c761c82 100644 --- a/src/lib/test-path-util.c +++ b/src/lib/test-path-util.c @@ -17,14 +17,16 @@ static const char *link1; static const char *link2; static const char *link3; -static void test_local_path() { +static void test_local_path(void) +{ const char *expected = t_strconcat(cwd, "/README.md", NULL); const char *npath = NULL, *error = NULL; test_assert(t_normpath_to("README.md", cwd, &npath, &error) == 0); test_assert_strcmp(npath, expected); } -static void test_absolute_path_no_change(void) { +static void test_absolute_path_no_change(void) +{ const char *npath = NULL, *error = NULL; test_assert(t_normpath_to("/", "/", &npath, &error) == 0); test_assert_strcmp(npath, "/"); @@ -33,14 +35,16 @@ static void test_absolute_path_no_change(void) { test_assert_strcmp(npath, cwd); } -static int path_height(const char* p) { +static int path_height(const char *p) +{ int n; for (n = 0; *p != '\0'; ++p) n += *p == '/'; return n; } -static void test_travel_to_root(void) { +static void test_travel_to_root(void) +{ int l = path_height(cwd); const char *npath = cwd; for (npath = cwd; l != 0; l--) { @@ -50,7 +54,8 @@ static void test_travel_to_root(void) { test_assert_strcmp(npath, "/"); } -static void test_extra_slashes(void) { +static void test_extra_slashes(void) +{ const char *npath = NULL, *error = NULL; test_assert(t_normpath_to(".", cwd, &npath, &error) == 0); test_assert_strcmp(npath, cwd); @@ -62,7 +67,8 @@ static void test_extra_slashes(void) { test_assert_strcmp(npath, cwd); } -static void test_nonexistent_path(void) { +static void test_nonexistent_path(void) +{ const char *npath = NULL, *error = NULL; const char *expected = t_strconcat(cwd, "/nonexistent", NULL); test_assert(t_normpath_to("nonexistent", cwd, &npath, &error) == 0); @@ -71,7 +77,8 @@ static void test_nonexistent_path(void) { test_assert(error != NULL); } -static void test_relative_dotdot() { +static void test_relative_dotdot(void) +{ const char *rel_path = "../"TEMP_DIRNAME; const char *npath = NULL, *error = NULL; test_assert(t_normpath_to(rel_path, tmpdir, &npath, &error) == 0); @@ -87,13 +94,15 @@ static void test_relative_dotdot() { test_assert_strcmp(npath, cwd); } -static void test_link1() { +static void test_link1(void) +{ const char *npath = NULL, *error = NULL; test_assert(t_realpath_to(link1, "/", &npath, &error) == 0); test_assert_strcmp(npath, tmpdir); } -static void test_link_loop() { +static void test_link_loop(void) +{ const char *npath = NULL, *error = NULL; errno = 0; test_assert(t_realpath_to(link2, "/", &npath, &error) == -1); @@ -101,7 +110,8 @@ static void test_link_loop() { test_assert(error != NULL); } -static void test_abspath_vs_normpath() { +static void test_abspath_vs_normpath(void) +{ const char *abs = t_abspath_to("../../bin", "/usr/lib/"); test_assert_strcmp(abs, "/usr/lib//../../bin"); @@ -110,7 +120,8 @@ static void test_abspath_vs_normpath() { test_assert_strcmp(norm, "/bin"); } -static void test_link_alloc() { +static void test_link_alloc(void) +{ #define COMPONENT_COMPONENT "/component-component" const char *o_tmpdir; @@ -161,7 +172,8 @@ static void test_cleanup(void) i_error("unlink_directory() failed: %s", error); } -static void test_init(void) { +static void test_init(void) +{ const char *error; test_assert(t_get_working_dir(&cwd, &error) == 0); tmpdir = t_strconcat(cwd, "/"TEMP_DIRNAME, NULL); @@ -187,7 +199,8 @@ static void test_init(void) { } } -void test_path_util(void) { +void test_path_util(void) +{ test_begin("test_path_util"); alarm(20); test_init();