]> git.ipfire.org Git - thirdparty/gnulib.git/commitdiff
selinux-h: pacify -Wzero-as-null-pointer-constant
authorPaul Eggert <eggert@cs.ucla.edu>
Fri, 16 Jan 2026 19:17:26 +0000 (11:17 -0800)
committerPaul Eggert <eggert@cs.ucla.edu>
Fri, 16 Jan 2026 19:18:36 +0000 (11:18 -0800)
* lib/se-context.in.h (context_t): Make it a pointer to an
incomplete type rather than an int, so that callers can initialize
it with NULL regardless of whehter --with-selinux is used.
* lib/se-context.in.h (context_new):
* lib/se-label.in.h (selabel_open): Use the equivalent of
NULL (not NULL, since that would require including <stddef.h>).

ChangeLog
lib/se-context.in.h
lib/se-label.in.h

index db4ae7ff31dd615bf497e6b2594e8719b39a33a3..bd77658a749602ffbdf0f0933937742a3661f0a3 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2026-01-16  Paul Eggert  <eggert@cs.ucla.edu>
+
+       selinux-h: pacify -Wzero-as-null-pointer-constant
+       * lib/se-context.in.h (context_t): Make it a pointer to an
+       incomplete type rather than an int, so that callers can initialize
+       it with NULL regardless of whehter --with-selinux is used.
+       * lib/se-context.in.h (context_new):
+       * lib/se-label.in.h (selabel_open): Use the equivalent of
+       NULL (not NULL, since that would require including <stddef.h>).
+
 2026-01-15  Paul Eggert  <eggert@cs.ucla.edu>
 
        manywarnings: -Wzero-as-null-pointer-constant in C
index ecc42032c9d7d8e18477ae346cb91ce4d3f2f66e..37cc7a6dff713ff53efaad3b66d7dc981b173c1e 100644 (file)
@@ -42,10 +42,10 @@ _GL_INLINE_HEADER_BEGIN
 #endif
 
 
-typedef int context_t;
+typedef struct context_t *context_t;
 SE_CONTEXT_INLINE context_t
 context_new (char const *_GL_UNNAMED (s))
-  { errno = ENOTSUP; return 0; }
+  { errno = ENOTSUP; return (void *) 0; }
 SE_CONTEXT_INLINE char *
 context_str (context_t _GL_UNNAMED (con))
   { errno = ENOTSUP; return (void *) 0; }
index 19b5f26aa6a1780c8a982b197f947bb22d6dd2aa..159adb669367eaa8eaad54f4ad79c300e51a3069 100644 (file)
@@ -64,7 +64,7 @@ SE_LABEL_INLINE struct selabel_handle *
 selabel_open (int _GL_UNNAMED (backend),
               struct selinux_opt *_GL_UNNAMED (options),
               unsigned _GL_UNNAMED (nopt))
-{ errno = ENOTSUP; return 0; }
+{ errno = ENOTSUP; return (void *) 0; }
 
 SE_LABEL_INLINE void
 selabel_close (struct selabel_handle *_GL_UNNAMED (hnd))