| 52 | struct raw_processing_cb_list* post_processing_cb_list = NULL; |
| 53 | |
| 54 | static inline int add_callback( struct script_cb **list, |
| 55 | cb_function f, void *param, int prio) |
| 56 | { |
| 57 | struct script_cb *last_cb; |
| 58 | struct script_cb *new_cb; |
| 59 | |
| 60 | new_cb=pkg_malloc(sizeof(struct script_cb)); |
| 61 | if (new_cb==0) { |
| 62 | LM_ERR("out of pkg memory\n"); |
| 63 | return -1; |
| 64 | } |
| 65 | new_cb->cbf = f; |
| 66 | new_cb->id = cb_id++; |
| 67 | new_cb->param = param; |
| 68 | new_cb->next = NULL; |
| 69 | new_cb->prio = prio; |
| 70 | |
| 71 | /* descending priority sorting; equal priorities are inserted at the end |
| 72 | it is important to keep the order at register time, as this reflects the |
| 73 | order of loading/init the modules --bogdan */ |
| 74 | if (*list==NULL) { |
| 75 | *list = new_cb; |
| 76 | } else if ((*list)->prio < prio) { |
| 77 | new_cb->next = *list; |
| 78 | *list = new_cb; |
| 79 | } else { |
| 80 | for (last_cb = *list; |
| 81 | last_cb->next && last_cb->next->prio >= prio; |
| 82 | last_cb = last_cb->next) |
| 83 | ; |
| 84 | |
| 85 | new_cb->next = last_cb->next; |
| 86 | last_cb->next = new_cb; |
| 87 | } |
| 88 | |
| 89 | return 0; |
| 90 | } |
| 91 | |
| 92 | |
| 93 | int __register_script_cb( cb_function f, int type, void *param, int prio) |
no outgoing calls
no test coverage detected