[babl] made babl_list_size babl_list_get_first and babl_list_get_last macros.



commit 5af15f8d386a86a0236a8c9e6e118f62fa57f9f7
Author: �yvind Kolås <pippin gimp org>
Date:   Thu Nov 26 18:45:41 2009 +0000

    made babl_list_size babl_list_get_first and babl_list_get_last macros.
    
    Thereby forcing inlining to gain performance critical code where the
    overhead of additional function calls matter.

 babl/babl-list.c |   26 --------------------------
 babl/babl-list.h |    8 +++-----
 2 files changed, 3 insertions(+), 31 deletions(-)
---
diff --git a/babl/babl-list.c b/babl/babl-list.c
index de254b1..2cf1251 100644
--- a/babl/babl-list.c
+++ b/babl/babl-list.c
@@ -60,14 +60,6 @@ babl_list_destroy (BablList *list)
     babl_free (list);
 }
 
-int
-babl_list_size (BablList *list)
-{
-    babl_assert (list);
-
-    return list->count;
-}
-
 void
 babl_list_insert_last (BablList *list,
                        Babl     *item)
@@ -97,24 +89,6 @@ babl_list_remove_last (BablList *list)
   list->count--;
 }
 
-Babl *
-babl_list_get_first (BablList *list)
-{
-  babl_assert (list);
-  babl_assert (list->count > 0);
-
-  return (list->items[0]);
-}
-
-Babl *
-babl_list_get_last (BablList *list)
-{
-  babl_assert (list);
-  babl_assert (list->count > 0);
-
-  return (list->items[list->count - 1]);
-}
-
 void
 babl_list_copy (BablList *from,
                 BablList *to)
diff --git a/babl/babl-list.h b/babl/babl-list.h
index a339b1c..c9c64e8 100644
--- a/babl/babl-list.h
+++ b/babl/babl-list.h
@@ -49,11 +49,9 @@ babl_list_insert_last (BablList *list,
 void
 babl_list_remove_last (BablList *list);
 
-Babl *
-babl_list_get_first (BablList *list);
-
-Babl *
-babl_list_get_last (BablList *list);
+#define babl_list_get_first(list) (list->items[0])
+#define babl_list_get_last(list)  (list->items[list->count-1])
+#define babl_list_size(list)      (list->count)
 
 void
 babl_list_copy (BablList *from,



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