[PATCH] Fix sparse warnings

Andrew Donnellan andrew.donnellan at au1.ibm.com
Mon Apr 18 17:05:12 AEST 2016


Fix some sparse warnings by using NULL instead of 0 and static-ifying a
variable not used outside its file.

Signed-off-by: Andrew Donnellan <andrew.donnellan at au1.ibm.com>
---
 discover/discover-server.c | 2 +-
 ui/common/timer.c          | 2 +-
 ui/ncurses/generic-main.c  | 2 +-
 ui/twin/pbt-scr.c          | 4 ++--
 4 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/discover/discover-server.c b/discover/discover-server.c
index 6806589..5f6f4d5 100644
--- a/discover/discover-server.c
+++ b/discover/discover-server.c
@@ -286,7 +286,7 @@ static int discover_server_process_connection(void *arg)
 	struct client *client;
 
 	/* accept the incoming connection */
-	fd = accept(server->socket, NULL, 0);
+	fd = accept(server->socket, NULL, NULL);
 	if (fd < 0) {
 		pb_log("accept: %s\n", strerror(errno));
 		return 0;
diff --git a/ui/common/timer.c b/ui/common/timer.c
index 3d80898..b0cae0d 100644
--- a/ui/common/timer.c
+++ b/ui/common/timer.c
@@ -49,7 +49,7 @@ static int timer_cb(void *arg)
 	struct ui_timer *timer = arg;
 
 	timer->handle_timeout(timer);
-	timer->waiter = 0;
+	timer->waiter = NULL;
 	return 0;
 }
 
diff --git a/ui/ncurses/generic-main.c b/ui/ncurses/generic-main.c
index 669053c..27744d4 100644
--- a/ui/ncurses/generic-main.c
+++ b/ui/ncurses/generic-main.c
@@ -149,7 +149,7 @@ static char *default_log_filename(void)
 	return name;
 }
 
-struct cui *cui;
+static struct cui *cui;
 
 /*
  * struct pb_cui - Main cui program instance.
diff --git a/ui/twin/pbt-scr.c b/ui/twin/pbt-scr.c
index b774f19..e10cab1 100644
--- a/ui/twin/pbt-scr.c
+++ b/ui/twin/pbt-scr.c
@@ -402,8 +402,8 @@ struct pbt_scr *pbt_scr_init(void *talloc_ctx,
 #if !defined(HAVE_LIBTWIN_TWIN_X11_H)
 		assert(0);
 #else
-		scr->twin_ctx.x11 = twin_x11_create_ext(XOpenDisplay(0), width,
-			height, 0);
+		scr->twin_ctx.x11 = twin_x11_create_ext(XOpenDisplay(NULL),
+			width, height, 0);
 
 		if (!scr->twin_ctx.x11) {
 			pb_log("%s: twin_x11_create_ext failed.\n", __func__);
-- 
Andrew Donnellan              OzLabs, ADL Canberra
andrew.donnellan at au1.ibm.com  IBM Australia Limited



More information about the Petitboot mailing list