Author: cazfi
Date: Mon Aug 17 17:14:21 2015
New Revision: 29572

URL: http://svn.gna.org/viewcvs/freeciv?rev=29572&view=rev
Log:
Fixed Shadow warnings from utility/ and common/ code

See patch #6174

Modified:
    branches/S2_5/common/aicore/citymap.c
    branches/S2_5/common/aicore/cm.c
    branches/S2_5/common/city.c
    branches/S2_5/common/diptreaty.c
    branches/S2_5/common/effects.c
    branches/S2_5/common/map.c
    branches/S2_5/common/map.h
    branches/S2_5/common/player.c
    branches/S2_5/common/player.h
    branches/S2_5/common/road.h
    branches/S2_5/common/specialist.c
    branches/S2_5/common/specialist.h
    branches/S2_5/utility/ioz.c
    branches/S2_5/utility/registry_ini.c
    branches/S2_5/utility/specvec.h

Modified: branches/S2_5/common/aicore/citymap.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_5/common/aicore/citymap.c?rev=29572&r1=29571&r2=29572&view=diff
==============================================================================
--- branches/S2_5/common/aicore/citymap.c       (original)
+++ branches/S2_5/common/aicore/citymap.c       Mon Aug 17 17:14:21 2015
@@ -66,8 +66,8 @@
   citymap = fc_realloc(citymap, MAP_INDEX_SIZE * sizeof(*citymap));
   memset(citymap, 0, MAP_INDEX_SIZE * sizeof(*citymap));
 
