Author: cazfi
Date: Tue May 17 00:51:23 2016
New Revision: 32730

URL: http://svn.gna.org/viewcvs/freeciv?rev=32730&view=rev
Log:
Inlined some of the most often called short functions that were not yet inlined.

See patch #7202

Modified:
    branches/S2_5/common/road.c
    branches/S2_5/common/road.h
    branches/S2_5/common/tile.c
    branches/S2_5/common/tile.h

Modified: branches/S2_5/common/road.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_5/common/road.c?rev=32730&r1=32729&r2=32730&view=diff
==============================================================================
--- branches/S2_5/common/road.c (original)
+++ branches/S2_5/common/road.c Tue May 17 00:51:23 2016
@@ -177,15 +177,6 @@
   } road_type_iterate_end;
 
   return NULL;
-}
-
-/****************************************************************************
-  Is road native to unit class?
-****************************************************************************/
-bool is_native_road_to_uclass(const struct road_type *proad,
-                              const struct unit_class *pclass)
-{
-  return BV_ISSET(proad->native_to, uclass_index(pclass));
 }
 
 /****************************************************************************

Modified: branches/S2_5/common/road.h
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_5/common/road.h?rev=32730&r1=32729&r2=32730&view=diff
==============================================================================
--- branches/S2_5/common/road.h (original)
+++ branches/S2_5/common/road.h Tue May 17 00:51:23 2016
@@ -1,4 +1,4 @@
-/********************************************************************** 
+/***********************************************************************
  Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -130,8 +130,11 @@
 
 bool road_has_flag(const struct road_type *proad, enum road_flag_id flag);
 
-bool is_native_road_to_uclass(const struct road_type *proad,
-                              const struct unit_class *pclass);
+static inline bool is_native_road_to_uclass(const struct road_type *proad,
+                                            const struct unit_class *pclass)
+{
+  return BV_ISSET(proad->native_to, uclass_index(pclass));
+}
 
 bool road_can_be_built(const struct road_type *proad, const struct tile 
*ptile);
 bool can_build_road(const struct road_type *proad,

Modified: branches/S2_5/common/tile.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_5/common/tile.c?rev=32730&r1=32729&r2=32730&view=diff
==============================================================================
--- branches/S2_5/common/tile.c (original)
+++ branches/S2_5/common/tile.c Tue May 17 00:51:23 2016
@@ -1,4 +1,4 @@
-/********************************************************************** 
+/***********************************************************************
  Freeciv - Copyright (C) 2005 - The Freeciv Project
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -894,14 +894,6 @@
 }
 
 /****************************************************************************
-  Returns TRUE if the given tile has a road of given type on it.
-****************************************************************************/
-bool tile_has_road(const struct tile *ptile, const struct road_type *proad)
-{
-  return BV_ISSET(ptile->roads, road_index(proad));
-}
-
-/****************************************************************************
   Tile has any river type
 ****************************************************************************/
 bool tile_has_river(const struct tile *ptile)

Modified: branches/S2_5/common/tile.h
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_5/common/tile.h?rev=32730&r1=32729&r2=32730&view=diff
==============================================================================
--- branches/S2_5/common/tile.h (original)
+++ branches/S2_5/common/tile.h Tue May 17 00:51:23 2016
@@ -1,4 +1,4 @@
-/********************************************************************** 
+/***********************************************************************
  Freeciv - Copyright (C) 2005 - The Freeciv Project
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -141,7 +141,15 @@
 int tile_extras_class_defense_bonus(const struct tile *ptile,
                                     const struct unit_class *pclass);
 
-bool tile_has_road(const struct tile *ptile, const struct road_type *proad);
+/****************************************************************************
+  Returns TRUE if the given tile has a road of given type on it.
+****************************************************************************/
+static inline bool tile_has_road(const struct tile *ptile,
+                                 const struct road_type *proad)
+{
+  return BV_ISSET(ptile->roads, road_index(proad));
+}
+
 void tile_add_road(struct tile *ptile, const struct road_type *proad);
 void tile_remove_road(struct tile *ptile, const struct road_type *proad);
 int tile_roads_output_incr(const struct tile *ptile, enum output_type_id o);


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

Reply via email to