Harald Welte has posted comments on this change. ( 
https://gerrit.osmocom.org/9996 )

Change subject: coding: Always initialize bit counters in 
gsm0503_pdtch_egprs_decode().
......................................................................


Patch Set 1:

(1 comment)

https://gerrit.osmocom.org/#/c/9996/1/src/coding/gsm0503_coding.c
File src/coding/gsm0503_coding.c:

https://gerrit.osmocom.org/#/c/9996/1/src/coding/gsm0503_coding.c@942
PS1, Line 942:  if (n_bits_total) *n_bits_total = 0;
> Do we also initialize both variables on other decoding functions? And why not 
> to initialize both by  […]
I think if we initialize in the callee (i.e. here), then we should do in _all_ 
*_decode functions.

Whether to initialize in the caller or callee (us): I think in general it's 
safest to do it here (callee), as we then do 'the right thing' no matter if the 
caller is lazy and forgets about proper initialization.

However, if there are valid use cases where the counter should be preserved 
(i.e. incremented) over multiple calls, and each call should increment the 
counter, we must place the burden of zero-initialization on the caller.

In any case, coding style should be observed (if clause on separate line).



--
To view, visit https://gerrit.osmocom.org/9996
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I4722cae3794ccbb12001113c991d9cf345a52a96
Gerrit-Change-Number: 9996
Gerrit-PatchSet: 1
Gerrit-Owner: Alexander Chemeris <[email protected]>
Gerrit-Reviewer: Jenkins Builder
Gerrit-CC: Harald Welte <[email protected]>
Gerrit-CC: Vadim Yanitskiy <[email protected]>
Gerrit-Comment-Date: Mon, 16 Jul 2018 08:23:55 +0000
Gerrit-HasComments: Yes
Gerrit-HasLabels: No

Reply via email to