Module: kamailio
Branch: master
Commit: 75a7d0d8b1340d292aba9b589263619f5a6e11c1
URL:
https://github.com/kamailio/kamailio/commit/75a7d0d8b1340d292aba9b589263619…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2023-12-11T14:19:04+01:00
core: route struct - use helper macro to get action address
---
Modified: src/core/route_struct.c
---
Diff:
https://github.com/kamailio/kamailio/commit/75a7d0d8b1340d292aba9b589263619…
Patch:
https://github.com/kamailio/kamailio/commit/75a7d0d8b1340d292aba9b589263619…
---
diff --git a/src/core/route_struct.c b/src/core/route_struct.c
index 654e588beb3..fa43b498e75 100644
--- a/src/core/route_struct.c
+++ b/src/core/route_struct.c
@@ -561,11 +561,12 @@ void print_actions(struct action *a)
*/
struct action *get_action_from_param(void **param, int param_no)
{
- struct action *ac, ac2;
- action_u_t *au, au2;
+ cfg_action_t *ac;
+ action_u_t *au;
/* param points to au->u.string, get pointer to au */
- au = (void *)((char *)param - ((char *)&au2.u.string - (char *)&au2));
+ au = ksr_container_of(param, action_u_t, u.string);
au = au - 1 - param_no;
- ac = (void *)((char *)au - ((char *)&ac2.val - (char *)&ac2));
+ /* au points to ac->val, get pointer to ac */
+ ac = ksr_container_of(au, cfg_action_t, val);
return ac;
}