From 5e858bb25e70a66b26b8f235423736c19bb09b96 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Fri, 12 Apr 2013 09:44:42 +0200 Subject: [PATCH] Bug #681837 - Make enum type registration thread safe --- Makefile.am | 2 ++ addressbook/libebook-contacts/Makefile.am | 15 +++++---- .../e-book-contacts-enumtypes.h.template | 27 --------------- addressbook/libebook/Makefile.am | 17 ++++++---- addressbook/libebook/e-book-enumtypes.c.template | 38 ---------------------- addressbook/libebook/e-book-enumtypes.h.template | 27 --------------- calendar/libecal/Makefile.am | 17 ++++++---- calendar/libecal/e-cal-enumtypes.c.template | 38 ---------------------- camel/Makefile.am | 15 +++++---- camel/camel-enumtypes.c.template | 38 ---------------------- camel/camel-enumtypes.h.template | 27 --------------- ...ts-enumtypes.c.template => enumtypes.c.template | 13 ++++---- ...al-enumtypes.h.template => enumtypes.h.template | 11 +++---- libebackend/Makefile.am | 17 ++++++---- libebackend/e-backend-enumtypes.c.template | 38 ---------------------- libebackend/e-backend-enumtypes.h.template | 27 --------------- libedataserver/Makefile.am | 15 +++++---- libedataserver/e-source-enumtypes.c.template | 38 ---------------------- libedataserver/e-source-enumtypes.h.template | 27 --------------- 19 files changed, 69 insertions(+), 378 deletions(-) delete mode 100644 addressbook/libebook-contacts/e-book-contacts-enumtypes.h.template delete mode 100644 addressbook/libebook/e-book-enumtypes.c.template delete mode 100644 addressbook/libebook/e-book-enumtypes.h.template delete mode 100644 calendar/libecal/e-cal-enumtypes.c.template delete mode 100644 camel/camel-enumtypes.c.template delete mode 100644 camel/camel-enumtypes.h.template rename addressbook/libebook-contacts/e-book-contacts-enumtypes.c.template => enumtypes.c.template (72%) rename calendar/libecal/e-cal-enumtypes.h.template => enumtypes.h.template (74%) delete mode 100644 libebackend/e-backend-enumtypes.c.template delete mode 100644 libebackend/e-backend-enumtypes.h.template delete mode 100644 libedataserver/e-source-enumtypes.c.template delete mode 100644 libedataserver/e-source-enumtypes.h.template diff --git a/Makefile.am b/Makefile.am index f584b73..f7d4d84 100644 --- a/Makefile.am +++ b/Makefile.am @@ -26,6 +26,8 @@ EXTRA_DIST = \ MAINTAINERS \ TODO \ NEWS \ + enumtypes.c.template \ + enumtypes.h.template \ iconv-detect.c \ intltool-merge.in \ intltool-update.in \ diff --git a/addressbook/libebook-contacts/Makefile.am b/addressbook/libebook-contacts/Makefile.am index 02be0ef..ab1e3c2 100644 --- a/addressbook/libebook-contacts/Makefile.am +++ b/addressbook/libebook-contacts/Makefile.am @@ -3,11 +3,16 @@ BUILT_SOURCES= ENUM_TYPES = e-book-contacts-types.h -e-book-contacts-enumtypes.h: e-book-contacts-enumtypes.h.template $(ENUM_TYPES) - $(AM_V_GEN) (cd $(srcdir) && $(GLIB_MKENUMS) --template e-book-contacts-enumtypes.h.template $(ENUM_TYPES)) > $@ +e-book-contacts-enumtypes.h: $(top_srcdir)/enumtypes.h.template $(ENUM_TYPES) + $(AM_V_GEN) (cd $(srcdir) && $(GLIB_MKENUMS) --template $(top_srcdir)/enumtypes.h.template \ + --fhead "#ifndef E_BOOK_CONTACTS_ENUMTYPES_H\n#define E_BOOK_CONTACTS_ENUMTYPES_H\n" \ + --ftail "#endif /* E_BOOK_CONTACTS_ENUMTYPES_H */\n" \ + $(ENUM_TYPES)) > $@ -e-book-contacts-enumtypes.c: e-book-contacts-enumtypes.c.template $(ENUM_TYPES) - $(AM_V_GEN) (cd $(srcdir) && $(GLIB_MKENUMS) --template e-book-contacts-enumtypes.c.template $(ENUM_TYPES)) > $@ +e-book-contacts-enumtypes.c: $(top_srcdir)/enumtypes.c.template $(ENUM_TYPES) + $(AM_V_GEN) (cd $(srcdir) && $(GLIB_MKENUMS) --template $(top_srcdir)/enumtypes.c.template \ + --fhead "#include \"e-book-contacts-enumtypes.h\"" \ + $(ENUM_TYPES)) > $@ ENUM_GENERATED = e-book-contacts-enumtypes.h e-book-contacts-enumtypes.c @@ -155,8 +160,6 @@ DISTCLEANFILES = $(pkgconfig_DATA) EXTRA_DIST = \ $(pkgconfig_DATA:-$(API_VERSION).pc=.pc.in) \ - e-book-contacts-enumtypes.h.template \ - e-book-contacts-enumtypes.c.template \ e-name-western-tables.h.in \ gen-western-table.py diff --git a/addressbook/libebook-contacts/e-book-contacts-enumtypes.h.template b/addressbook/libebook-contacts/e-book-contacts-enumtypes.h.template deleted file mode 100644 index 69ff145..0000000 --- a/addressbook/libebook-contacts/e-book-contacts-enumtypes.h.template +++ /dev/null @@ -1,27 +0,0 @@ -/*** BEGIN file-header ***/ -#ifndef E_BOOK_CONTACTS_ENUMTYPES_H -#define E_BOOK_CONTACTS_ENUMTYPES_H - -#include - -G_BEGIN_DECLS - -/*** END file-header ***/ - -/*** BEGIN file-production ***/ -/* Enumerations from "@filename@" */ - -/*** END file-production ***/ - -/*** BEGIN enumeration-production ***/ -#define E_TYPE_@ENUMSHORT@ (@enum_name@_get_type()) -GType @enum_name@_get_type (void) G_GNUC_CONST; - -/*** END enumeration-production ***/ - -/*** BEGIN file-tail ***/ -G_END_DECLS - -#endif /* E_BOOK_ENUMTYPES_H */ -/*** END file-tail ***/ - diff --git a/addressbook/libebook/Makefile.am b/addressbook/libebook/Makefile.am index 5613bb1..5bba184 100644 --- a/addressbook/libebook/Makefile.am +++ b/addressbook/libebook/Makefile.am @@ -3,11 +3,16 @@ BUILT_SOURCES= ENUM_TYPES = e-book-types.h -e-book-enumtypes.h: e-book-enumtypes.h.template $(ENUM_TYPES) - $(AM_V_GEN) (cd $(srcdir) && $(GLIB_MKENUMS) --template e-book-enumtypes.h.template $(ENUM_TYPES)) > $@ +e-book-enumtypes.h: $(top_srcdir)/enumtypes.h.template $(ENUM_TYPES) + $(AM_V_GEN) (cd $(srcdir) && $(GLIB_MKENUMS) --template $(top_srcdir)/enumtypes.h.template \ + --fhead "#ifndef E_BOOK_ENUMTYPES_H\n#define E_BOOK_ENUMTYPES_H\n" \ + --ftail "#endif /* E_BOOK_ENUMTYPES_H */\n" \ + $(ENUM_TYPES)) > $@ -e-book-enumtypes.c: e-book-enumtypes.c.template $(ENUM_TYPES) - $(AM_V_GEN) (cd $(srcdir) && $(GLIB_MKENUMS) --template e-book-enumtypes.c.template $(ENUM_TYPES)) > $@ +e-book-enumtypes.c: $(top_srcdir)/enumtypes.c.template $(ENUM_TYPES) + $(AM_V_GEN) (cd $(srcdir) && $(GLIB_MKENUMS) --template $(top_srcdir)/enumtypes.c.template \ + --fhead "#include \"e-book-enumtypes.h\"" \ + $(ENUM_TYPES)) > $@ ENUM_GENERATED = e-book-enumtypes.h e-book-enumtypes.c @@ -142,9 +147,7 @@ CLEANFILES += $(BUILT_SOURCES) DISTCLEANFILES = $(pkgconfig_DATA) EXTRA_DIST = \ - $(pkgconfig_DATA:-$(API_VERSION).pc=.pc.in) \ - e-book-enumtypes.h.template \ - e-book-enumtypes.c.template + $(pkgconfig_DATA:-$(API_VERSION).pc=.pc.in) dist-hook: cd $(distdir); rm -f $(BUILT_SOURCES) diff --git a/addressbook/libebook/e-book-enumtypes.c.template b/addressbook/libebook/e-book-enumtypes.c.template deleted file mode 100644 index 811ca10..0000000 --- a/addressbook/libebook/e-book-enumtypes.c.template +++ /dev/null @@ -1,38 +0,0 @@ -/*** BEGIN file-header ***/ -#include "e-book-enumtypes.h" - -/*** END file-header ***/ - -/*** BEGIN file-production ***/ -/* enumerations from "@filename@" */ -#include "@filename@" - -/*** 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[] = { -/*** END value-header ***/ - -/*** BEGIN value-production ***/ - { @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; -} - -/*** END value-tail ***/ diff --git a/addressbook/libebook/e-book-enumtypes.h.template b/addressbook/libebook/e-book-enumtypes.h.template deleted file mode 100644 index d30ec47..0000000 --- a/addressbook/libebook/e-book-enumtypes.h.template +++ /dev/null @@ -1,27 +0,0 @@ -/*** BEGIN file-header ***/ -#ifndef E_BOOK_ENUMTYPES_H -#define E_BOOK_ENUMTYPES_H - -#include - -G_BEGIN_DECLS - -/*** END file-header ***/ - -/*** BEGIN file-production ***/ -/* Enumerations from "@filename@" */ - -/*** END file-production ***/ - -/*** BEGIN enumeration-production ***/ -#define E_TYPE_@ENUMSHORT@ (@enum_name@_get_type()) -GType @enum_name@_get_type (void) G_GNUC_CONST; - -/*** END enumeration-production ***/ - -/*** BEGIN file-tail ***/ -G_END_DECLS - -#endif /* E_BOOK_ENUMTYPES_H */ -/*** END file-tail ***/ - diff --git a/calendar/libecal/Makefile.am b/calendar/libecal/Makefile.am index 46945fa..04f70e7 100644 --- a/calendar/libecal/Makefile.am +++ b/calendar/libecal/Makefile.am @@ -1,10 +1,15 @@ ENUM_TYPES = e-cal-types.h -e-cal-enumtypes.h: e-cal-enumtypes.h.template $(ENUM_TYPES) - $(AM_V_GEN) (cd $(srcdir) && $(GLIB_MKENUMS) --template e-cal-enumtypes.h.template $(ENUM_TYPES)) > $@ +e-cal-enumtypes.h: $(top_srcdir)/enumtypes.h.template $(ENUM_TYPES) + $(AM_V_GEN) (cd $(srcdir) && $(GLIB_MKENUMS) --template $(top_srcdir)/enumtypes.h.template \ + --fhead "#ifndef E_CAL_ENUMTYPES_H\n#define E_CAL_ENUMTYPES_H\n" \ + --ftail "#endif /* E_CAL_ENUMTYPES_H */\n" \ + $(ENUM_TYPES)) > $@ -e-cal-enumtypes.c: e-cal-enumtypes.c.template $(ENUM_TYPES) - $(AM_V_GEN) (cd $(srcdir) && $(GLIB_MKENUMS) --template e-cal-enumtypes.c.template $(ENUM_TYPES)) > $@ +e-cal-enumtypes.c: $(top_srcdir)/enumtypes.c.template $(ENUM_TYPES) + $(AM_V_GEN) (cd $(srcdir) && $(GLIB_MKENUMS) --template $(top_srcdir)/enumtypes.c.template \ + --fhead "#include \"e-cal-enumtypes.h\"" \ + $(ENUM_TYPES)) > $@ ENUM_GENERATED = e-cal-enumtypes.h e-cal-enumtypes.c @@ -90,9 +95,7 @@ CLEANFILES = $(BUILT_SOURCES) DISTCLEANFILES = $(pkgconfig_DATA) EXTRA_DIST = \ - $(pkgconfig_DATA:-$(API_VERSION).pc=.pc.in) \ - e-cal-enumtypes.h.template \ - e-cal-enumtypes.c.template + $(pkgconfig_DATA:-$(API_VERSION).pc=.pc.in) dist-hook: cd $(distdir); rm -f $(BUILT_SOURCES) diff --git a/calendar/libecal/e-cal-enumtypes.c.template b/calendar/libecal/e-cal-enumtypes.c.template deleted file mode 100644 index 1943073..0000000 --- a/calendar/libecal/e-cal-enumtypes.c.template +++ /dev/null @@ -1,38 +0,0 @@ -/*** BEGIN file-header ***/ -#include "e-cal-enumtypes.h" - -/*** END file-header ***/ - -/*** BEGIN file-production ***/ -/* enumerations from "@filename@" */ -#include "@filename@" - -/*** 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[] = { -/*** END value-header ***/ - -/*** BEGIN value-production ***/ - { @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; -} - -/*** END value-tail ***/ diff --git a/camel/Makefile.am b/camel/Makefile.am index 7d3a4d1..395c92c 100644 --- a/camel/Makefile.am +++ b/camel/Makefile.am @@ -31,11 +31,16 @@ lib_LTLIBRARIES = libcamel-1.2.la ENUM_TYPES = camel-enums.h -camel-enumtypes.h: camel-enumtypes.h.template $(ENUM_TYPES) - $(AM_V_GEN) (cd $(srcdir) && $(GLIB_MKENUMS) --template camel-enumtypes.h.template $(ENUM_TYPES)) > $@ +camel-enumtypes.h: $(top_srcdir)/enumtypes.h.template $(ENUM_TYPES) + $(AM_V_GEN) (cd $(srcdir) && $(GLIB_MKENUMS) --template $(top_srcdir)/enumtypes.h.template \ + --fhead "#ifndef CAMEL_ENUMTYPES_H\n#define CAMEL_ENUMTYPES_H\n" \ + --ftail "#endif /* CAMEL_ENUMTYPES_H */\n" \ + $(ENUM_TYPES)) > $@ -camel-enumtypes.c: camel-enumtypes.c.template $(ENUM_TYPES) - $(AM_V_GEN) (cd $(srcdir) && $(GLIB_MKENUMS) --template camel-enumtypes.c.template $(ENUM_TYPES)) > $@ +camel-enumtypes.c: $(top_srcdir)/enumtypes.c.template $(ENUM_TYPES) + $(AM_V_GEN) (cd $(srcdir) && $(GLIB_MKENUMS) --template $(top_srcdir)/enumtypes.c.template \ + --fhead "#include \"camel-enumtypes.h\"" \ + $(ENUM_TYPES)) > $@ ENUM_GENERATED = camel-enumtypes.h camel-enumtypes.c camel-imapx-tokenise.h @@ -419,8 +424,6 @@ BUILT_SOURCES = \ EXTRA_DIST = \ $(pkgconfig_in_files) \ - camel-enumtypes.h.template \ - camel-enumtypes.c.template \ camel-imapx-tokens.txt \ gentables.pl \ README diff --git a/camel/camel-enumtypes.c.template b/camel/camel-enumtypes.c.template deleted file mode 100644 index 5e749b2..0000000 --- a/camel/camel-enumtypes.c.template +++ /dev/null @@ -1,38 +0,0 @@ -/*** BEGIN file-header ***/ -#include "camel-enumtypes.h" - -/*** END file-header ***/ - -/*** BEGIN file-production ***/ -/* enumerations from "@filename@" */ -#include "@filename@" - -/*** 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[] = { -/*** END value-header ***/ - -/*** BEGIN value-production ***/ - { @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; -} - -/*** END value-tail ***/ diff --git a/camel/camel-enumtypes.h.template b/camel/camel-enumtypes.h.template deleted file mode 100644 index 3f34a13..0000000 --- a/camel/camel-enumtypes.h.template +++ /dev/null @@ -1,27 +0,0 @@ -/*** BEGIN file-header ***/ -#ifndef CAMEL_ENUMTYPES_H -#define CAMEL_ENUMTYPES_H - -#include - -G_BEGIN_DECLS - -/*** END file-header ***/ - -/*** BEGIN file-production ***/ -/* Enumerations from "@filename@" */ - -/*** END file-production ***/ - -/*** BEGIN enumeration-production ***/ -#define CAMEL_TYPE_@ENUMSHORT@ (@enum_name@_get_type()) -GType @enum_name@_get_type (void) G_GNUC_CONST; - -/*** END enumeration-production ***/ - -/*** BEGIN file-tail ***/ -G_END_DECLS - -#endif /* CAMEL_ENUMTYPES_H */ -/*** END file-tail ***/ - diff --git a/addressbook/libebook-contacts/e-book-contacts-enumtypes.c.template b/enumtypes.c.template similarity index 72% rename from addressbook/libebook-contacts/e-book-contacts-enumtypes.c.template rename to enumtypes.c.template index 127154b..0a99121 100644 --- a/addressbook/libebook-contacts/e-book-contacts-enumtypes.c.template +++ b/enumtypes.c.template @@ -1,6 +1,4 @@ /*** BEGIN file-header ***/ -#include "e-book-contacts-enumtypes.h" - /*** END file-header ***/ /*** BEGIN file-production ***/ @@ -13,9 +11,9 @@ GType @enum_name@_get_type (void) { - static GType the_type = 0; - - if (the_type == 0) { + static volatile gsize the_type__volatile = 0; + + if (g_once_init_enter (&the_type__volatile)) { static const G@Type@Value values[] = { /*** END value-header ***/ @@ -28,11 +26,12 @@ GType /*** BEGIN value-tail ***/ { 0, NULL, NULL } }; - the_type = g_@type@_register_static ( + GType the_type = g_@type@_register_static ( g_intern_static_string ("@EnumName@"), values); + g_once_init_leave (&the_type__volatile, the_type); } - return the_type; + return the_type__volatile; } /*** END value-tail ***/ diff --git a/calendar/libecal/e-cal-enumtypes.h.template b/enumtypes.h.template similarity index 74% rename from calendar/libecal/e-cal-enumtypes.h.template rename to enumtypes.h.template index ad99fe3..e421edd 100644 --- a/calendar/libecal/e-cal-enumtypes.h.template +++ b/enumtypes.h.template @@ -1,20 +1,18 @@ /*** BEGIN file-header ***/ -#ifndef E_CAL_ENUMTYPES_H -#define E_CAL_ENUMTYPES_H +/*** END file-header ***/ + +/*** BEGIN file-production ***/ #include G_BEGIN_DECLS -/*** END file-header ***/ - -/*** BEGIN file-production ***/ /* Enumerations from "@filename@" */ /*** END file-production ***/ /*** BEGIN enumeration-production ***/ -#define E_TYPE_@ENUMSHORT@ (@enum_name@_get_type()) +#define @ENUMPREFIX@_TYPE_@ENUMSHORT@ (@enum_name@_get_type()) GType @enum_name@_get_type (void) G_GNUC_CONST; /*** END enumeration-production ***/ @@ -22,6 +20,5 @@ GType @enum_name@_get_type (void) G_GNUC_CONST; /*** BEGIN file-tail ***/ G_END_DECLS -#endif /* E_CAL_ENUMTYPES_H */ /*** END file-tail ***/ diff --git a/libebackend/Makefile.am b/libebackend/Makefile.am index b6a2685..dac8a82 100644 --- a/libebackend/Makefile.am +++ b/libebackend/Makefile.am @@ -1,10 +1,15 @@ ENUM_TYPES = e-backend-enums.h -e-backend-enumtypes.h: e-backend-enumtypes.h.template $(ENUM_TYPES) - $(AM_V_GEN) (cd $(srcdir) && $(GLIB_MKENUMS) --template e-backend-enumtypes.h.template $(ENUM_TYPES)) > $@ +e-backend-enumtypes.h: $(top_srcdir)/enumtypes.h.template $(ENUM_TYPES) + $(AM_V_GEN) (cd $(srcdir) && $(GLIB_MKENUMS) --template $(top_srcdir)/enumtypes.h.template \ + --fhead "#ifndef E_BACKEND_ENUMTYPES_H\n#define E_BACKEND_ENUMTYPES_H\n" \ + --ftail "#endif /* E_BACKEND_ENUMTYPES_H */\n" \ + $(ENUM_TYPES)) > $@ -e-backend-enumtypes.c: e-backend-enumtypes.c.template $(ENUM_TYPES) - $(AM_V_GEN) (cd $(srcdir) && $(GLIB_MKENUMS) --template e-backend-enumtypes.c.template $(ENUM_TYPES)) > $@ +e-backend-enumtypes.c: $(top_srcdir)/enumtypes.c.template $(ENUM_TYPES) + $(AM_V_GEN) (cd $(srcdir) && $(GLIB_MKENUMS) --template $(top_srcdir)/enumtypes.c.template \ + --fhead "#include \"e-backend-enumtypes.h\"" \ + $(ENUM_TYPES)) > $@ ENUM_GENERATED = e-backend-enumtypes.h e-backend-enumtypes.c @@ -115,9 +120,7 @@ gsettings_SCHEMAS = \ EXTRA_DIST = \ $(gsettings_SCHEMAS) \ - $(pkgconfig_DATA:-$(API_VERSION).pc=.pc.in) \ - e-backend-enumtypes.h.template \ - e-backend-enumtypes.c.template + $(pkgconfig_DATA:-$(API_VERSION).pc=.pc.in) CLEANFILES = $(gsettings_SCHEMAS:.xml=.valid) diff --git a/libebackend/e-backend-enumtypes.c.template b/libebackend/e-backend-enumtypes.c.template deleted file mode 100644 index fbc6cab..0000000 --- a/libebackend/e-backend-enumtypes.c.template +++ /dev/null @@ -1,38 +0,0 @@ -/*** BEGIN file-header ***/ -#include "e-backend-enumtypes.h" - -/*** END file-header ***/ - -/*** BEGIN file-production ***/ -/* enumerations from "@filename@" */ -#include "@filename@" - -/*** 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[] = { -/*** END value-header ***/ - -/*** BEGIN value-production ***/ - { @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; -} - -/*** END value-tail ***/ diff --git a/libebackend/e-backend-enumtypes.h.template b/libebackend/e-backend-enumtypes.h.template deleted file mode 100644 index 78dfa80..0000000 --- a/libebackend/e-backend-enumtypes.h.template +++ /dev/null @@ -1,27 +0,0 @@ -/*** BEGIN file-header ***/ -#ifndef E_BACKEND_ENUMTYPES_H -#define E_BACKEND_ENUMTYPES_H - -#include - -G_BEGIN_DECLS - -/*** END file-header ***/ - -/*** BEGIN file-production ***/ -/* Enumerations from "@filename@" */ - -/*** END file-production ***/ - -/*** BEGIN enumeration-production ***/ -#define E_TYPE_@ENUMSHORT@ (@enum_name@_get_type()) -GType @enum_name@_get_type (void) G_GNUC_CONST; - -/*** END enumeration-production ***/ - -/*** BEGIN file-tail ***/ -G_END_DECLS - -#endif /* E_BACKEND_ENUMTYPES_H */ -/*** END file-tail ***/ - diff --git a/libedataserver/Makefile.am b/libedataserver/Makefile.am index 671571d..c601a50 100644 --- a/libedataserver/Makefile.am +++ b/libedataserver/Makefile.am @@ -1,10 +1,15 @@ ENUM_TYPES = e-source-enums.h -e-source-enumtypes.h: e-source-enumtypes.h.template $(ENUM_TYPES) - $(AM_V_GEN) (cd $(srcdir) && $(GLIB_MKENUMS) --template e-source-enumtypes.h.template $(ENUM_TYPES)) > $@ +e-source-enumtypes.h: $(top_srcdir)/enumtypes.h.template $(ENUM_TYPES) + $(AM_V_GEN) (cd $(srcdir) && $(GLIB_MKENUMS) --template $(top_srcdir)/enumtypes.h.template \ + --fhead "#ifndef E_SOURCE_ENUMTYPES_H\n#define E_SOURCE_ENUMTYPES_H\n" \ + --ftail "#endif /* E_SOURCE_ENUMTYPES_H */\n" \ + $(ENUM_TYPES)) > $@ -e-source-enumtypes.c: e-source-enumtypes.c.template $(ENUM_TYPES) - $(AM_V_GEN) (cd $(srcdir) && $(GLIB_MKENUMS) --template e-source-enumtypes.c.template $(ENUM_TYPES)) > $@ +e-source-enumtypes.c: $(top_srcdir)/enumtypes.c.template $(ENUM_TYPES) + $(AM_V_GEN) (cd $(srcdir) && $(GLIB_MKENUMS) --template $(top_srcdir)/enumtypes.c.template \ + --fhead "#include \"e-source-enumtypes.h\"" \ + $(ENUM_TYPES)) > $@ ENUM_GENERATED = e-source-enumtypes.h e-source-enumtypes.c @@ -181,8 +186,6 @@ convert_DATA = libedataserver.convert EXTRA_DIST = \ $(pkgconfig_DATA:-$(API_VERSION).pc=.pc.in) \ eds-version.h.in \ - e-source-enumtypes.h.template \ - e-source-enumtypes.c.template \ $(convert_DATA) \ $(gsettings_SCHEMAS:.xml=.xml.in) diff --git a/libedataserver/e-source-enumtypes.c.template b/libedataserver/e-source-enumtypes.c.template deleted file mode 100644 index b63fc8e..0000000 --- a/libedataserver/e-source-enumtypes.c.template +++ /dev/null @@ -1,38 +0,0 @@ -/*** BEGIN file-header ***/ -#include "e-source-enumtypes.h" - -/*** END file-header ***/ - -/*** BEGIN file-production ***/ -/* enumerations from "@filename@" */ -#include "@filename@" - -/*** 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[] = { -/*** END value-header ***/ - -/*** BEGIN value-production ***/ - { @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; -} - -/*** END value-tail ***/ diff --git a/libedataserver/e-source-enumtypes.h.template b/libedataserver/e-source-enumtypes.h.template deleted file mode 100644 index 3250c7f..0000000 --- a/libedataserver/e-source-enumtypes.h.template +++ /dev/null @@ -1,27 +0,0 @@ -/*** BEGIN file-header ***/ -#ifndef E_SOURCE_ENUMTYPES_H -#define E_SOURCE_ENUMTYPES_H - -#include - -G_BEGIN_DECLS - -/*** END file-header ***/ - -/*** BEGIN file-production ***/ -/* Enumerations from "@filename@" */ - -/*** END file-production ***/ - -/*** BEGIN enumeration-production ***/ -#define E_TYPE_@ENUMSHORT@ (@enum_name@_get_type()) -GType @enum_name@_get_type (void) G_GNUC_CONST; - -/*** END enumeration-production ***/ - -/*** BEGIN file-tail ***/ -G_END_DECLS - -#endif /* E_SOURCE_ENUMTYPES_H */ -/*** END file-tail ***/ - -- 2.7.4