Change in libosmocore[master]: coding: Always initialize bit counters in gsm0503_pdtch_egprs_decode().

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Harald Welte gerrit-no-reply at lists.osmocom.org
Mon Jul 16 08:23:55 UTC 2018


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 <Alexander.Chemeris at gmail.com>
Gerrit-Reviewer: Jenkins Builder
Gerrit-CC: Harald Welte <laforge at gnumonks.org>
Gerrit-CC: Vadim Yanitskiy <axilirator at gmail.com>
Gerrit-Comment-Date: Mon, 16 Jul 2018 08:23:55 +0000
Gerrit-HasComments: Yes
Gerrit-HasLabels: No
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20180716/75710fd0/attachment.htm>


More information about the gerrit-log mailing list