Author: cazfi
Date: Thu Jan  1 09:25:02 2015
New Revision: 27468

URL: http://svn.gna.org/viewcvs/freeciv?rev=27468&view=rev
Log:
Made unit_owner() and unit_tile() macros to avoid function call overhead

See patch #5633

Modified:
    branches/S2_5/common/unit.c
    branches/S2_5/common/unit.h

Modified: branches/S2_5/common/unit.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_5/common/unit.c?rev=27468&r1=27467&r2=27468&view=diff
==============================================================================
--- branches/S2_5/common/unit.c (original)
+++ branches/S2_5/common/unit.c Thu Jan  1 09:25:02 2015
@@ -1630,32 +1630,12 @@
 }
 
 /**************************************************************************
-  Return the owner of the unit.
-**************************************************************************/
-struct player *unit_owner(const struct unit *punit)
-{
-  fc_assert_ret_val(NULL != punit, NULL);
-  fc_assert(NULL != punit->owner);
-  return punit->owner;
-}
-
-/**************************************************************************
   Return the nationality of the unit.
 **************************************************************************/
 struct player *unit_nationality(const struct unit *punit)
 {
   fc_assert_ret_val(NULL != punit, NULL);
   return punit->nationality;
-}
-
-/**************************************************************************
-  Return the tile location of the unit.
-  Not (yet) always used, mostly for debugging.
-**************************************************************************/
-struct tile *unit_tile(const struct unit *punit)
-{
-  fc_assert_ret_val(NULL != punit, NULL);
-  return punit->tile;
 }
 
 /*****************************************************************************

Modified: branches/S2_5/common/unit.h
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_5/common/unit.h?rev=27468&r1=27467&r2=27468&view=diff
==============================================================================
--- branches/S2_5/common/unit.h (original)
+++ branches/S2_5/common/unit.h Thu Jan  1 09:25:02 2015
@@ -340,9 +340,9 @@
 
 int get_transporter_capacity(const struct unit *punit);
 
-struct player *unit_owner(const struct unit *punit);
+#define unit_owner(_pu) ((_pu)->owner)
+#define unit_tile(_pu) ((_pu)->tile)
 struct player *unit_nationality(const struct unit *punit);
-struct tile *unit_tile(const struct unit *punit);
 void unit_tile_set(struct unit *punit, struct tile *ptile);
 
 struct unit *is_allied_unit_tile(const struct tile *ptile,


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

Reply via email to