From 1e75d131c99846cff248e572040067f4b885d758 Mon Sep 17 00:00:00 2001 From: Pau Espin Pedrol Date: Thu, 28 Jun 2018 12:48:13 +0200 Subject: bsc-filter: Remove unused func barr_adapt and set barr_find static bar_find is set as static because it's still being used internally by other functions. Change-Id: I2db8f0ba60cf01929ce2c63edd9859612724de48 --- src/libfilter/bsc_msg_filter.c | 65 +----------------------------------------- 1 file changed, 1 insertion(+), 64 deletions(-) (limited to 'src/libfilter') diff --git a/src/libfilter/bsc_msg_filter.c b/src/libfilter/bsc_msg_filter.c index 852067e33..bcabc24e2 100644 --- a/src/libfilter/bsc_msg_filter.c +++ b/src/libfilter/bsc_msg_filter.c @@ -35,7 +35,7 @@ #include #include -int bsc_filter_barr_find(struct rb_root *root, const char *imsi, int *cm, int *lu) +static int bsc_filter_barr_find(struct rb_root *root, const char *imsi, int *cm, int *lu) { struct bsc_filter_barr_entry *n; n = rb_entry(root->rb_node, struct bsc_filter_barr_entry, node); @@ -56,69 +56,6 @@ int bsc_filter_barr_find(struct rb_root *root, const char *imsi, int *cm, int *l return 0; } -static int insert_barr_node(struct bsc_filter_barr_entry *entry, struct rb_root *root) -{ - struct rb_node **new = &root->rb_node, *parent = NULL; - - while (*new) { - int rc; - struct bsc_filter_barr_entry *this; - this = rb_entry(*new, struct bsc_filter_barr_entry, node); - parent = *new; - - rc = strcmp(entry->imsi, this->imsi); - if (rc < 0) - new = &((*new)->rb_left); - else if (rc > 0) - new = &((*new)->rb_right); - else { - LOGP(DFILTER, LOGL_ERROR, - "Duplicate entry for IMSI(%s)\n", entry->imsi); - talloc_free(entry); - return -1; - } - } - - rb_link_node(&entry->node, parent, new); - rb_insert_color(&entry->node, root); - return 0; -} - -int bsc_filter_barr_adapt(void *ctx, struct rb_root *root, - const struct osmo_config_list *list) -{ - struct osmo_config_entry *cfg_entry; - int err = 0; - - /* free the old data */ - while (!RB_EMPTY_ROOT(root)) { - struct rb_node *node = rb_first(root); - rb_erase(node, root); - talloc_free(node); - } - - if (!list) - return 0; - - /* now adapt the new list */ - llist_for_each_entry(cfg_entry, &list->entry, list) { - struct bsc_filter_barr_entry *entry; - entry = talloc_zero(ctx, struct bsc_filter_barr_entry); - if (!entry) { - LOGP(DFILTER, LOGL_ERROR, - "Allocation of the barr entry failed.\n"); - continue; - } - - entry->imsi = talloc_strdup(entry, cfg_entry->mcc); - entry->cm_reject_cause = atoi(cfg_entry->mnc); - entry->lu_reject_cause = atoi(cfg_entry->option); - err |= insert_barr_node(entry, root); - } - - return err; -} - static int lst_check_deny(struct bsc_msg_acc_lst *lst, const char *mi_string, int *cm_cause, int *lu_cause) -- cgit v1.2.3