[PATCH 3/5] discover: Fix unused function warning

Joel Stanley joel at jms.id.au
Tue Mar 6 15:02:18 AEDT 2018


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)
            ^

The function is only used once, so move the preprocessor guard down to
the use site instead.

Signed-off-by: Joel Stanley <joel at jms.id.au>
---
I understand if you don't want to take this one as-is.

 discover/paths.c | 13 +++----------
 1 file changed, 3 insertions(+), 10 deletions(-)

diff --git a/discover/paths.c b/discover/paths.c
index 24e978b4e2c1..1f279a103b44 100644
--- a/discover/paths.c
+++ b/discover/paths.c
@@ -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;
@@ -571,8 +562,10 @@ struct load_url_result *load_url_async(void *ctx, struct pb_url *url,
 		task->process->stdout_data = stdout_data;
 	}
 
-	if (!stdout_cb && stdout_data && have_busybox())
+#ifdef WITH_BUSYBOX
+	if (!stdout_cb && stdout_data)
 		task->process->stdout_cb = busybox_progress_cb;
+#endif
 
 	/* Make sure we save output for any task that has a custom handler */
 	if (task->process->stdout_cb) {
-- 
2.15.1



More information about the Petitboot mailing list