From 509047ba5d2daf2cecfa198d0dca1430c8257294 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Sun, 17 Jan 2021 19:55:51 +0100 Subject: gprs_ns2_fr: reduce duplication between gprs_ns2_fr_connect / connect2 gprs_sn2_fr_connect2() is the same as gprs_ns2_fr_connect() with the lookup-and-create-on-demand of the NSE first. Rather than copy+paste, they should simply invoke each other. Change-Id: If835bf138f213e7f58205018e7efe3ecb772c624 --- src/gb/gprs_ns2_fr.c | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) diff --git a/src/gb/gprs_ns2_fr.c b/src/gb/gprs_ns2_fr.c index 2c797f32..bb553812 100644 --- a/src/gb/gprs_ns2_fr.c +++ b/src/gb/gprs_ns2_fr.c @@ -776,7 +776,6 @@ struct gprs_ns2_vc *gprs_ns2_fr_connect2(struct gprs_ns2_vc_bind *bind, { bool created_nse = false; struct gprs_ns2_vc *nsvc = NULL; - struct priv_vc *priv = NULL; struct gprs_ns2_nse *nse = gprs_ns2_nse_by_nsei(bind->nsi, nsei); if (!nse) { nse = gprs_ns2_create_nse(bind->nsi, nsei, GPRS_NS2_LL_FR, NS2_DIALECT_STATIC_RESETBLOCK); @@ -785,28 +784,12 @@ struct gprs_ns2_vc *gprs_ns2_fr_connect2(struct gprs_ns2_vc_bind *bind, created_nse = true; } - nsvc = gprs_ns2_fr_nsvc_by_dlci(bind, dlci); - if (nsvc) { - goto err_nse; - } - - nsvc = ns2_vc_alloc(bind, nse, true, NS2_VC_MODE_BLOCKRESET); + nsvc = gprs_ns2_fr_connect(bind, nse, nsvci, dlci); if (!nsvc) goto err_nse; - nsvc->priv = priv = fr_alloc_vc(bind, nsvc, dlci); - if (!priv) - goto err; - - nsvc->nsvci = nsvci; - nsvc->nsvci_is_valid = true; - - gprs_ns2_vc_fsm_start(nsvc); - return nsvc; -err: - gprs_ns2_free_nsvc(nsvc); err_nse: if (created_nse) gprs_ns2_free_nse(nse); -- cgit v1.2.3