All: Clear lines with only whitspace in them

This commit is contained in:
Bananymous
2023-09-09 22:52:03 +03:00
parent 1fcf122c50
commit 921d95d18f
67 changed files with 95 additions and 119 deletions

View File

@@ -24,7 +24,7 @@ int closedir(DIR* dirp)
errno = EBADF;
return -1;
}
close(dirp->fd);
dirp->fd = -1;
free(dirp);

View File

@@ -49,7 +49,6 @@ size_t strxfrm_l(char* __restrict s1, const char* __restrict s2, size_t n, local
const char* strerrorname_np(int error);
const char* strerrordesc_np(int error);
__END_DECLS
#endif

View File

@@ -87,7 +87,6 @@ struct stat
#define UTIME_NOW 1000000001
#define UTIME_OMIT 1000000002
int chmod(const char* path, mode_t mode);
int fchmod(int fildes, mode_t mode);
int fchmodat(int fd, const char* path, mode_t mode, int flag);

View File

@@ -77,7 +77,7 @@ static void integer_to_string(char* buffer, T value, int base, bool upper, forma
prefix[1] = 'x';
}
}
while (value || offset < digits)
{
buffer[offset++] = digit_char(value % base, upper);
@@ -171,7 +171,7 @@ static void floating_point_to_string(char* buffer, T value, bool upper, const fo
return;
}
buffer[offset++] = '.';
// Add the 'percision' digits after decimal point
for (int i = 0; i < percision; i++)
{
@@ -193,7 +193,7 @@ static void floating_point_to_exponent_string(char* buffer, T value, bool upper,
int percision = 6;
if (options.percision != -1)
percision = options.percision;
int offset = 0;
// Add sign if needed
@@ -465,7 +465,6 @@ extern "C" int printf_impl(const char* format, va_list arguments, int (*putc_fun
format++;
}
}
return written;
}

View File

@@ -50,7 +50,7 @@ struct passwd* getpwent(void)
if (!open_pwent())
return nullptr;
clear_pwent(s_pwent_struct);
BAN::String line;
while (true)
{

View File

@@ -62,7 +62,7 @@ FILE* fdopen(int fd, const char* mode)
return &s_files[i];
}
}
errno = EMFILE;
return nullptr;
}
@@ -90,7 +90,7 @@ int fflush(FILE* file)
if (file->buffer_index == 0)
return 0;
if (syscall(SYS_WRITE, file->fd, file->buffer, file->buffer_index) < 0)
{
file->error = true;
@@ -105,7 +105,7 @@ int fgetc(FILE* file)
{
if (file->eof)
return EOF;
unsigned char c;
long ret = syscall(SYS_READ, file->fd, &c, 1);
@@ -114,7 +114,7 @@ int fgetc(FILE* file)
file->error = true;
return EOF;
}
if (ret == 0)
{
file->eof = true;
@@ -217,7 +217,7 @@ FILE* fopen(const char* pathname, const char* mode)
return &s_files[i];
}
}
errno = EMFILE;
return nullptr;
}
@@ -293,7 +293,7 @@ int fseeko(FILE* file, off_t offset, int whence)
long ret = syscall(SYS_SEEK, file->fd, offset, whence);
if (ret < 0)
return -1;
file->eof = false;
return 0;
}
@@ -353,7 +353,7 @@ char* gets(char* buffer)
return nullptr;
unsigned char* ubuffer = (unsigned char*)buffer;
int first = fgetc(stdin);
if (first == EOF)
return nullptr;
@@ -529,7 +529,7 @@ int vsprintf(char* buffer, const char* format, va_list arguments)
{
if (buffer == nullptr)
return printf_impl(format, arguments, [](int, void*) { return 0; }, nullptr);
int ret = printf_impl(format, arguments,
[](int c, void* _buffer)
{

View File

@@ -205,7 +205,6 @@ void free(void* ptr)
syscall(SYS_FREE, ptr);
}
// Constants and algorithm from https://en.wikipedia.org/wiki/Permuted_congruential_generator
static uint64_t s_rand_state = 0x4d595df4d0f33173;

View File

@@ -273,7 +273,6 @@ const char* strerrordesc_np(int error)
return "Unknown error";
}
size_t strlen(const char* str)
{
size_t len = 0;

View File

@@ -32,11 +32,11 @@ long syscall(long syscall, ...)
uintptr_t arg3 = va_arg(args, uintptr_t);
uintptr_t arg4 = va_arg(args, uintptr_t);
uintptr_t arg5 = va_arg(args, uintptr_t);
va_end(args);
long ret = Kernel::syscall(syscall, arg1, arg2, arg3, arg4, arg5);
if (ret < 0)
{
errno = -ret;
@@ -78,7 +78,7 @@ int execl(const char* pathname, const char* arg0, ...)
char* temp = nullptr;
return execv(pathname, &temp);
}
va_list ap;
va_start(ap, arg0);
int argc = 1;