All: Cleanup all files
Add newline to end of files and remove whitespace from end of lines
This commit is contained in:
@@ -37,4 +37,4 @@ int fcntl(int fildes, int cmd, ...)
|
||||
va_end(args);
|
||||
|
||||
return syscall(SYS_FCNTL, fildes, cmd, extra);
|
||||
}
|
||||
}
|
||||
|
||||
10
libc/grp.cpp
10
libc/grp.cpp
@@ -67,7 +67,7 @@ struct group* fill_group(const BAN::Vector<BAN::StringView>& parts)
|
||||
s_group.gr_mem = nullptr;
|
||||
}
|
||||
|
||||
auto groups_or_error = parts[3].split(',');
|
||||
auto groups_or_error = parts[3].split(',');
|
||||
if (groups_or_error.is_error())
|
||||
return nullptr;
|
||||
auto groups = groups_or_error.release_value();
|
||||
@@ -79,7 +79,7 @@ struct group* fill_group(const BAN::Vector<BAN::StringView>& parts)
|
||||
s_group.gr_name = (char*)malloc(parts[0].size() + 1);
|
||||
if (s_group.gr_name == nullptr)
|
||||
return nullptr;
|
||||
memcpy(s_group.gr_name, parts[0].data(), parts[0].size());
|
||||
memcpy(s_group.gr_name, parts[0].data(), parts[0].size());
|
||||
s_group.gr_name[parts[0].size()] = '\0';
|
||||
|
||||
s_group.gr_mem = (char**)malloc((groups.size() + 1) * sizeof(char*));
|
||||
@@ -99,7 +99,7 @@ struct group* fill_group(const BAN::Vector<BAN::StringView>& parts)
|
||||
}
|
||||
memcpy(s_group.gr_mem[i], groups[i].data(), groups[i].size());
|
||||
s_group.gr_mem[i][groups[i].size()] = '\0';
|
||||
}
|
||||
}
|
||||
s_group.gr_mem[groups.size()] = nullptr;
|
||||
|
||||
return &s_group;
|
||||
@@ -110,7 +110,7 @@ struct group* getgrnam(const char* name)
|
||||
if (s_group_mmap == nullptr || s_group_mmap == MAP_FAILED)
|
||||
if (!open_group_file())
|
||||
return nullptr;
|
||||
|
||||
|
||||
off_t start = 0;
|
||||
off_t end = 0;
|
||||
while (start < s_group_st.st_size)
|
||||
@@ -138,7 +138,7 @@ struct group* getgrgid(gid_t gid)
|
||||
if (s_group_mmap == nullptr || s_group_mmap == MAP_FAILED)
|
||||
if (!open_group_file())
|
||||
return nullptr;
|
||||
|
||||
|
||||
off_t start = 0;
|
||||
off_t end = 0;
|
||||
while (start < s_group_st.st_size)
|
||||
|
||||
@@ -11,4 +11,4 @@
|
||||
#define __END_DECLS
|
||||
#endif
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -34,7 +34,7 @@ struct rlimit
|
||||
struct rusage
|
||||
{
|
||||
struct timeval ru_utime; /* User time used. */
|
||||
struct timeval ru_stime; /* System time used. */
|
||||
struct timeval ru_stime; /* System time used. */
|
||||
};
|
||||
|
||||
#define RLIMIT_CORE 0
|
||||
|
||||
@@ -24,7 +24,7 @@ typedef struct {
|
||||
} fd_set;
|
||||
|
||||
#define FD_CLR(fd, setp) \
|
||||
do { \
|
||||
do { \
|
||||
__fd_mask off = (fd) / __FD_MASK_SIZE; \
|
||||
__fd_mask bit = (fd) % __FD_MASK_SIZE; \
|
||||
(setp)->__bits[off] &= ~((__fd_mask)1 << bit); \
|
||||
@@ -38,7 +38,7 @@ typedef struct {
|
||||
})
|
||||
|
||||
#define FD_SET(fd, setp) \
|
||||
do { \
|
||||
do { \
|
||||
__fd_mask off = (fd) / __FD_MASK_SIZE; \
|
||||
__fd_mask bit = (fd) % __FD_MASK_SIZE; \
|
||||
(setp)->__bits[off] |= ((__fd_mask)1 << bit); \
|
||||
|
||||
@@ -16,7 +16,7 @@ __BEGIN_DECLS
|
||||
#define __need_uid_t
|
||||
#define __need_gid_t
|
||||
#define __need_off_t
|
||||
#define __need_time_t
|
||||
#define __need_time_t
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <time.h>
|
||||
|
||||
@@ -15,4 +15,4 @@ __BEGIN_DECLS
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -41,7 +41,7 @@ __BEGIN_DECLS
|
||||
#define _POSIX_SPIN_LOCKS -1
|
||||
#define _POSIX_SPORADIC_SERVER -1
|
||||
#define _POSIX_SYNCHRONIZED_IO xx
|
||||
#define _POSIX_THREAD_ATTR_STACKADDR -1
|
||||
#define _POSIX_THREAD_ATTR_STACKADDR -1
|
||||
#define _POSIX_THREAD_ATTR_STACKSIZE -1
|
||||
#define _POSIX_THREAD_CPUTIME -1
|
||||
#define _POSIX_THREAD_PRIO_INHERIT -1
|
||||
|
||||
@@ -209,7 +209,7 @@ void* realloc(void* ptr, size_t size)
|
||||
{
|
||||
if (ptr == nullptr)
|
||||
return malloc(size);
|
||||
|
||||
|
||||
// align size to s_malloc_default_align boundary
|
||||
if (size_t ret = size % s_malloc_default_align)
|
||||
size += s_malloc_default_align - ret;
|
||||
@@ -226,7 +226,7 @@ void* realloc(void* ptr, size_t size)
|
||||
void* new_ptr = malloc(size);
|
||||
if (new_ptr == nullptr)
|
||||
return nullptr;
|
||||
|
||||
|
||||
// move data to the new pointer
|
||||
size_t bytes_to_copy = oldsize < size ? oldsize : size;
|
||||
memcpy(new_ptr, ptr, bytes_to_copy);
|
||||
|
||||
@@ -23,4 +23,4 @@ floorl:
|
||||
|
||||
fldenv -28(%rsp) /* restore original environment */
|
||||
|
||||
ret
|
||||
ret
|
||||
|
||||
@@ -322,7 +322,7 @@ extern "C" int printf_impl(const char* format, va_list arguments, int (*putc_fun
|
||||
percision = -1;
|
||||
options.percision = percision;
|
||||
}
|
||||
|
||||
|
||||
// PARSE LENGTH
|
||||
if (*format == 'h')
|
||||
{
|
||||
|
||||
@@ -19,7 +19,7 @@ static bool open_pwent()
|
||||
if (s_pwent_fp)
|
||||
return true;
|
||||
s_pwent_fp = fopen("/etc/passwd", "r");
|
||||
return s_pwent_fp;
|
||||
return s_pwent_fp;
|
||||
}
|
||||
|
||||
static void clear_pwent(passwd& passwd)
|
||||
@@ -125,4 +125,4 @@ void setpwent(void)
|
||||
if (!s_pwent_fp)
|
||||
return;
|
||||
fseek(s_pwent_fp, 0, SEEK_SET);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ struct Conversion
|
||||
int field_width = -1;
|
||||
bool allocate = false;
|
||||
LengthModifier length = LengthModifier::none;
|
||||
char conversion = '\0';
|
||||
char conversion = '\0';
|
||||
};
|
||||
|
||||
Conversion parse_conversion_specifier(const char*& format)
|
||||
@@ -380,7 +380,7 @@ int scanf_impl(const char* format, va_list arguments, int (*__getc_fun)(void*),
|
||||
|
||||
return ConversionResult::SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
if (tolower(in) == 'n')
|
||||
{
|
||||
get_input(true);
|
||||
|
||||
@@ -17,4 +17,4 @@ void (*signal(int sig, void (*func)(int)))(int)
|
||||
{
|
||||
long ret = syscall(SYS_SIGNAL, sig, func);
|
||||
return (void (*)(int))ret;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -495,7 +495,7 @@ int ungetc(int, FILE*);
|
||||
|
||||
int vfprintf(FILE* file, const char* format, va_list arguments)
|
||||
{
|
||||
return printf_impl(format, arguments, [](int c, void* file) { return fputc(c, (FILE*)file); }, file);
|
||||
return printf_impl(format, arguments, [](int c, void* file) { return fputc(c, static_cast<FILE*>(file)); }, file);
|
||||
}
|
||||
|
||||
int vfscanf(FILE* file, const char* format, va_list arguments)
|
||||
|
||||
@@ -235,4 +235,4 @@ void srand(unsigned int seed)
|
||||
{
|
||||
s_rand_state = seed + s_rand_increment;
|
||||
(void)rand();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,4 +10,4 @@ pid_t wait(int* stat_loc)
|
||||
pid_t waitpid(pid_t pid, int* stat_loc, int options)
|
||||
{
|
||||
return (pid_t)syscall(SYS_WAIT, pid, stat_loc, options);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,4 +20,4 @@ time_t time(time_t* tloc)
|
||||
if (tloc)
|
||||
*tloc = tp.tv_sec;
|
||||
return tp.tv_sec;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ extern "C" void _init_libc(char** _environ)
|
||||
size_t env_count = 0;
|
||||
while (_environ[env_count])
|
||||
env_count++;
|
||||
|
||||
|
||||
environ = (char**)malloc(sizeof(char*) * env_count + 1);
|
||||
for (size_t i = 0; i < env_count; i++)
|
||||
{
|
||||
@@ -136,7 +136,7 @@ int execl(const char* pathname, const char* arg0, ...)
|
||||
}
|
||||
|
||||
int execle(const char* pathname, const char* arg0, ...)
|
||||
{
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
int argc = 0;
|
||||
|
||||
Reference in New Issue
Block a user