rlc: Move prepare() function out of gprs_rlc_data struct

Newer gcc 10.1.0 is erroring due to memset being applied on a complex
type, so let's start by removing this only function outside of the
struct.

Change-Id: I20426557d9b3049ab275fadb92e10ea8a860a119
This commit is contained in:
Pau Espin 2020-05-18 11:02:39 +02:00
parent c68e97012c
commit 5bb87b83d1
4 changed files with 9 additions and 9 deletions

View File

@ -32,16 +32,16 @@ extern "C" {
}
uint8_t *gprs_rlc_data::prepare(size_t block_data_len)
uint8_t *prepare(struct gprs_rlc_data *rlc, size_t block_data_len)
{
/* todo.. only set it once if it turns out to be a bottleneck */
memset(block, 0x0, sizeof(block));
memset(block, 0x2b, block_data_len);
memset(rlc->block, 0x0, sizeof(rlc->block));
memset(rlc->block, 0x2b, block_data_len);
/* Initial value of puncturing scheme */
next_ps = EGPRS_PS_1;
rlc->next_ps = EGPRS_PS_1;
return block;
return rlc->block;
}
void gprs_rlc_v_b::reset()

View File

@ -177,8 +177,6 @@ union split_block_status {
};
struct gprs_rlc_data {
uint8_t *prepare(size_t block_data_length);
/* block data including LI headers */
uint8_t block[RLC_MAX_LEN];
/* block data len including LI headers*/
@ -211,6 +209,8 @@ struct gprs_rlc_data {
union split_block_status spb_status;
};
uint8_t *prepare(struct gprs_rlc_data *rlc, size_t block_data_length);
void gprs_rlc_data_info_init_dl(struct gprs_rlc_data_info *rlc,
GprsCodingScheme cs, bool with_padding, const unsigned int spb);
void gprs_rlc_data_info_init_ul(struct gprs_rlc_data_info *rlc,

View File

@ -581,7 +581,7 @@ int gprs_rlcmac_dl_tbf::create_new_bsn(const uint32_t fn, GprsCodingScheme cs)
/* now we still have untransmitted LLC data, so we fill mac block */
rlc_data = m_rlc.block(bsn);
data = rlc_data->prepare(block_data_len);
data = prepare(rlc_data, block_data_len);
rlc_data->cs_last = cs;
rlc_data->cs_current_trans = cs;

View File

@ -97,7 +97,7 @@ static void test_rlc()
{
struct gprs_rlc_data rlc = { 0, };
memset(rlc.block, 0x23, RLC_MAX_LEN);
uint8_t *p = rlc.prepare(20);
uint8_t *p = prepare(&rlc, 20);
OSMO_ASSERT(p == rlc.block);
for (int i = 0; i < 20; ++i)
OSMO_ASSERT(p[i] == 0x2B);