Author: cazfi
Date: Wed Feb 24 15:14:31 2016
New Revision: 32068

URL: http://svn.gna.org/viewcvs/freeciv?rev=32068&view=rev
Log:
Inlined functions to navigate genlist

See patch #6992

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

Modified: branches/S2_5/utility/genlist.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_5/utility/genlist.c?rev=32068&r1=32067&r2=32068&view=diff
==============================================================================
--- branches/S2_5/utility/genlist.c     (original)
+++ branches/S2_5/utility/genlist.c     Wed Feb 24 15:14:31 2016
@@ -24,13 +24,6 @@
 #include "shared.h"  /* array_shuffle */
 
 #include "genlist.h"
-
-/* A single element of a genlist, storing the pointer to user
- * data, and pointers to the next and previous elements: */
-struct genlist_link {
-  struct genlist_link *next, *prev;
-  void *dataptr;
-};
 
 /****************************************************************************
   Create a new empty genlist.
@@ -698,27 +691,3 @@
 {
   fc_release_mutex(&pgenlist->mutex);
 }
-
-/****************************************************************************
-  Returns the pointer of this link.
-****************************************************************************/
-void *genlist_link_data(const struct genlist_link *plink)
-{
-  return (NULL != plink ? plink->dataptr : NULL);
-}
-
-/****************************************************************************
-  Returns the previous link.
-****************************************************************************/
-struct genlist_link *genlist_link_prev(const struct genlist_link *plink)
-{
-  return plink->prev;
-}
-
-/****************************************************************************
-  Returns the next link.
-****************************************************************************/
-struct genlist_link *genlist_link_next(const struct genlist_link *plink)
-{
-  return plink->next;
-}

Modified: branches/S2_5/utility/genlist.h
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_5/utility/genlist.h?rev=32068&r1=32067&r2=32068&view=diff
==============================================================================
--- branches/S2_5/utility/genlist.h     (original)
+++ branches/S2_5/utility/genlist.h     Wed Feb 24 15:14:31 2016
@@ -124,12 +124,40 @@
 void genlist_allocate_mutex(struct genlist *pgenlist);
 void genlist_release_mutex(struct genlist *pgenlist);
 
-void *genlist_link_data(const struct genlist_link *plink);
-struct genlist_link *genlist_link_prev(const struct genlist_link *plink)
-                     fc__warn_unused_result;
-struct genlist_link *genlist_link_next(const struct genlist_link *plink)
-                     fc__warn_unused_result;
 
+/* A single element of a genlist, storing the pointer to user
+ * data, and pointers to the next and previous elements: */
+struct genlist_link {
+  struct genlist_link *next, *prev;
+  void *dataptr;
+};
+
+/****************************************************************************
+  Returns the pointer of this link.
+****************************************************************************/
+static inline void *genlist_link_data(const struct genlist_link *plink)
+{
+  return (NULL != plink ? plink->dataptr : NULL);
+}
+
+/****************************************************************************
+  Returns the previous link.
+****************************************************************************/
+fc__warn_unused_result
+static inline struct genlist_link *genlist_link_prev(const struct genlist_link 
*plink)
+{
+  return plink->prev;
+}
+
+/****************************************************************************
+  Returns the next link.
+****************************************************************************/
+fc__warn_unused_result
+static inline struct genlist_link *genlist_link_next(const struct genlist_link 
*plink)
+{
+  return plink->next;
+}
+  
 #ifdef __cplusplus
 }
 #endif /* __cplusplus */


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

Reply via email to