fix: move static functions inside ifdef
authorMichael Jeanson <mjeanson@efficios.com>
Mon, 17 Jun 2019 16:46:29 +0000 (12:46 -0400)
committerPhilippe Proulx <eeppeliteloop@gmail.com>
Fri, 21 Jun 2019 16:36:01 +0000 (12:36 -0400)
Move static functions inside ifdef where they are used so we don't get
unused functions warnings on MINGW.

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Change-Id: Ie35fcdc7b0f7bf41ed53ed06b9dfd50042510207
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1477
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
src/common/common.c

index d5f05062968629a31cce75bd2f7e02af9d478455..ed079c940c28a310f297554eb6dc430afa270c54 100644 (file)
@@ -116,6 +116,13 @@ bool bt_common_is_setuid_setgid(void)
 }
 #endif /* __MINGW32__ */
 
+#ifdef __MINGW32__
+static
+const char *bt_get_home_dir(int log_level)
+{
+       return g_get_home_dir();
+}
+#else /* __MINGW32__ */
 static
 char *bt_secure_getenv(const char *name, int log_level)
 {
@@ -127,13 +134,6 @@ char *bt_secure_getenv(const char *name, int log_level)
        return getenv(name);
 }
 
-#ifdef __MINGW32__
-static
-const char *bt_get_home_dir(int log_level)
-{
-       return g_get_home_dir();
-}
-#else /* __MINGW32__ */
 static
 const char *bt_get_home_dir(int log_level)
 {
@@ -1088,6 +1088,38 @@ end_of_pattern:
        return p[-1] == '*' && at_end_of_pattern(p, pattern, pattern_len);
 }
 
+#ifdef __MINGW32__
+BT_HIDDEN
+GString *bt_common_normalize_path(const char *path, const char *wd)
+{
+       char *tmp;
+       GString *norm_path = NULL;
+
+       BT_ASSERT(path);
+
+       tmp = _fullpath(NULL, path, PATH_MAX);
+       if (!tmp) {
+               goto error;
+       }
+
+       norm_path = g_string_new(tmp);
+       if (!norm_path) {
+               goto error;
+       }
+
+       goto end;
+error:
+       if (norm_path) {
+               g_string_free(norm_path, TRUE);
+               norm_path = NULL;
+       }
+end:
+       if (tmp) {
+               free(tmp);
+       }
+       return norm_path;
+}
+#else
 static
 void append_path_parts(const char *path, GPtrArray *parts)
 {
@@ -1121,38 +1153,6 @@ void destroy_gstring(void *gstring)
        (void) g_string_free(gstring, TRUE);
 }
 
-#ifdef __MINGW32__
-BT_HIDDEN
-GString *bt_common_normalize_path(const char *path, const char *wd)
-{
-       char *tmp;
-       GString *norm_path = NULL;
-
-       BT_ASSERT(path);
-
-       tmp = _fullpath(NULL, path, PATH_MAX);
-       if (!tmp) {
-               goto error;
-       }
-
-       norm_path = g_string_new(tmp);
-       if (!norm_path) {
-               goto error;
-       }
-
-       goto end;
-error:
-       if (norm_path) {
-               g_string_free(norm_path, TRUE);
-               norm_path = NULL;
-       }
-end:
-       if (tmp) {
-               free(tmp);
-       }
-       return norm_path;
-}
-#else
 BT_HIDDEN
 GString *bt_common_normalize_path(const char *path, const char *wd)
 {
This page took 0.027519 seconds and 4 git commands to generate.