finds the node based upon URL and frees it from set */
| 2028 | |
| 2029 | /* finds the node based upon URL and frees it from set */ |
| 2030 | static void free_rtpe_node(struct rtpe_set *list, str *rtpe_url) |
| 2031 | { |
| 2032 | struct rtpe_node *prev_rtpp=NULL, *crt_rtpp; |
| 2033 | |
| 2034 | for(crt_rtpp=list->rn_first; crt_rtpp!=NULL && str_strcmp(&crt_rtpp->rn_url, rtpe_url); |
| 2035 | crt_rtpp=crt_rtpp->rn_next) |
| 2036 | prev_rtpp = crt_rtpp; |
| 2037 | |
| 2038 | if (!crt_rtpp) { |
| 2039 | LM_DBG("no matching node %s\n", rtpe_url->s); |
| 2040 | return; |
| 2041 | } |
| 2042 | |
| 2043 | /* first node matched */ |
| 2044 | if (!prev_rtpp) { |
| 2045 | list->rn_first = crt_rtpp->rn_next; |
| 2046 | goto free; |
| 2047 | } |
| 2048 | |
| 2049 | /* last node matched */ |
| 2050 | if (crt_rtpp->rn_next == NULL) |
| 2051 | list->rn_last = prev_rtpp; |
| 2052 | |
| 2053 | prev_rtpp->rn_next = crt_rtpp->rn_next; |
| 2054 | |
| 2055 | free: |
| 2056 | list->rtpe_node_count--; |
| 2057 | if (crt_rtpp->rn_url.s) |
| 2058 | shm_free(crt_rtpp->rn_url.s); |
| 2059 | shm_free(crt_rtpp); |
| 2060 | } |
| 2061 | |
| 2062 | static void free_rtpe_nodes(struct rtpe_set *list) |
| 2063 | { |
no test coverage detected