mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-01-10 07:10:27 +00:00
tools/nolibc: clean up sbrk() routine
Fix up the error reported by scripts/checkpatch.pl: ERROR: do not use assignment in if condition #95: FILE: tools/include/nolibc/sys.h:95: + if ((ret = sys_brk(0)) && (sys_brk(ret + inc) == ret + inc)) Apply the new generic __sysret() to merge the SET_ERRNO() and return lines. Signed-off-by: Zhangjin Wu <falcon@tinylab.org> Signed-off-by: Willy Tarreau <w@1wt.eu>
This commit is contained in:
parent
924e9539ae
commit
4201cfce15
@ -89,14 +89,13 @@ int brk(void *addr)
|
|||||||
static __attribute__((unused))
|
static __attribute__((unused))
|
||||||
void *sbrk(intptr_t inc)
|
void *sbrk(intptr_t inc)
|
||||||
{
|
{
|
||||||
void *ret;
|
|
||||||
|
|
||||||
/* first call to find current end */
|
/* first call to find current end */
|
||||||
if ((ret = sys_brk(0)) && (sys_brk(ret + inc) == ret + inc))
|
void *ret = sys_brk(0);
|
||||||
|
|
||||||
|
if (ret && sys_brk(ret + inc) == ret + inc)
|
||||||
return ret + inc;
|
return ret + inc;
|
||||||
|
|
||||||
SET_ERRNO(ENOMEM);
|
return (void *)__sysret(-ENOMEM);
|
||||||
return (void *)-1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user