-  players_iterate(pplayer) {
-    city_list_iterate(pplayer->cities, pcity) {
+  players_iterate(pother) {
+    city_list_iterate(pother->cities, pcity) {
       struct tile *pcenter = city_tile(pcity);
 
       /* reserve at least the default (squared) city radius */

Modified: branches/S2_5/common/aicore/cm.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_5/common/aicore/cm.c?rev=29572&r1=29571&r2=29572&view=diff
==============================================================================
--- branches/S2_5/common/aicore/cm.c    (original)
+++ branches/S2_5/common/aicore/cm.c    Mon Aug 17 17:14:21 2015
@@ -667,7 +667,7 @@
                            const struct partial_solution *soln)
 {
   struct city *pcity = state->pcity;
-  int i, citizens = 0, city_radius_sq = city_map_radius_sq_get(pcity);
+  int i, citizen_count = 0, city_radius_sq = city_map_radius_sq_get(pcity);
 
 #ifdef GATHER_TIME_STATS
   performance.current->apply_count++;
@@ -698,7 +698,7 @@
       /* No citizens of this type. */
       continue;
     }
-    citizens += nworkers;
+    citizen_count += nworkers;
 
     type = tile_type_get(state, i);
 
@@ -719,7 +719,7 @@
 
   /* Finally we must refresh the city to reset all the precomputed fields. */
   city_refresh_from_main_map(pcity, state->workers_map);
-  fc_assert_ret(citizens == city_size_get(pcity));
+  fc_assert_ret(citizen_count == city_size_get(pcity));
 }
 
 /****************************************************************************
@@ -1512,17 +1512,17 @@
 static int specialists_in_solution(const struct cm_state *state,
                                    const struct partial_solution *soln)
 {
-  int specialists = 0;
+  int count = 0;
   int i;
 
   for (i = 0 ; i < num_types(state); i++) {
     if (soln->worker_counts[i] > 0 && tile_type_get(state, i)->is_specialist) {
-      specialists += soln->worker_counts[i];
-    }
-  }
-  return specialists;
-}
-
+      count += soln->worker_counts[i];
+    }
+  }
+
+  return count;
+}
 
 /****************************************************************************
   The heuristic:

Modified: branches/S2_5/common/city.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_5/common/city.c?rev=29572&r1=29571&r2=29572&view=diff
==============================================================================
--- branches/S2_5/common/city.c (original)
+++ branches/S2_5/common/city.c Mon Aug 17 17:14:21 2015
@@ -2201,7 +2201,7 @@
   citizens *unhappy = &pcity->feel[CITIZEN_UNHAPPY][FEELING_BASE];
   citizens *angry = &pcity->feel[CITIZEN_ANGRY][FEELING_BASE];
   citizens size = city_size_get(pcity);
-  citizens specialists = city_specialists(pcity);
+  citizens specialist_count = city_specialists(pcity);
 
   /* This is the number of citizens that may start out content, depending
    * on empire size and game's city unhappysize. This may be bigger than
@@ -2211,16 +2211,16 @@
   citizens base_angry = player_angry_citizens(pplayer);
 
   /* Create content citizens. Take specialists from their ranks. */
-  *content = MAX(0, MIN(size, base_content) - specialists);
+  *content = MAX(0, MIN(size, base_content) - specialist_count);
 
   /* Create angry citizens. Specialists never become angry. */
   fc_assert_action(base_content == 0 || base_angry == 0, *content = 0);
-  *angry = MIN(base_angry, size - specialists);
+  *angry = MIN(base_angry, size - specialist_count);
 
   /* Create unhappy citizens. In the beginning, all who are not content,
    * specialists or angry are unhappy. This is changed by luxuries and 
    * buildings later. */
-  *unhappy = (size - specialists - *content - *angry);
+  *unhappy = (size - specialist_count - *content - *angry);
   fc_assert_action(*unhappy >= 0, *unhappy = 0);
 
   /* No one is born happy. */

Modified: branches/S2_5/common/diptreaty.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_5/common/diptreaty.c?rev=29572&r1=29571&r2=29572&view=diff
==============================================================================
--- branches/S2_5/common/diptreaty.c    (original)
+++ branches/S2_5/common/diptreaty.c    Mon Aug 17 17:14:21 2015
@@ -119,8 +119,8 @@
                  enum clause_type type, int val)
 {
   clause_list_iterate(ptreaty->clauses, pclause) {
-    if(pclause->type==type && pclause->from==pfrom &&
-       pclause->value==val) {
+    if (pclause->type == type && pclause->from == pfrom
+        && pclause->value == val) {
       clause_list_remove(ptreaty->clauses, pclause);
       free(pclause);
 
@@ -188,31 +188,31 @@
     return FALSE;
   }
 
-  clause_list_iterate(ptreaty->clauses, pclause) {
-    if(pclause->type==type
-       && pclause->from==pfrom
-       && pclause->value==val) {
+  clause_list_iterate(ptreaty->clauses, old_clause) {
+    if (old_clause->type == type
+        && old_clause->from == pfrom
+        && old_clause->value == val) {
       /* same clause already there */
       return FALSE;
     }
-    if(is_pact_clause(type) &&
-       is_pact_clause(pclause->type)) {
+    if (is_pact_clause(type) &&
+        is_pact_clause(old_clause->type)) {
       /* pact clause already there */
       ptreaty->accept0 = FALSE;
       ptreaty->accept1 = FALSE;
-      pclause->type=type;
+      old_clause->type = type;
       return TRUE;
     }
-    if (type == CLAUSE_GOLD && pclause->type==CLAUSE_GOLD &&
-        pclause->from==pfrom) {
+    if (type == CLAUSE_GOLD && old_clause->type == CLAUSE_GOLD &&
+        old_clause->from == pfrom) {
       /* gold clause there, different value */
       ptreaty->accept0 = FALSE;
       ptreaty->accept1 = FALSE;
-      pclause->value=val;
+      old_clause->value = val;
       return TRUE;
     }
   } clause_list_iterate_end;
-   
+
   pclause = fc_malloc(sizeof(*pclause));
 
   pclause->type=type;

Modified: branches/S2_5/common/effects.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_5/common/effects.c?rev=29572&r1=29571&r2=29572&view=diff
==============================================================================
--- branches/S2_5/common/effects.c      (original)
+++ branches/S2_5/common/effects.c      Mon Aug 17 17:14:21 2015
@@ -253,13 +253,13 @@
 void ruleset_cache_free(void)
 {
   int i;
-  struct effect_list *plist = ruleset_cache.tracker;
-
-  if (plist) {
-    effect_list_iterate(plist, peffect) {
+  struct effect_list *tracker_list = ruleset_cache.tracker;
+
+  if (tracker_list) {
+    effect_list_iterate(tracker_list, peffect) {
       effect_free(peffect);
     } effect_list_iterate_end;
-    effect_list_destroy(plist);
+    effect_list_destroy(tracker_list);
     ruleset_cache.tracker = NULL;
   }
 

Modified: branches/S2_5/common/map.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_5/common/map.c?rev=29572&r1=29571&r2=29572&view=diff
==============================================================================
--- branches/S2_5/common/map.c  (original)
+++ branches/S2_5/common/map.c  Mon Aug 17 17:14:21 2015
@@ -1094,9 +1094,9 @@
 
     positions = fc_calloc(MAP_INDEX_SIZE, sizeof(*positions));
 
-    whole_map_iterate(ptile) {
-      if (filter(ptile, data)) {
-       positions[count] = tile_index(ptile);
+    whole_map_iterate(check_tile) {
+      if (filter(check_tile, data)) {
+       positions[count] = tile_index(check_tile);
        count++;
       }
     } whole_map_iterate_end;

Modified: branches/S2_5/common/map.h
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_5/common/map.h?rev=29572&r1=29571&r2=29572&view=diff
==============================================================================
--- branches/S2_5/common/map.h  (original)
+++ branches/S2_5/common/map.h  Mon Aug 17 17:14:21 2015
@@ -495,7 +495,7 @@
  * center map position, with normalization.  Does not include the center
  * position.  The order of positions is unspecified. */
 #define cardinal_adjc_iterate(center_tile, itr_tile)                       \
-  adjc_dirlist_iterate(center_tile, itr_tile, _dir_itr,                        
    \
+  adjc_dirlist_iterate(center_tile, itr_tile, _dir_itr##center_tile,       \
                       map.cardinal_dirs, map.num_cardinal_dirs)
 
 #define cardinal_adjc_iterate_end adjc_dirlist_iterate_end
@@ -537,18 +537,18 @@
                             dirlist, dircount)                             \
 {                                                                          \
   enum direction8 _dir;                                                        
    \
-  int _tile##_x, _tile##_y, _center##_x, _center##_y;                       \
+  int _tile##_x, _tile##_y, _tile##_cx, _tile##_cy;                         \
   struct tile *_tile;                                                      \
   const struct tile *_tile##_center = (center_tile);                       \
   int _tile##_index = 0;                                                   \
-  index_to_map_pos(&_center##_x, &_center##_y, tile_index(_tile##_center)); \
+  index_to_map_pos(&_tile##_cx, &_tile##_cy, tile_index(_tile##_center));   \
   for (;                                                                   \
        _tile##_index < (dircount);                                         \
        _tile##_index++) {                                                  \
     _dir = dirlist[_tile##_index];                                         \
     DIRSTEP(_tile##_x, _tile##_y, _dir);                                   \
-    _tile##_x += _center##_x;                                               \
-    _tile##_y += _center##_y;                                               \
+    _tile##_x += _tile##_cx;                                                \
+    _tile##_y += _tile##_cy;                                                \
     _tile = map_pos_to_tile(_tile##_x, _tile##_y);                          \
     if (NULL == _tile) {                                                    \
       continue;                                                             \

Modified: branches/S2_5/common/player.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_5/common/player.c?rev=29572&r1=29571&r2=29572&view=diff
==============================================================================
--- branches/S2_5/common/player.c       (original)
+++ branches/S2_5/common/player.c       Mon Aug 17 17:14:21 2015
@@ -493,9 +493,10 @@
 
   pplayer->diplstates = fc_calloc(player_slot_count(),
                                   sizeof(*pplayer->diplstates));
-  player_slots_iterate(pslot) {
+  player_slots_iterate(dslot) {
     const struct player_diplstate **diplstate_slot
-      = pplayer->diplstates + player_slot_index(pslot);
+      = pplayer->diplstates + player_slot_index(dslot);
+
     *diplstate_slot = NULL;
   } player_slots_iterate_end;
 

Modified: branches/S2_5/common/player.h
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_5/common/player.h?rev=29572&r1=29571&r2=29572&view=diff
==============================================================================
--- branches/S2_5/common/player.h       (original)
+++ branches/S2_5/common/player.h       Mon Aug 17 17:14:21 2015
@@ -406,8 +406,8 @@
 
 /* iterate over all players, which are used at the moment */
 #define players_iterate(_pplayer)                                           \
-  player_slots_iterate(_pslot) {                                            \
-    struct player *_pplayer = player_slot_get_player(_pslot);               \
+  player_slots_iterate(_pslot##_pplayer) {                                  \
+    struct player *_pplayer = player_slot_get_player(_pslot##_pplayer);     \
     if (_pplayer != NULL) {
 #define players_iterate_end                                                 \
     }                                                                       \

Modified: branches/S2_5/common/road.h
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_5/common/road.h?rev=29572&r1=29571&r2=29572&view=diff
==============================================================================
--- branches/S2_5/common/road.h (original)
+++ branches/S2_5/common/road.h Mon Aug 17 17:14:21 2015
@@ -155,9 +155,9 @@
 
 #define road_type_iterate(_p)                    \
 {                                                \
-  int _i_;                                       \
-  for (_i_ = 0; _i_ < game.control.num_road_types ; _i_++) { \
-    struct road_type *_p = road_by_number(_i_);
+  int _i_##_p;                                   \
+  for (_i_##_p = 0; _i_##_p < game.control.num_road_types ; _i_##_p++) { \
+    struct road_type *_p = road_by_number(_i_##_p);
 
 #define road_type_iterate_end                    \
   }}

Modified: branches/S2_5/common/specialist.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_5/common/specialist.c?rev=29572&r1=29571&r2=29572&view=diff
==============================================================================
--- branches/S2_5/common/specialist.c   (original)
+++ branches/S2_5/common/specialist.c   Mon Aug 17 17:14:21 2015
@@ -195,7 +195,7 @@
 
   and you'll get "0/3/1".
 ****************************************************************************/
-const char *specialists_string(const citizens *specialists)
+const char *specialists_string(const citizens *specialist_list)
 {
   static char buf[5 * SP_MAX];
 
@@ -204,7 +204,7 @@
   specialist_type_iterate(sp) {
     char *separator = (buf[0] == '\0') ? "" : "/";
 
-    cat_snprintf(buf, sizeof(buf), "%s%d", separator, specialists[sp]);
+    cat_snprintf(buf, sizeof(buf), "%s%d", separator, specialist_list[sp]);
   } specialist_type_iterate_end;
 
   return buf;

Modified: branches/S2_5/common/specialist.h
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_5/common/specialist.h?rev=29572&r1=29571&r2=29572&view=diff
==============================================================================
--- branches/S2_5/common/specialist.h   (original)
+++ branches/S2_5/common/specialist.h   Mon Aug 17 17:14:21 2015
@@ -58,7 +58,7 @@
 
 /* Ancillary routines */
 const char *specialists_abbreviation_string(void);
-const char *specialists_string(const citizens *specialists);
+const char *specialists_string(const citizens *specialist_list);
 
 int get_specialist_output(const struct city *pcity,
                          Specialist_type_id sp, Output_type_id otype);

Modified: branches/S2_5/utility/ioz.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_5/utility/ioz.c?rev=29572&r1=29571&r2=29572&view=diff
==============================================================================
--- branches/S2_5/utility/ioz.c (original)
+++ branches/S2_5/utility/ioz.c Mon Aug 17 17:14:21 2015
@@ -677,8 +677,6 @@
 #ifdef HAVE_LIBLZMA
   case FZ_XZ:
     {
-      int num;
-
       va_start(ap, format);
       num = fc_vsnprintf((char *)fp->u.xz.in_buf, PLAIN_FILE_BUF_SIZE, format, 
ap);
       va_end(ap);

Modified: branches/S2_5/utility/registry_ini.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_5/utility/registry_ini.c?rev=29572&r1=29571&r2=29572&view=diff
==============================================================================
--- branches/S2_5/utility/registry_ini.c        (original)
+++ branches/S2_5/utility/registry_ini.c        Mon Aug 17 17:14:21 2015
@@ -546,8 +546,8 @@
     secfile->allow_duplicates = allow_duplicates;
     secfile->hash.entries = entry_hash_new_nentries(secfile->num_entries);
 
-    section_list_iterate(secfile->sections, psection) {
-      entry_list_iterate(section_entries(psection), pentry) {
+    section_list_iterate(secfile->sections, hashing_section) {
+      entry_list_iterate(section_entries(hashing_section), pentry) {
         if (!secfile_hash_insert(secfile, pentry)) {
           error = TRUE;
           break;

Modified: branches/S2_5/utility/specvec.h
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_5/utility/specvec.h?rev=29572&r1=29571&r2=29572&view=diff
==============================================================================
--- branches/S2_5/utility/specvec.h     (original)
+++ branches/S2_5/utility/specvec.h     Mon Aug 17 17:14:21 2015
@@ -132,10 +132,10 @@
 
 
 #define TYPED_VECTOR_ITERATE(atype, vector, var) {      \
-  unsigned int myiter;                                  \
+  unsigned int myiter##var;                             \
   atype *var;                                           \
-  for (myiter = 0; myiter < (vector)->size; myiter++) { \
-    var = &(vector)->p[myiter];                                \
+  for (myiter##var = 0; myiter##var < (vector)->size; myiter##var++) { \
+    var = &(vector)->p[myiter##var];                           \
  
 /* Balance for above: */
 #define VECTOR_ITERATE_END  }}


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

Reply via email to