-
Notifications
You must be signed in to change notification settings - Fork 286
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
Avoid side-effectful assignments in conditionals. #984
Conversation
e5a0004
to
57faf61
Compare
Only in audio.c for now. This should be done everywhere.
57faf61
to
c0c3098
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 1 of 2 files at r1.
Reviewable status: 0 of 1 LGTMs obtained (waiting on @sudden6)
toxav/audio.c, line 149 at r1 (raw file):
struct RTPMessage *msg = jbuf_read(j_buf, &rc); for (; msg != nullptr || rc == 2; msg = jbuf_read(j_buf, &rc)) {
any special reason not to use a while loop here and move the msg = ...
into the body?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 0 of 1 LGTMs obtained (waiting on @sudden6)
toxav/audio.c, line 149 at r1 (raw file):
Previously, sudden6 wrote…
any special reason not to use a while loop here and move the
msg = ...
into the body?
Because this is a "for-each-element-in-jitter-buffer" loop, so the "for" keyword makes the most sense. Did I miss something?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 1 of 2 files at r1.
Reviewable status: complete! 1 of 1 LGTMs obtained
toxav/audio.c, line 149 at r1 (raw file):
Previously, iphydf wrote…
Because this is a "for-each-element-in-jitter-buffer" loop, so the "for" keyword makes the most sense. Did I miss something?
just wanted to know the reason, because for me this structure always looks incomplete and I would use a while loop here to make the loop header as short as possible. Just personal preference in the end, no need to change it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: complete! 1 of 1 LGTMs obtained
Only in audio.c for now. This should be done everywhere.
This change is