git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 2/6] compat/win32/pthread.c: Fix a sparse warning

From
Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Date
Apr 27, 2013, 19:16 UTC
Message-ID
<517C240C.80803@ramsay1.demon.co.uk>

Sparse issues a 'Using plain integer as NULL pointer' warning when initializing an pthread_t structure with an '{ 0 }' initializer. The first field of the pthread_t structure has type HANDLE (void *), so in order to suppress the warning, we replace the initializer expression with '{ NULL }'.

Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
---
 compat/win32/pthread.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/compat/win32/pthread.c b/compat/win32/pthread.c
index 010e875..e18f5c6 100644
--- a/compat/win32/pthread.c
+++ b/compat/win32/pthread.c
@@ -52,7 +52,7 @@ int win32_pthread_join(pthread_t *thread, void **value_ptr)
 
 pthread_t pthread_self(void)
 {
-	pthread_t t = { 0 };
+	pthread_t t = { NULL };
 	t.tid = GetCurrentThreadId();
 	return t;
 }
-- 
1.8.2
Message 1 of 1 in “compat/win32/pthread.c: Fix a sparse warning”
  1. 2/6 compat/win32/pthread.c: Fix a sparse warningRamsay Jones, Apr 27, 2013

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.