Author: sveinung
Date: Sun Oct 23 05:17:24 2016
New Revision: 34211

URL: http://svn.gna.org/viewcvs/freeciv?rev=34211&view=rev
Log:
Declare action_get_*_kind() action const.

The functions action_get_actor_kind() and action_get_target_kind() shouldn't
modify their action parameter. Declare it const.

See patch #7859

Modified:
    branches/S2_6/common/actions.c
    branches/S2_6/common/actions.h

Modified: branches/S2_6/common/actions.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/common/actions.c?rev=34211&r1=34210&r2=34211&view=diff
==============================================================================
--- branches/S2_6/common/actions.c      (original)
+++ branches/S2_6/common/actions.c      Sun Oct 23 05:17:24 2016
@@ -239,7 +239,7 @@
 /**************************************************************************
   Get the actor kind of an action.
 **************************************************************************/
-enum action_actor_kind action_get_actor_kind(struct action *paction)
+enum action_actor_kind action_get_actor_kind(const struct action *paction)
 {
   fc_assert_ret_val_msg(paction, AAK_COUNT, "Action doesn't exist.");
 
@@ -249,7 +249,8 @@
 /**************************************************************************
   Get the target kind of an action.
 **************************************************************************/
-enum action_target_kind action_get_target_kind(struct action *paction)
+enum action_target_kind action_get_target_kind(
+    const struct action *paction)
 {
   fc_assert_ret_val_msg(paction, ATK_COUNT, "Action doesn't exist.");
 

Modified: branches/S2_6/common/actions.h
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/common/actions.h?rev=34211&r1=34210&r2=34211&view=diff
==============================================================================
--- branches/S2_6/common/actions.h      (original)
+++ branches/S2_6/common/actions.h      Sun Oct 23 05:17:24 2016
@@ -146,10 +146,11 @@
 
 struct action *action_by_number(int action_id);
 
-enum action_actor_kind action_get_actor_kind(struct action *paction);
+enum action_actor_kind action_get_actor_kind(const struct action *paction);
 #define action_id_get_actor_kind(action_id)                               \
   action_get_actor_kind(action_by_number(action_id))
-enum action_target_kind action_get_target_kind(struct action *paction);
+enum action_target_kind action_get_target_kind(
+    const struct action *paction);
 #define action_id_get_target_kind(action_id)                              \
   action_get_target_kind(action_by_number(action_id))
 


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

Reply via email to