-
Notifications
You must be signed in to change notification settings - Fork 291
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Various minor cleanups in net_crypto
.
#932
Conversation
e80481a
to
233f321
Compare
net_crypto
.net_crypto
.
94c3666
to
b832686
Compare
Reviewed 8 of 8 files at r2. Comments from Reviewable |
48f20df
to
e7fd866
Compare
net_crypto
.net_crypto
.
Reviewed 1 of 18 files at r1, 1 of 8 files at r2, 1 of 1 files at r3. toxcore/net_crypto.c, line 1106 at r3 (raw file):
Invert condition and do early return? or do you want to keep the success case at the end of the function? toxcore/net_crypto.c, line 1111 at r3 (raw file):
This variable can be removed by moving the return into the if Comments from Reviewable |
Review status: 0 of 1 LGTMs obtained (waiting on @sudden6) toxcore/net_crypto.c, line 1106 at r3 (raw file): Previously, sudden6 wrote…
Yes, I'd rather keep success at the end. toxcore/net_crypto.c, line 1111 at r3 (raw file): Previously, sudden6 wrote…
Done. Comments from Reviewable |
* Consistently use `num_packets_array` to get the packet count in the packet buffer. * Use `const` in more places. * Typo fix: begginning. * Rewrite `length < 1` for unsigned int to `length == 0`. * Limit scope of some loop variables by using for-init-decl. * Use early return in error paths to reduce indentation and for clarity. * Use `net_unpack_*` instead of manual `ntohs`. * Fix an uninitialised stack variable copy. * Fix a potential null pointer dereference. * Consistently use `get_crypto_connection`. It was inlined in some places. I de-inlined it now. * Add Loggers to some functions in preparation for adding log statements.
Reviewed 1 of 1 files at r4. toxcore/net_crypto.c, line 1106 at r3 (raw file): Previously, iphydf wrote…
Ok, can live with that Comments from Reviewable |
num_packets_array
to get the packet count in thepacket buffer.
const
in more places.length < 1
for unsigned int tolength == 0
.net_unpack_*
instead of manualntohs
.get_crypto_connection
. It was inlined in someplaces. I de-inlined it now.
This change is