| 625 | |
| 626 | |
| 627 | int is_mod_func_used(struct action *a, const char *name, int param_no) |
| 628 | { |
| 629 | const cmd_export_t *cmd; |
| 630 | while(a) { |
| 631 | if (a->type==CMD_T) { |
| 632 | /* first param is the name of the function */ |
| 633 | cmd = (const cmd_export_t*)a->elem[0].u.data_const; |
| 634 | if (strcasecmp(cmd->name, name)==0) { |
| 635 | if (param_no==-1 || |
| 636 | (a->elem[param_no].type != NOSUBTYPE && |
| 637 | a->elem[param_no].type != NULLV_ST)) { |
| 638 | LM_DBG("function %s found to be used in script\n",name); |
| 639 | return 1; |
| 640 | } |
| 641 | |
| 642 | } |
| 643 | } |
| 644 | |
| 645 | /* follow all leads from actions/expressions than may have |
| 646 | * sub-blocks of instructions */ |
| 647 | if (a->elem[0].type==ACTIONS_ST) |
| 648 | if (is_mod_func_used((struct action*)a->elem[0].u.data, |
| 649 | name,param_no)==1) |
| 650 | return 1; |
| 651 | if (a->elem[0].type==EXPR_ST) |
| 652 | if (is_mod_func_in_expr((struct expr*)a->elem[0].u.data, |
| 653 | name,param_no)==1) |
| 654 | return 1; |
| 655 | |
| 656 | if (a->elem[1].type==ACTIONS_ST) |
| 657 | if (is_mod_func_used((struct action*)a->elem[1].u.data, |
| 658 | name,param_no)==1) |
| 659 | return 1; |
| 660 | if (a->elem[1].type==EXPR_ST) |
| 661 | if (is_mod_func_in_expr((struct expr*)a->elem[1].u.data, |
| 662 | name,param_no)==1) |
| 663 | return 1; |
| 664 | |
| 665 | if (a->elem[2].type==ACTIONS_ST) |
| 666 | if (is_mod_func_used((struct action*)a->elem[2].u.data, |
| 667 | name,param_no)==1) |
| 668 | return 1; |
| 669 | if (a->elem[2].type==EXPR_ST) |
| 670 | if (is_mod_func_in_expr((struct expr*)a->elem[2].u.data, |
| 671 | name,param_no)==1) |
| 672 | return 1; |
| 673 | |
| 674 | a = a->next; |
| 675 | } |
| 676 | |
| 677 | return 0; |
| 678 | } |
| 679 | |
| 680 | int is_mod_async_func_used(struct action *a, const char *name, int param_no) |
| 681 | { |
no test coverage detected