[PATCH 10/13] ui-shared: avoid initializing static variable to zero

John Keeping john at keeping.me.uk
Sun Mar 8 17:32:24 CET 2015


Sparse complains that we are using a plain integer as a NULL pointer
here, but in fact we do not have to specify a value for this variable at
all since it has static storage duration and thus will be initialized to
NULL by the compiler.

Signed-off-by: John Keeping <john at keeping.me.uk>
---
 ui-shared.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ui-shared.c b/ui-shared.c
index d4c4bb9..1e3c131 100644
--- a/ui-shared.c
+++ b/ui-shared.c
@@ -82,7 +82,7 @@ const char *cgit_rooturl(void)
 
 const char *cgit_loginurl(void)
 {
-	static const char *login_url = 0;
+	static const char *login_url;
 	if (!login_url)
 		login_url = fmtalloc("%s?p=login", cgit_rooturl());
 	return login_url;
-- 
2.3.1.308.g754cd77



More information about the CGit mailing list