Author: cazfi
Date: Sun Sep 13 08:49:47 2015
New Revision: 29869

URL: http://svn.gna.org/viewcvs/freeciv?rev=29869&view=rev
Log:
Turned genlist_head() to an inline function.

See patch #6342

Modified:
    branches/S2_6/utility/genlist.c
    branches/S2_6/utility/genlist.h

Modified: branches/S2_6/utility/genlist.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/utility/genlist.c?rev=29869&r1=29868&r2=29869&view=diff
==============================================================================
--- branches/S2_6/utility/genlist.c     (original)
+++ branches/S2_6/utility/genlist.c     Sun Sep 13 08:49:47 2015
@@ -31,18 +31,6 @@
   struct genlist_link *next, *prev;
   void *dataptr;
 };
-
-/* A genlist, storing the number of elements (for quick retrieval and
- * testing for empty lists), and pointers to the first and last elements
- * of the list. */
-struct genlist {
-  int nelements;
-  fc_mutex mutex;
-  struct genlist_link *head_link;
-  struct genlist_link *tail_link;
-  genlist_free_fn_t free_data_func;
-};
-
 
 /****************************************************************************
   Create a new empty genlist.
@@ -223,14 +211,6 @@
 {
   fc_assert_ret_val(NULL != pgenlist, NULL);
   return genlist_link_at_pos(pgenlist, idx);
-}
-
-/****************************************************************************
-  Returns the head link of the genlist.
-****************************************************************************/
-struct genlist_link *genlist_head(const struct genlist *pgenlist)
-{
-  return (NULL != pgenlist ? pgenlist->head_link : NULL);
 }
 
 /****************************************************************************

Modified: branches/S2_6/utility/genlist.h
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/utility/genlist.h?rev=29869&r1=29868&r2=29869&view=diff
==============================================================================
--- branches/S2_6/utility/genlist.h     (original)
+++ branches/S2_6/utility/genlist.h     Sun Sep 13 08:49:47 2015
@@ -40,13 +40,14 @@
   See also the speclist module.
 ****************************************************************************/
 
+/* utility */
+#include "fcthread.h"
 #include "support.h"    /* bool, fc__warn_unused_result */
 
 /* A single element of a genlist, opaque type. */
 struct genlist_link;
 
-/* A genlist, opaque type. */
-struct genlist;
+struct genlist_link;
 
 /* Function type definitions. */
 typedef void (*genlist_free_fn_t) (void *);
@@ -54,6 +55,17 @@
 typedef bool (*genlist_cond_fn_t) (const void *);
 typedef bool (*genlist_comp_fn_t) (const void *, const void *);
 
+/* A genlist, storing the number of elements (for quick retrieval and
+ * testing for empty lists), and pointers to the first and last elements
+ * of the list. */
+struct genlist {
+  int nelements;
+  fc_mutex mutex;
+  struct genlist_link *head_link;
+  struct genlist_link *tail_link;
+  genlist_free_fn_t free_data_func;
+};
+  
 struct genlist *genlist_new(void) fc__warn_unused_result;
 struct genlist *genlist_new_full(genlist_free_fn_t free_data_func)
                 fc__warn_unused_result;
@@ -95,7 +107,10 @@
 void *genlist_front(const struct genlist *pgenlist);
 void *genlist_back(const struct genlist *pgenlist);
 struct genlist_link *genlist_link(const struct genlist *pgenlist, int idx);
-struct genlist_link *genlist_head(const struct genlist *pgenlist);
+inline struct genlist_link *genlist_head(const struct genlist *pgenlist)
+{
+  return (NULL != pgenlist ? pgenlist->head_link : NULL);
+}
 struct genlist_link *genlist_tail(const struct genlist *pgenlist);
 
 struct genlist_link *genlist_search(const struct genlist *pgenlist,


_______________________________________________
Freeciv-commits mailing list
Freeciv-commits@gna.org
https://mail.gna.org/listinfo/freeciv-commits

Reply via email to