Remove redundant return statements in UDP interconnect code#1829
Remove redundant return statements in UDP interconnect code#1829MutableFire wants to merge 2 commits into
Conversation
Hi @MutableFire welcome to add these description to the commit message body. Can take the .gitmessage as a commit template, FYI. |
809681e to
ec51c28
Compare
In C, reaching the closing brace of a void function implicitly returns control to the caller. Explicit 'return;' statements in these positions are unnecessary noise that clutters the code. Removing them aligns the code with common C style guidelines and improves readability.
ec51c28 to
abbdea7
Compare
Done. |
| pg_freeaddrinfo_all(hint.ai_family, addrs); | ||
| if (sockfd != -1) | ||
| closesocket(sockfd); | ||
| return; |
There was a problem hiding this comment.
any gcc warning ? I think no need if no warning.
There was a problem hiding this comment.
No, there were no gcc warnings.
My main motivation, as described in the PR, is simply code clarity. I believe we should avoid unnecessary lines that don't add logic, as they make the code harder to read.
While I agree we should minimize diffs from upstream for standard PostgreSQL code, this is our own custom code. Therefore, I think it's perfectly fine to refine its style and clean it up.
Could you clarify your concern? Is there a specific reason you prefer keeping these return statements?
In C, reaching the closing brace
}of avoidfunction implicitly returns control to the caller. Explicitreturn;statements in these positions are unnecessary noise that clutters the code. Removing them aligns the code with common C style guidelines and improves readability.