-
Notifications
You must be signed in to change notification settings - Fork 7.8k
sapi/*: move duplicate "--define" code to library #8241
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
Conversation
7831cdd
to
e9fe2b0
Compare
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.
Other than the nit this looks good to me
e9fe2b0
to
c9b0d26
Compare
Does anyone else want to review this? Otherwise I'll merge this tomorrow or so. |
Sorry, forgot about this one. I'll merge it tomorrow. |
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.
Other than the small coding style remark, LGTM
if (b->length > 0) | ||
memmove(b->value + length, b->value, b->length); |
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.
Maybe use explicit {}
for the if block?
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.
AFAIK we don't have any guidelines on this. I'm fine with making braces mandatory for new code but I think the risks of not adding braces are largely overblown.
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.
I don't think it's a risk, just confusing IMHO (at least I get confused)
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.
The argument is usually somebody might extend the block in the if
and forget that braces are missing.
if (foo())
bar();
+ baz();
Or bar()
might be a macro containing multiple statements but we use do {} while (0)
in our macros to prevent that.
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.
@iluuu1994 just FYI we actually have guidelines on this:
Lines 243 to 258 in 31692a1
3. Be generous with whitespace and braces. Keep one empty line between the | |
variable declaration section and the statements in a block, as well as | |
between logical statement groups in a block. Maintain at least one empty | |
line between two functions, preferably two. Always prefer: | |
```c | |
if (foo) { | |
bar; | |
} | |
``` | |
to: | |
```c | |
if(foo)bar; | |
``` |
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.
@bukka Ah, good to know.
Merged as d87ba95. Thanks @MaxKellermann! |
There's a new leak. I'm at work right now but I'll have a look tonight. |
Temporarily store result of ini bulder in ini_entries to avoid a leak when main() exists prematurely. Technically ini_entries isn't released either but ASAN doesn't consider unreleased memory referenced from globals leaks.
Temporarily store result of ini builder in ini_entries to avoid a leak when main() exists prematurely. Technically ini_entries isn't released either but ASAN doesn't consider unreleased memory referenced from globals leaks.
No description provided.