-
Notifications
You must be signed in to change notification settings - Fork 2k
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
lint: _sbrk_r: change parameter type from size_t to ptrdiff_t #1664
Conversation
@@ -75,13 +75,6 @@ void __assert(const char *file, int line, const char *failedexpr) | |||
/*-----------------------------------------------------------------------------------*/ | |||
caddr_t _sbrk_r(struct _reent *r, size_t incr) |
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 guess the parameter type for incr is wrong. It should take a ptrdiff_t
9ad6a68
to
d126eb1
Compare
Changed PR to use |
Newlib uses
|
d126eb1
to
129e9b0
Compare
@OlegHahm: done. |
Thanks. Changing the title sounds sensible to me. |
ACK. |
lint: _sbrk_r: change parameter type from size_t to ptrdiff_t
incr
is of typesize_t
which is essentially aunsigned int
type (according to ISO 1999 C it's an unsigned integer of at least 16 Bit). Since unsigned integers can't be smaller than zero the check is unnecessary (and will hopefully gets optimized away by the compiler anyways).This PR removes the unnecessary check to silencecppcheck
.This PR changes the type of
incr
toptrdiff_t
(as suggested by @Kijewski ).Added: changed this for
_sbrk_r
implementations for other platforms too.