Skip to content
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

mosquitto_pub: split main loop. #1473

Merged
merged 1 commit into from Nov 6, 2019
Merged

Conversation

majekw
Copy link
Contributor

@majekw majekw commented Oct 24, 2019

Main loop has two different logic inside: one for stdin input,
second for all other cases. Exit loop condition is also different
for both variants. This commit splits these two variants into
two separate loops.
It could help fixing other issues in this part of code and greatly improve it's readability.
There are also a little clean-up things:

  • use rc in stdin loop, so we get exit status and spare few bytes
  • use MOSQ_ERR_SUCCESS instead of cryptic 0

Signed-off-by: Marek Wodzinski [email protected]

  • If you are contributing a bugfix, is your work based off the fixes branch?
  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you successfully run make test with your changes locally?
  • Have you signed the Eclipse Contributor Agreement, using the same email address as you used in your commits?
  • Do each of your commits have a "Signed-off-by" line, with the correct email address? Use "git commit -s" to generate this line for you.

Main loop has two different logics inside: one for stdin input,
second for all other cases. Exit loop condition is also different
for both variants. This commit splits these two variants into
two separate loops.

Signed-off-by: Marek Wodzinski <[email protected]>
@ralight
Copy link
Contributor

ralight commented Nov 6, 2019

I like this, and I'm actually going to take it a step further to split those loops into separate functions to make it even more readable. Thanks very much!

@ralight ralight merged commit 4e7e6c6 into eclipse:fixes Nov 6, 2019
ralight added a commit that referenced this pull request Nov 7, 2019
This would happen if the final line did not end with a new line.

Closes #1473. Thanks to majekw.
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 11, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants