INTERNAL: Improve readability of branching logic for no_reply and to_write
#400
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
๐ Related Issue
โจ๏ธ What I did
to_write ๋ณ์๋ฅผ ์ญ์ ํ๊ณ ptr->flags.buffer_requests๋ฅผ ์ง์ ์ฌ์ฉํ๊ฒ ํ์ต๋๋ค. ๊ธฐ์กด์๋
to_write= not ptr->flags.buffer_requests;๋ก ํ ๋นํ๊ณ , ์ฌ์ฉ ์์๋to_write == false๋ฅผ ๋น๊ตํด ์ด์ค ๋ถ์ ์ด ๋๋ฉฐ ๊ฐ๋ ์ฑ์ด ๋ค์ ๋จ์ด์ก๊ธฐ ๋๋ฌธ์ ๋๋ค.noreply ๋ณ์๋ฅผ ์ญ์ ํ๊ณ ptr->flags.no_reply๋ฅผ ์ง์ ์ฌ์ฉํ๊ฒ ํต์ผํ์ต๋๋ค.
buffer_request, no_reply์ธ ๊ฒฝ์ฐ rc๊ฐ ๋ณ๊ฒฝ ๋์ early return ํ๋๋ก ํต์ผํ์ต๋๋ค. ๋จ, ๊ธฐ์กด ๋ฐฉ์์ด ๋ ์ ํฉํ ๊ฒฝ์ฐ ๊ธฐ์กด ๋ฐฉ์์ ์ฑํํ์ต๋๋ค.