rpicamsrc: sync autotools with glib-mkenum usage in meson build
authorTim-Philipp Müller <tim@centricular.com>
Sat, 2 May 2020 19:27:20 +0000 (19:27 +0000)
committerTim-Philipp Müller <tim@centricular.com>
Fri, 10 Jul 2020 15:47:12 +0000 (16:47 +0100)
sys/rpicamsrc/gstrpicam-enums-template.c
sys/rpicamsrc/gstrpicam-enums-template.h

index b9dee13..8631751 100644 (file)
@@ -4,36 +4,36 @@
 /*** END file-header ***/
 
 /*** BEGIN file-production ***/
-/* enumerations from "@filename@" */
+/* enumerations from "@basename@" */
 #include "@filename@"
 
+#define C_ENUM(v) ((gint) v)
+#define C_FLAGS(v) ((guint) v)
+
 /*** END file-production ***/
 
 /*** BEGIN value-header ***/
 GType
 @enum_name@_get_type (void)
 {
-       static GType the_type = 0;
-       
-       if (the_type == 0)
-       {
-               static const G@Type@Value values[] = {
+  static volatile gsize gtype_id = 0;
+
+  if (g_once_init_enter (&gtype_id)) {
+    static const G@Type@Value values[] = {
 /*** END value-header ***/
 
 /*** BEGIN value-production ***/
-                       { @VALUENAME@,
-                         "@VALUENAME@",
-                         "@valuenick@" },
+        { C_@TYPE@(@VALUENAME@), "@VALUENAME@", "@valuenick@" },
 /*** END value-production ***/
 
 /*** BEGIN value-tail ***/
-                       { 0, NULL, NULL }
-               };
-               the_type = g_@type@_register_static (
-                               g_intern_static_string ("@EnumName@"),
-                               values);
-       }
-       return the_type;
+        { 0, NULL, NULL }
+    };
+
+    GType new_type = g_@type@_register_static (g_intern_static_string ("@EnumName@"), values);
+    g_once_init_leave (&gtype_id, new_type);
+  }
+  return (GType) gtype_id;
 }
 
 /*** END value-tail ***/
index 62b49ca..eb25042 100644 (file)
@@ -1,6 +1,5 @@
 /*** BEGIN file-header ***/
-#ifndef __GSTRPICAM_ENUM_TYPES_H__
-#define __GSTRPICAM_ENUM_TYPES_H__
+#pragma once
 
 #include <glib-object.h>
 
@@ -9,18 +8,17 @@ G_BEGIN_DECLS
 /*** END file-header ***/
 
 /*** BEGIN file-production ***/
-/* Enumerations from "@filename@" */
+/* Enumerations from "@basename@" */
 
 /*** END file-production ***/
 
 /*** BEGIN enumeration-production ***/
-#define GST_RPI_CAM_TYPE_@ENUMSHORT@   (@enum_name@_get_type())
-GType @enum_name@_get_type     (void) G_GNUC_CONST;
+#define @ENUMPREFIX@_TYPE_@ENUMSHORT@ (@enum_name@_get_type())
+GType @enum_name@_get_type (void);
 
 /*** END enumeration-production ***/
 
 /*** BEGIN file-tail ***/
 G_END_DECLS
 
-#endif /* __GSTRPICAM_ENUM_TYPES_H__ */
 /*** END file-tail ***/