-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Avoiding conditional directives that split up parts of statements. #1480
base: master
Are you sure you want to change the base?
Conversation
@marciomribeiro can you indent the #ifdefs as well? |
I like option 2 |
Don't know why the CI build has failed. I didn't change anything but the indentation... |
that's normal, the tests are broken On Tue, Mar 8, 2016 at 11:24 AM, Márcio Ribeiro notifications@github.com
|
Is the pull request now ready to be accepted?! |
once I or someone else can review it yeah! thanks! |
@marciomribeiro you may want to reopen this on https://github.com/TokTok/toxcore |
Is this going to be merged or continued? |
@@ -239,12 +239,12 @@ escrypt_kdf_nosse(escrypt_local_t * local, | |||
uint32_t i; | |||
|
|||
/* Sanity-check parameters. */ | |||
#if SIZE_MAX > UINT32_MAX | |||
#if SIZE_MAX > UINT32_MAX |
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.
@marciomribeiro please undo this formatting change.
if (buflen > (((uint64_t)(1) << 32) - 1) * 32) { | ||
errno = EFBIG; | ||
return -1; | ||
} | ||
#endif | ||
#endif |
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.
And undo this.
#endif | ||
(N > SIZE_MAX / 128 / r)) { | ||
int test = (r > SIZE_MAX / 128 / p) || (N > SIZE_MAX / 128 / r); | ||
#if SIZE_MAX / 256 <= UINT32_MAX |
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.
Move to column 0.
(r > SIZE_MAX / 256) || | ||
#endif | ||
(N > SIZE_MAX / 128 / r)) { | ||
int test = (r > SIZE_MAX / 128 / p) || (N > SIZE_MAX / 128 / r); |
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.
Use _Bool
. Also rename to something more useful. test
doesn't say anything. What is it testing?
int test = (r > SIZE_MAX / 128 / p) || (N > SIZE_MAX / 128 / r); | ||
#if SIZE_MAX / 256 <= UINT32_MAX | ||
test = test || (r > SIZE_MAX / 256); | ||
#endif |
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.
Move to column 0.
MAP_ANON | MAP_PRIVATE, | ||
#endif | ||
-1, 0)) == MAP_FAILED) | ||
#ifdef MAP_ANON |
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.
Move all of these back to column 0.
uint32_t i; | ||
|
||
/* Sanity-check parameters. */ | ||
#if SIZE_MAX > UINT32_MAX | ||
#if SIZE_MAX > UINT32_MAX |
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.
Same thing in this file: revert the style change.
Done. |
A suggestion to compile entire statements and expressions, as suggested by code style guidelines from the Linux Kernel and practitioners.
It might improve code understanding, maintainability and error-proneness.