diff options
author | Alexander Couzens <lynxis@fe80.eu> | 2016-08-21 19:38:30 +0200 |
---|---|---|
committer | lynxis lazus <lynxis@fe80.eu> | 2016-10-18 09:49:57 +0000 |
commit | d38b92e972be130df3e6c908fb7e7bf1729ab7fb (patch) | |
tree | a6a6d5a84e0f4a227597af61c649a05b24f3307c /src/tbf.h | |
parent | 0a4a6c120040c8dd0744f745e08f24624df62647 (diff) |
tbf: add llc_queue_size() to check llc_queue is valid before calling size()
gcc6 is optimizing if (!this) {CODE} as this is assumed to never be a
std::nullptr here. Move the null check to the caller. In preparation of
removing the check within llc_queue->size(), all callers must check the object
before calling it. Make sure of that: make the llc_queue() access function
protected and offer only a public llc_queue_size() function that incorporates
the NULL check. All current callers are only interested in the
llc_queue_size().
Tweaked-by: nhofmeyr
Change-Id: I88cc3180f8f86785e3f07981895dabddf50b60a2
Diffstat (limited to 'src/tbf.h')
-rw-r--r-- | src/tbf.h | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -142,8 +142,7 @@ struct gprs_rlcmac_tbf { uint8_t ms_class() const; void set_ms_class(uint8_t); GprsCodingScheme current_cs() const; - gprs_llc_queue *llc_queue(); - const gprs_llc_queue *llc_queue() const; + int llc_queue_size() const; time_t created_ts() const; uint8_t dl_slots() const; @@ -231,6 +230,9 @@ protected: int set_tlli_from_ul(uint32_t new_tlli); void merge_and_clear_ms(GprsMs *old_ms); + gprs_llc_queue *llc_queue(); + const gprs_llc_queue *llc_queue() const; + static const char *tbf_state_name[7]; class GprsMs *m_ms; |