]> git.ozlabs.org Git - petitboot/commitdiff
discover: Fix unused function warning
authorJoel Stanley <joel@jms.id.au>
Tue, 6 Mar 2018 04:02:18 +0000 (14:32 +1030)
committerSamuel Mendoza-Jonas <sam@mendozajonas.com>
Wed, 7 Mar 2018 05:24:31 +0000 (16:24 +1100)
clang errors out about an unused have_busybox function:

 discover/paths.c:44:13: error: unused function 'have_busybox' [-Werror,-Wunused-function]
 static bool have_busybox(void)
            ^

Move have_busybox() to inside the #ifndef PETITBOOT_TEST scope to
eliminate the warning and avoid having #ifdefs in load_url_async().

Signed-off-by: Joel Stanley <joel@jms.id.au>
Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
[Moved definition into #ifndef PETITBOOT_TEST instead of using
 #ifdef at the call site]

discover/paths.c

index 24e978b4e2c1c4b5cfc6092f40adcb6b7cecc8e8..c5b577823746f1c7cab1cc02f176baf494782ff5 100644 (file)
@@ -41,15 +41,6 @@ struct load_task {
        void                    *async_data;
 };
 
-static inline bool have_busybox(void)
-{
-#ifdef WITH_BUSYBOX
-       return true;
-#else
-       return false;
-#endif
-}
-
 const char *mount_base(void)
 {
        return DEVICE_MOUNT_BASE;
@@ -71,6 +62,12 @@ char *join_paths(void *alloc_ctx, const char *a, const char *b)
 
 #ifndef PETITBOOT_TEST
 
+#ifdef WITH_BUSYBOX
+static inline bool have_busybox(void) { return true; }
+#else
+static inline bool have_busybox(void) { return false; }
+#endif
+
 static char *local_name(void *ctx)
 {
        char *ret, tmp[] = "/tmp/pb-XXXXXX";