Author: sveinung
Date: Sun Oct 23 04:19:37 2016
New Revision: 34209

URL: http://svn.gna.org/viewcvs/freeciv?rev=34209&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:
    trunk/common/actions.c
    trunk/common/actions.h

Modified: trunk/common/actions.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/common/actions.c?rev=34209&r1=34208&r2=34209&view=diff
==============================================================================
--- trunk/common/actions.c      (original)
+++ trunk/common/actions.c      Sun Oct 23 04:19:37 2016
@@ -652,7 +652,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.");
 
@@ -662,7 +662,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: trunk/common/actions.h
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/common/actions.h?rev=34209&r1=34208&r2=34209&view=diff
==============================================================================
--- trunk/common/actions.h      (original)
+++ trunk/common/actions.h      Sun Oct 23 04:19:37 2016
@@ -308,10 +308,11 @@
 struct action *action_by_number(int action_id);
 struct action *action_by_rule_name(const char *name);
 
-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