aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2009-06-26 20:25:23 +0200
committerHarald Welte <laforge@gnumonks.org>2009-06-26 20:25:23 +0200
commit470ec29b0db526c1592f6a270652657315efddca (patch)
tree7da372db125bc09f31076a57e484165641c3d3ff /openbsc/src
parentc05677b036dce4dbf59414dc15b75a5b3472ae6e (diff)
use taloc_zero() rather than talloc() and explisit memset()
Diffstat (limited to 'openbsc/src')
-rw-r--r--openbsc/src/abis_nm.c3
-rw-r--r--openbsc/src/e1_config.c6
-rw-r--r--openbsc/src/e1_input.c4
-rw-r--r--openbsc/src/gsm_04_08.c5
-rw-r--r--openbsc/src/paging.c3
-rw-r--r--openbsc/src/subchan_demux.c5
-rw-r--r--openbsc/src/telnet_interface.c3
7 files changed, 10 insertions, 19 deletions
diff --git a/openbsc/src/abis_nm.c b/openbsc/src/abis_nm.c
index 4a73930fc..b07aa3116 100644
--- a/openbsc/src/abis_nm.c
+++ b/openbsc/src/abis_nm.c
@@ -2079,12 +2079,11 @@ static int bs11_read_swl_file(struct abis_nm_bs11_sw *bs11_sw)
if (rc < 2)
continue;
- fle = talloc(tall_fle_ctx, struct file_list_entry);
+ fle = talloc_zero(tall_fle_ctx, struct file_list_entry);
if (!fle) {
rc = -ENOMEM;
goto out;
}
- memset(fle, 0, sizeof(*fle));
/* construct new filename */
strncpy(dir, bs11_sw->swl_fname, sizeof(dir));
diff --git a/openbsc/src/e1_config.c b/openbsc/src/e1_config.c
index abc30402f..9c9f40cff 100644
--- a/openbsc/src/e1_config.c
+++ b/openbsc/src/e1_config.c
@@ -25,10 +25,9 @@ int e1_config(struct gsm_bts *bts, int cardnr, int release_l2)
struct e1inp_ts *sign_ts;
struct e1inp_sign_link *oml_link, *rsl_link;
- line = talloc(tall_bsc_ctx, struct e1inp_line);
+ line = talloc_zero(tall_bsc_ctx, struct e1inp_line);
if (!line)
return -ENOMEM;
- memset(line, 0, sizeof(*line));
/* create E1 timeslots for signalling and TRAU frames */
e1inp_ts_config(&line->ts[1-1], line, E1INP_TS_TYPE_SIGN);
@@ -80,10 +79,9 @@ int ia_config_connect(struct gsm_bts *bts, struct sockaddr_in *sin)
struct e1inp_ts *sign_ts, *rsl_ts;
struct e1inp_sign_link *oml_link, *rsl_link;
- line = talloc(tall_bsc_ctx, struct e1inp_line);
+ line = talloc_zero(tall_bsc_ctx, struct e1inp_line);
if (!line)
return -ENOMEM;
- memset(line, 0, sizeof(*line));
/* create E1 timeslots for signalling and TRAU frames */
e1inp_ts_config(&line->ts[1-1], line, E1INP_TS_TYPE_SIGN);
diff --git a/openbsc/src/e1_input.c b/openbsc/src/e1_input.c
index 9de6b0141..56bce019c 100644
--- a/openbsc/src/e1_input.c
+++ b/openbsc/src/e1_input.c
@@ -373,12 +373,10 @@ e1inp_sign_link_create(struct e1inp_ts *ts, enum e1inp_sign_type type,
tall_sigl_ctx = talloc_named_const(tall_bsc_ctx, 1,
"e1inp_sign_link");
- link = talloc(tall_sigl_ctx, struct e1inp_sign_link);
+ link = talloc_zero(tall_sigl_ctx, struct e1inp_sign_link);
if (!link)
return NULL;
- memset(link, 0, sizeof(*link));
-
link->ts = ts;
link->type = type;
INIT_LLIST_HEAD(&link->tx_list);
diff --git a/openbsc/src/gsm_04_08.c b/openbsc/src/gsm_04_08.c
index d6f131e23..6d8530bcb 100644
--- a/openbsc/src/gsm_04_08.c
+++ b/openbsc/src/gsm_04_08.c
@@ -354,9 +354,8 @@ static void allocate_loc_updating_req(struct gsm_lchan *lchan)
if (!tall_locop_ctx)
tall_locop_ctx = talloc_named_const(tall_bsc_ctx, 1,
"loc_updating_oper");
- lchan->loc_operation = talloc(tall_locop_ctx,
- struct gsm_loc_updating_operation);
- memset(lchan->loc_operation, 0, sizeof(*lchan->loc_operation));
+ lchan->loc_operation = talloc_zero(tall_locop_ctx,
+ struct gsm_loc_updating_operation);
}
static int gsm0408_authorize(struct gsm_lchan *lchan, struct msgb *msg)
diff --git a/openbsc/src/paging.c b/openbsc/src/paging.c
index 217da7e0a..0703e932f 100644
--- a/openbsc/src/paging.c
+++ b/openbsc/src/paging.c
@@ -228,8 +228,7 @@ static void _paging_request(struct gsm_bts *bts, struct gsm_subscriber *subscr,
}
DEBUGP(DPAG, "Start paging on bts %d.\n", bts->nr);
- req = talloc(tall_paging_ctx, struct gsm_paging_request);
- memset(req, 0, sizeof(*req));
+ req = talloc_zero(tall_paging_ctx, struct gsm_paging_request);
req->subscr = subscr_get(subscr);
req->bts = bts;
req->chan_type = type;
diff --git a/openbsc/src/subchan_demux.c b/openbsc/src/subchan_demux.c
index 56f3dd3f2..ccd4fadc6 100644
--- a/openbsc/src/subchan_demux.c
+++ b/openbsc/src/subchan_demux.c
@@ -291,12 +291,11 @@ int subchan_mux_enqueue(struct subch_mux *mx, int s_nr, const u_int8_t *data,
{
struct mux_subch *sch = &mx->subch[s_nr];
int list_len = llist_len(&sch->tx_queue);
- struct subch_txq_entry *tqe = talloc_size(tall_tqe_ctx,
- sizeof(*tqe) + len);
+ struct subch_txq_entry *tqe = talloc_zero_size(tall_tqe_ctx,
+ sizeof(*tqe) + len);
if (!tqe)
return -ENOMEM;
- memset(tqe, 0, sizeof(*tqe));
tqe->bit_len = len;
memcpy(tqe->bits, data, len);
diff --git a/openbsc/src/telnet_interface.c b/openbsc/src/telnet_interface.c
index 5cc6ea0af..7a67fe1de 100644
--- a/openbsc/src/telnet_interface.c
+++ b/openbsc/src/telnet_interface.c
@@ -167,8 +167,7 @@ static int telnet_new_connection(struct bsc_fd *fd, unsigned int what) {
}
- connection = talloc(tall_telnet_ctx, struct telnet_connection);
- memset(connection, 0, sizeof(*connection));
+ connection = talloc_zero(tall_telnet_ctx, struct telnet_connection);
connection->network = (struct gsm_network*)fd->data;
connection->fd.data = connection;
connection->fd.fd = new_connection;