| 90 | |
| 91 | |
| 92 | struct action* mk_action(int type, int n, action_elem_t *elem, |
| 93 | int line, char *file) |
| 94 | { |
| 95 | int i; |
| 96 | struct action* a; |
| 97 | |
| 98 | if(n>MAX_ACTION_ELEMS) |
| 99 | { |
| 100 | LM_ERR("too many action elements at %s:%d for %d", |
| 101 | file, line, type); |
| 102 | return 0; |
| 103 | } |
| 104 | |
| 105 | a=(struct action*)pkg_malloc(sizeof(struct action)); |
| 106 | if (a==0) goto error; |
| 107 | memset(a,0,sizeof(struct action)); |
| 108 | a->type=type; |
| 109 | |
| 110 | for(i=0; i<n; i++) |
| 111 | { |
| 112 | a->elem[i].type = elem[i].type; |
| 113 | a->elem[i].u.data = elem[i].u.data; |
| 114 | if(a->elem[i].type==STR_ST && a->elem[i].u.s.s!=NULL) |
| 115 | a->elem[i].u.s.len = strlen(a->elem[i].u.s.s); |
| 116 | } |
| 117 | |
| 118 | a->line = line; |
| 119 | a->file = file; |
| 120 | a->next=0; |
| 121 | return a; |
| 122 | |
| 123 | error: |
| 124 | LM_CRIT("pkg memory allocation failure\n"); |
| 125 | return 0; |
| 126 | |
| 127 | } |
| 128 | |
| 129 | |
| 130 | struct action* append_action(struct action* a, struct action* b) |
no outgoing calls
no test coverage detected