[poppler] glib/poppler-document.cc glib/poppler-page.cc

Carlos Garcia Campos carlosgc at kemper.freedesktop.org
Tue Jun 15 08:45:41 PDT 2010


 glib/poppler-document.cc |   12 ++++++------
 glib/poppler-page.cc     |   17 ++++++++++-------
 2 files changed, 16 insertions(+), 13 deletions(-)

New commits:
commit 25494311c5b8eb88d43df420ec91a1aedad20d05
Author: Carlos Garcia Campos <carlosgc at gnome.org>
Date:   Tue Jun 15 17:44:23 2010 +0200

    [glib] Add some G_UNLIKELY()

diff --git a/glib/poppler-document.cc b/glib/poppler-document.cc
index 76a05a1..b265a34 100644
--- a/glib/poppler-document.cc
+++ b/glib/poppler-document.cc
@@ -1171,7 +1171,7 @@ poppler_index_iter_next (PopplerIndexIter *iter)
 void
 poppler_index_iter_free (PopplerIndexIter *iter)
 {
-	if (iter == NULL)
+	if (G_UNLIKELY (iter == NULL))
 		return;
 
 	g_object_unref (iter->document);
@@ -1305,7 +1305,7 @@ poppler_fonts_iter_copy (PopplerFontsIter *iter)
 void
 poppler_fonts_iter_free (PopplerFontsIter *iter)
 {
-	if (iter == NULL)
+	if (G_UNLIKELY (iter == NULL))
 		return;
 
 	deleteGooList (iter->items, FontInfo);
@@ -1424,7 +1424,7 @@ layer_new (OptionalContentGroup *oc)
 static void
 layer_free (Layer *layer)
 {
-  if (!layer)
+  if (G_UNLIKELY (!layer))
     return;
 
   if (layer->kids) {
@@ -1589,8 +1589,8 @@ _poppler_document_get_layers (PopplerDocument *document)
 static void
 poppler_document_layers_free (PopplerDocument *document)
 {
-  if (!document->layers)
-	  return;
+  if (G_UNLIKELY (!document->layers))
+    return;
 
   g_list_foreach (document->layers, (GFunc)layer_free, NULL);
   g_list_free (document->layers);
@@ -1644,7 +1644,7 @@ poppler_layers_iter_copy (PopplerLayersIter *iter)
 void
 poppler_layers_iter_free (PopplerLayersIter *iter)
 {
-  if (iter == NULL)
+  if (G_UNLIKELY (iter == NULL))
     return;
 
   g_object_unref (iter->document);
diff --git a/glib/poppler-page.cc b/glib/poppler-page.cc
index 14601a6..19ea941 100644
--- a/glib/poppler-page.cc
+++ b/glib/poppler-page.cc
@@ -891,7 +891,7 @@ poppler_page_get_selection_region (PopplerPage           *page,
 void
 poppler_page_selection_region_free (GList *region)
 {
-  if (!region)
+  if (G_UNLIKELY (!region))
     return;
 
   g_list_foreach (region, (GFunc)poppler_rectangle_free, NULL);
@@ -1137,7 +1137,7 @@ poppler_page_get_image (PopplerPage *page,
 void
 poppler_page_free_image_mapping (GList *list)
 {
-  if (list == NULL)
+  if (G_UNLIKELY (list == NULL))
     return;
 
   g_list_foreach (list, (GFunc)poppler_image_mapping_free, NULL);
@@ -1317,7 +1317,7 @@ poppler_page_get_link_mapping (PopplerPage *page)
 void
 poppler_page_free_link_mapping (GList *list)
 {
-  if (list == NULL)
+  if (G_UNLIKELY (list == NULL))
     return;
 
   g_list_foreach (list, (GFunc)poppler_link_mapping_free, NULL);
@@ -1380,7 +1380,7 @@ poppler_page_get_form_field_mapping (PopplerPage *page)
 void
 poppler_page_free_form_field_mapping (GList *list)
 {
-  if (list == NULL)
+  if (G_UNLIKELY (list == NULL))
     return;
 
   g_list_foreach (list, (GFunc) poppler_form_field_mapping_free, NULL);
@@ -1507,7 +1507,7 @@ poppler_page_get_annot_mapping (PopplerPage *page)
 void
 poppler_page_free_annot_mapping (GList *list)
 {
-  if (!list)
+  if (G_UNLIKELY (!list))
     return;
 
   g_list_foreach (list, (GFunc)poppler_annot_mapping_free, NULL);
@@ -1593,6 +1593,9 @@ poppler_link_mapping_copy (PopplerLinkMapping *mapping)
 void
 poppler_link_mapping_free (PopplerLinkMapping *mapping)
 {
+  if (G_UNLIKELY (!mapping))
+    return;
+
   if (mapping->action)
     poppler_action_free (mapping->action);
 
@@ -1677,7 +1680,7 @@ poppler_form_field_mapping_copy (PopplerFormFieldMapping *mapping)
 void
 poppler_form_field_mapping_free (PopplerFormFieldMapping *mapping)
 {
-  if (!mapping)
+  if (G_UNLIKELY (!mapping))
     return;
 
   if (mapping->field)
@@ -1713,7 +1716,7 @@ poppler_annot_mapping_copy (PopplerAnnotMapping *mapping)
 void
 poppler_annot_mapping_free (PopplerAnnotMapping *mapping)
 {
-  if (!mapping)
+  if (G_UNLIKELY (!mapping))
     return;
 
   if (mapping->annot)


More information about the poppler mailing list