diff options
| author | Kacper <kacper@mail.openlinux.dev> | 2025-12-09 23:14:53 +0100 |
|---|---|---|
| committer | Kacper <kacper@mail.openlinux.dev> | 2025-12-09 23:14:53 +0100 |
| commit | 169daa11155988a210fac949297381743f3cb400 (patch) | |
| tree | 602ef5df5ae9ea075ab3d5dac3c8ad60da1ea2cc /lib/libc/stdlib/realloc.c | |
| parent | 4e2112e165fdd94dee58378e3ea32892f3710cd7 (diff) | |
feat: clang-tidy fixes
Diffstat (limited to 'lib/libc/stdlib/realloc.c')
| -rw-r--r-- | lib/libc/stdlib/realloc.c | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/lib/libc/stdlib/realloc.c b/lib/libc/stdlib/realloc.c index d90af70d..4722ac5e 100644 --- a/lib/libc/stdlib/realloc.c +++ b/lib/libc/stdlib/realloc.c @@ -1,10 +1,12 @@ -#include <errno.h> -#include <string.h> -#include <atomic.h> -#include <libc.h> -#include <malloc.h> -#include <linux/errno.h> -#include <stdlib.h> +#include "stddef.h" // for NULL + +#include <atomic.h> // for LIBC_UNLOCK, LIBC_LOCK +#include <errno.h> // for EINVAL, errno +#include <libc.h> // for (anonymous struct)::(anonymous), (anonymous), libc +#include <malloc.h> // for page, page::(anonymous), __malloc_pvec +#include <stdint.h> // for uintptr_t +#include <stdlib.h> // for free, malloc, realloc +#include <string.h> // for memcpy, size_t void *realloc(void *ptr, size_t size) { @@ -28,14 +30,13 @@ void *realloc(void *ptr, size_t size) if (size <= old_size) { return ptr; - } else { - void *new_ptr = malloc(size); - if (new_ptr) { - memcpy(new_ptr, ptr, old_size); - free(ptr); - } - return new_ptr; } + void *new_ptr = malloc(size); + if (new_ptr) { + memcpy(new_ptr, ptr, old_size); + free(ptr); + } + return new_ptr; } p = p->next; } |
