[glib: 1/3] gio-launch-desktop: replace static_assert with G_STATIC_ASSERT




commit c850a06ea2a78a6822d54546989400039753329d
Author: Owen Rafferty <owen owenrafferty com>
Date:   Mon Aug 15 01:41:50 2022 -0500

    gio-launch-desktop: replace static_assert with G_STATIC_ASSERT

 gio/gio-launch-desktop.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
---
diff --git a/gio/gio-launch-desktop.c b/gio/gio-launch-desktop.c
index 29bf9d5d42..1703d0cb15 100644
--- a/gio/gio-launch-desktop.c
+++ b/gio/gio-launch-desktop.c
@@ -39,7 +39,6 @@
 
 #if defined(__linux__) && !defined(__BIONIC__)
 #include <alloca.h>
-#include <assert.h>
 #include <errno.h>
 #include <stddef.h>
 #include <string.h>
@@ -48,6 +47,9 @@
 #include <sys/un.h>
 
 #include "gjournal-private.h"
+#define GLIB_COMPILATION
+#include "gmacros.h" /* For G_STATIC_ASSERT define */
+#undef GLIB_COMPILATION
 
 /*
  * write_all:
@@ -119,8 +121,8 @@ journal_stream_fd (const char *identifier,
   /* Arbitrary large size for the sending buffer, from systemd */
   int large_buffer_size = 8 * 1024 * 1024;
 
-  static_assert (LOG_EMERG == 0, "Linux ABI defines LOG_EMERG");
-  static_assert (LOG_DEBUG == 7, "Linux ABI defines LOG_DEBUG");
+  G_STATIC_ASSERT (LOG_EMERG == 0);
+  G_STATIC_ASSERT (LOG_DEBUG == 7);
 
   fd = socket (AF_UNIX, SOCK_STREAM | SOCK_CLOEXEC, 0);
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]