[poppler] 2 commits - glib/poppler-action.cc glib/poppler-annot.cc glib/poppler-document.cc glib/poppler-enums.c.template glib/poppler-page.cc glib/poppler-private.h glib/poppler-structure-element.cc

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Mar 26 18:19:47 UTC 2021


 glib/poppler-action.cc            |    4 ++--
 glib/poppler-annot.cc             |    2 +-
 glib/poppler-document.cc          |    6 +++---
 glib/poppler-enums.c.template     |   10 +++++-----
 glib/poppler-page.cc              |   20 ++++++++++----------
 glib/poppler-private.h            |   15 ---------------
 glib/poppler-structure-element.cc |    4 ++--
 7 files changed, 23 insertions(+), 38 deletions(-)

New commits:
commit bdd110b45a38e8a4f80f522892e4c4a9e432abd5
Author: Christian Persch <chpe at src.gnome.org>
Date:   Fri Mar 26 18:17:25 2021 +0100

    glib: Remove incorrecly used volatile from enum type registration code

diff --git a/glib/poppler-enums.c.template b/glib/poppler-enums.c.template
index 26a51b4c..eefc7697 100644
--- a/glib/poppler-enums.c.template
+++ b/glib/poppler-enums.c.template
@@ -15,9 +15,9 @@
 GType
 @enum_name at _get_type (void)
 {
-  static volatile gsize g_define_type_id__volatile = 0;
+  static volatile gsize g_define_type_id = 0;
  
-  if (g_once_init_enter (&g_define_type_id__volatile)) {
+  if (g_once_init_enter (&g_define_type_id)) {
     static const G at Type@Value values[] = {
 /*** END value-header ***/
 
@@ -28,13 +28,13 @@ GType
 /*** BEGIN value-tail ***/
       { 0, NULL, NULL }
     };
-    GType g_define_type_id = 
+    GType type =
        g_ at type@_register_static (g_intern_static_string ("@EnumName@"), values);
       
-    g_once_init_leave (&g_define_type_id__volatile, g_define_type_id);
+    g_once_init_leave (&g_define_type_id, type);
   }
     
-  return g_define_type_id__volatile;
+  return g_define_type_id;
 }
 
 /*** END value-tail ***/
commit 47de887d7658cfd68df44b3acf710971054f957b
Author: Christian Persch <chpe at src.gnome.org>
Date:   Fri Mar 26 18:17:25 2021 +0100

    glib: Use stock glib macro to define boxed type
    
    Poppler already depends on a sufficiently new glib version, so we can
    simply use G_DEFINE_BOXED_TYPE instead of defining our own macro.

diff --git a/glib/poppler-action.cc b/glib/poppler-action.cc
index d395db79..b772a3c2 100644
--- a/glib/poppler-action.cc
+++ b/glib/poppler-action.cc
@@ -25,7 +25,7 @@
  * @title: PopplerAction
  */
 
-POPPLER_DEFINE_BOXED_TYPE(PopplerDest, poppler_dest, poppler_dest_copy, poppler_dest_free)
+G_DEFINE_BOXED_TYPE(PopplerDest, poppler_dest, poppler_dest_copy, poppler_dest_free)
 
 /**
  * poppler_dest_copy:
@@ -88,7 +88,7 @@ static PopplerActionLayer *poppler_action_layer_copy(PopplerActionLayer *action_
     return retval;
 }
 
-POPPLER_DEFINE_BOXED_TYPE(PopplerAction, poppler_action, poppler_action_copy, poppler_action_free)
+G_DEFINE_BOXED_TYPE(PopplerAction, poppler_action, poppler_action_copy, poppler_action_free)
 
 /**
  * poppler_action_free:
diff --git a/glib/poppler-annot.cc b/glib/poppler-annot.cc
index f4c5bb1f..53205658 100644
--- a/glib/poppler-annot.cc
+++ b/glib/poppler-annot.cc
@@ -1693,7 +1693,7 @@ gchar *poppler_annot_file_attachment_get_name(PopplerAnnotFileAttachment *popple
 }
 
 /* PopplerAnnotCalloutLine */
-POPPLER_DEFINE_BOXED_TYPE(PopplerAnnotCalloutLine, poppler_annot_callout_line, poppler_annot_callout_line_copy, poppler_annot_callout_line_free)
+G_DEFINE_BOXED_TYPE(PopplerAnnotCalloutLine, poppler_annot_callout_line, poppler_annot_callout_line_copy, poppler_annot_callout_line_free)
 
 /**
  * poppler_annot_callout_line_new:
diff --git a/glib/poppler-document.cc b/glib/poppler-document.cc
index e8dfe137..eafe9b63 100644
--- a/glib/poppler-document.cc
+++ b/glib/poppler-document.cc
@@ -2360,7 +2360,7 @@ struct _PopplerIndexIter
     int index;
 };
 
-POPPLER_DEFINE_BOXED_TYPE(PopplerIndexIter, poppler_index_iter, poppler_index_iter_copy, poppler_index_iter_free)
+G_DEFINE_BOXED_TYPE(PopplerIndexIter, poppler_index_iter, poppler_index_iter_copy, poppler_index_iter_free)
 
 /**
  * poppler_index_iter_copy:
@@ -2579,7 +2579,7 @@ struct _PopplerFontsIter
     int index;
 };
 
-POPPLER_DEFINE_BOXED_TYPE(PopplerFontsIter, poppler_fonts_iter, poppler_fonts_iter_copy, poppler_fonts_iter_free)
+G_DEFINE_BOXED_TYPE(PopplerFontsIter, poppler_fonts_iter, poppler_fonts_iter_copy, poppler_fonts_iter_free)
 
 /**
  * poppler_fonts_iter_get_full_name:
@@ -3111,7 +3111,7 @@ struct _PopplerLayersIter
     int index;
 };
 
-POPPLER_DEFINE_BOXED_TYPE(PopplerLayersIter, poppler_layers_iter, poppler_layers_iter_copy, poppler_layers_iter_free)
+G_DEFINE_BOXED_TYPE(PopplerLayersIter, poppler_layers_iter, poppler_layers_iter_copy, poppler_layers_iter_free)
 
 /**
  * poppler_layers_iter_copy:
diff --git a/glib/poppler-page.cc b/glib/poppler-page.cc
index 75c39c12..3332a9eb 100644
--- a/glib/poppler-page.cc
+++ b/glib/poppler-page.cc
@@ -1563,7 +1563,7 @@ void poppler_page_remove_annot(PopplerPage *page, PopplerAnnot *annot)
 
 /* PopplerRectangle type */
 
-POPPLER_DEFINE_BOXED_TYPE(PopplerRectangle, poppler_rectangle, poppler_rectangle_copy, poppler_rectangle_free)
+G_DEFINE_BOXED_TYPE(PopplerRectangle, poppler_rectangle, poppler_rectangle_copy, poppler_rectangle_free)
 
 /**
  * poppler_rectangle_new:
@@ -1605,7 +1605,7 @@ void poppler_rectangle_free(PopplerRectangle *rectangle)
 
 /* PopplerPoint type */
 
-POPPLER_DEFINE_BOXED_TYPE(PopplerPoint, poppler_point, poppler_point_copy, poppler_point_free)
+G_DEFINE_BOXED_TYPE(PopplerPoint, poppler_point, poppler_point_copy, poppler_point_free)
 
 /**
  * poppler_point_new:
@@ -1654,7 +1654,7 @@ void poppler_point_free(PopplerPoint *point)
 
 /* PopplerQuadrilateral type */
 
-POPPLER_DEFINE_BOXED_TYPE(PopplerQuadrilateral, poppler_quadrilateral, poppler_quadrilateral_copy, poppler_quadrilateral_free)
+G_DEFINE_BOXED_TYPE(PopplerQuadrilateral, poppler_quadrilateral, poppler_quadrilateral_copy, poppler_quadrilateral_free)
 
 /**
  * poppler_quadrilateral_new:
@@ -1702,7 +1702,7 @@ void poppler_quadrilateral_free(PopplerQuadrilateral *quad)
 
 /* PopplerTextAttributes type */
 
-POPPLER_DEFINE_BOXED_TYPE(PopplerTextAttributes, poppler_text_attributes, poppler_text_attributes_copy, poppler_text_attributes_free)
+G_DEFINE_BOXED_TYPE(PopplerTextAttributes, poppler_text_attributes, poppler_text_attributes_copy, poppler_text_attributes_free)
 
 /**
  * poppler_text_attributes_new:
@@ -1801,7 +1801,7 @@ void poppler_text_attributes_free(PopplerTextAttributes *text_attrs)
  */
 
 /* PopplerColor type */
-POPPLER_DEFINE_BOXED_TYPE(PopplerColor, poppler_color, poppler_color_copy, poppler_color_free)
+G_DEFINE_BOXED_TYPE(PopplerColor, poppler_color, poppler_color_copy, poppler_color_free)
 
 /**
  * poppler_color_new:
@@ -1845,7 +1845,7 @@ void poppler_color_free(PopplerColor *color)
 }
 
 /* PopplerLinkMapping type */
-POPPLER_DEFINE_BOXED_TYPE(PopplerLinkMapping, poppler_link_mapping, poppler_link_mapping_copy, poppler_link_mapping_free)
+G_DEFINE_BOXED_TYPE(PopplerLinkMapping, poppler_link_mapping, poppler_link_mapping_copy, poppler_link_mapping_free)
 
 /**
  * poppler_link_mapping_new:
@@ -1897,7 +1897,7 @@ void poppler_link_mapping_free(PopplerLinkMapping *mapping)
 }
 
 /* Poppler Image mapping type */
-POPPLER_DEFINE_BOXED_TYPE(PopplerImageMapping, poppler_image_mapping, poppler_image_mapping_copy, poppler_image_mapping_free)
+G_DEFINE_BOXED_TYPE(PopplerImageMapping, poppler_image_mapping, poppler_image_mapping_copy, poppler_image_mapping_free)
 
 /**
  * poppler_image_mapping_new:
@@ -1936,7 +1936,7 @@ void poppler_image_mapping_free(PopplerImageMapping *mapping)
 }
 
 /* Page Transition */
-POPPLER_DEFINE_BOXED_TYPE(PopplerPageTransition, poppler_page_transition, poppler_page_transition_copy, poppler_page_transition_free)
+G_DEFINE_BOXED_TYPE(PopplerPageTransition, poppler_page_transition, poppler_page_transition_copy, poppler_page_transition_free)
 
 /**
  * poppler_page_transition_new:
@@ -1980,7 +1980,7 @@ void poppler_page_transition_free(PopplerPageTransition *transition)
 }
 
 /* Form Field Mapping Type */
-POPPLER_DEFINE_BOXED_TYPE(PopplerFormFieldMapping, poppler_form_field_mapping, poppler_form_field_mapping_copy, poppler_form_field_mapping_free)
+G_DEFINE_BOXED_TYPE(PopplerFormFieldMapping, poppler_form_field_mapping, poppler_form_field_mapping_copy, poppler_form_field_mapping_free)
 
 /**
  * poppler_form_field_mapping_new:
@@ -2032,7 +2032,7 @@ void poppler_form_field_mapping_free(PopplerFormFieldMapping *mapping)
 }
 
 /* PopplerAnnot Mapping Type */
-POPPLER_DEFINE_BOXED_TYPE(PopplerAnnotMapping, poppler_annot_mapping, poppler_annot_mapping_copy, poppler_annot_mapping_free)
+G_DEFINE_BOXED_TYPE(PopplerAnnotMapping, poppler_annot_mapping, poppler_annot_mapping_copy, poppler_annot_mapping_free)
 
 /**
  * poppler_annot_mapping_new:
diff --git a/glib/poppler-private.h b/glib/poppler-private.h
index d41b59c6..10272716 100644
--- a/glib/poppler-private.h
+++ b/glib/poppler-private.h
@@ -143,21 +143,6 @@ gboolean _poppler_convert_pdf_date_to_gtime(const GooString *date, time_t *gdate
 GDateTime *_poppler_convert_pdf_date_to_date_time(const GooString *date);
 GooString *_poppler_convert_date_time_to_pdf_date(GDateTime *datetime);
 
-/*
- * A convenience macro for boxed type implementations, which defines a
- * type_name_get_type() function registering the boxed type.
- */
-#define POPPLER_DEFINE_BOXED_TYPE(TypeName, type_name, copy_func, free_func)                                                                                                                                                                   \
-    GType type_name##_get_type(void)                                                                                                                                                                                                           \
-    {                                                                                                                                                                                                                                          \
-        static volatile gsize g_define_type_id__volatile = 0;                                                                                                                                                                                  \
-        if (g_once_init_enter(&g_define_type_id__volatile)) {                                                                                                                                                                                  \
-            GType g_define_type_id = g_boxed_type_register_static(g_intern_static_string(#TypeName), (GBoxedCopyFunc)copy_func, (GBoxedFreeFunc)free_func);                                                                                    \
-            g_once_init_leave(&g_define_type_id__volatile, g_define_type_id);                                                                                                                                                                  \
-        }                                                                                                                                                                                                                                      \
-        return g_define_type_id__volatile;                                                                                                                                                                                                     \
-    }
-
 void _poppler_error_cb(ErrorCategory category, Goffset pos, const char *message);
 
 #endif
diff --git a/glib/poppler-structure-element.cc b/glib/poppler-structure-element.cc
index aec7cd15..29d3e5ca 100644
--- a/glib/poppler-structure-element.cc
+++ b/glib/poppler-structure-element.cc
@@ -581,7 +581,7 @@ struct _PopplerStructureElementIter
     unsigned index;
 };
 
-POPPLER_DEFINE_BOXED_TYPE(PopplerStructureElementIter, poppler_structure_element_iter, poppler_structure_element_iter_copy, poppler_structure_element_iter_free)
+G_DEFINE_BOXED_TYPE(PopplerStructureElementIter, poppler_structure_element_iter, poppler_structure_element_iter_copy, poppler_structure_element_iter_free)
 
 /**
  * poppler_structure_element_iter_copy:
@@ -763,7 +763,7 @@ struct _PopplerTextSpan
     PopplerColor color;
 };
 
-POPPLER_DEFINE_BOXED_TYPE(PopplerTextSpan, poppler_text_span, poppler_text_span_copy, poppler_text_span_free)
+G_DEFINE_BOXED_TYPE(PopplerTextSpan, poppler_text_span, poppler_text_span_copy, poppler_text_span_free)
 
 enum
 {


More information about the poppler mailing list