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

Conversation

@majekw
Copy link
Contributor

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 majek@w7i.pl

  • 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 <majek@w7i.pl>
@ralight

This comment has been minimized.

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
1 of 2 checks passed
1 of 2 checks passed
continuous-integration/travis-ci/pr The Travis CI build could not complete due to an error
Details
eclipsefdn/eca The author(s) of the pull request is covered by necessary legal agreements in order to proceed!
Details
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.