From f925aea55261e863fa1317a102a9836cb5daaa64 Mon Sep 17 00:00:00 2001 From: Maieul BOYER Date: Wed, 4 Sep 2024 17:06:41 +0000 Subject: [PATCH] Normed stuff --- stdme/src/fs/file_dup.c | 3 ++- stdme/src/fs/fs_internal.c | 4 ---- stdme/src/fs/getters.c | 4 ---- stdme/src/gnl/get_next_line.c | 4 ---- stdme/src/mem/allocator.c | 4 ---- stdme/src/os/abort.c | 14 ++++++++++++-- stdme/src/os/gnu_source.h | 9 ++++++++- stdme/src/os/process.c | 2 +- stdme/src/printf/matchers.c | 4 ---- 9 files changed, 23 insertions(+), 25 deletions(-) diff --git a/stdme/src/fs/file_dup.c b/stdme/src/fs/file_dup.c index 40523a05..261beaf0 100644 --- a/stdme/src/fs/file_dup.c +++ b/stdme/src/fs/file_dup.c @@ -27,7 +27,8 @@ t_fd *dup_fd(t_fd *fd) return (NULL); tmp = dup(fd->fd); if (tmp == -1) - return (printf("There was an error while duping the fd %d `%s`\n", fd->fd, fd->name), NULL); + return (printf("There was an error while duping the "\ + "fd %d `%s`\n", fd->fd, fd->name), NULL); slot->ty = SLOT_FD; slot->slot.fd.fd = tmp; slot->slot.fd.perms = fd->perms; diff --git a/stdme/src/fs/fs_internal.c b/stdme/src/fs/fs_internal.c index c9e921fe..4ae2e275 100644 --- a/stdme/src/fs/fs_internal.c +++ b/stdme/src/fs/fs_internal.c @@ -21,10 +21,6 @@ #include #include -#ifdef static -# undef static -#endif - t_fd_array *get_fd_arrays(void) { static t_fd_array val = {}; diff --git a/stdme/src/fs/getters.c b/stdme/src/fs/getters.c index 64c5fba7..4d8894f0 100644 --- a/stdme/src/fs/getters.c +++ b/stdme/src/fs/getters.c @@ -21,10 +21,6 @@ #include #include -#ifdef static -# undef static -#endif - t_fd *get_stdin(void) { t_fd *out; diff --git a/stdme/src/gnl/get_next_line.c b/stdme/src/gnl/get_next_line.c index f84b624b..7a28a127 100644 --- a/stdme/src/gnl/get_next_line.c +++ b/stdme/src/gnl/get_next_line.c @@ -20,10 +20,6 @@ #include #include -#ifdef static -#undef static -#endif - static t_static_buffer *get_next_line_buffer(int fd) { t_usize index; diff --git a/stdme/src/mem/allocator.c b/stdme/src/mem/allocator.c index 544822e4..b9b08fdb 100644 --- a/stdme/src/mem/allocator.c +++ b/stdme/src/mem/allocator.c @@ -17,10 +17,6 @@ #include "me/types.h" #include -#ifdef static -# undef static -#endif - t_allocator *global_allocator(void) { static t_allocator global_alloc = {}; diff --git a/stdme/src/os/abort.c b/stdme/src/os/abort.c index 2f2d37a2..fa3fb68d 100644 --- a/stdme/src/os/abort.c +++ b/stdme/src/os/abort.c @@ -18,8 +18,18 @@ # define BASE_PATH "/no_base_path_defined/" #endif -#if defined(PRINT_BACKTRACE) || defined(BACKTRACE_DEEP) -// #if true // TO_REMOVE +#ifdef PRINT_BACKTRACE +# ifndef _PRINT_BACKTRACE +# define _PRINT_BACKTRACE +# endif +#endif +#ifdef BACKTRACE_DEEP +# ifndef _PRINT_BACKTRACE +# define _PRINT_BACKTRACE +# endif +#endif + +#ifdef _PRINT_BACKTRACE # ifndef BACKTRACE_DEEP # define BACKTRACE_DEEP 256 # endif diff --git a/stdme/src/os/gnu_source.h b/stdme/src/os/gnu_source.h index a848e44e..040012dc 100644 --- a/stdme/src/os/gnu_source.h +++ b/stdme/src/os/gnu_source.h @@ -15,12 +15,19 @@ # define _GNU_SOURCE -# if defined(PRINT_BACKTRACE) || defined(BACKTRACE_DEEP) +# ifdef PRINT_BACKTRACE # include # include # include # include # include # endif +# ifdef BACKTRACE_DEEP +# include +# include +# include +# include +# include +# endif #endif /* GNU_SOURCE_H */ diff --git a/stdme/src/os/process.c b/stdme/src/os/process.c index 0fa5598b..7a362bb4 100644 --- a/stdme/src/os/process.c +++ b/stdme/src/os/process.c @@ -43,7 +43,7 @@ t_error spawn_process_exec(t_spawn_info info, t_process *process) close_fd(info.stdout.fd.fd); close_fd(info.stderr.fd.fd); vec_str_push(&info.arguments, NULL); - vec_str_push(&info.environement, NULL); + vec_str_push(&info.environement, NULL); execve(info.binary_path, info.arguments.buffer, info.environement.buffer); return (ERROR); } diff --git a/stdme/src/printf/matchers.c b/stdme/src/printf/matchers.c index fc8b768d..c36d3105 100644 --- a/stdme/src/printf/matchers.c +++ b/stdme/src/printf/matchers.c @@ -17,10 +17,6 @@ #include #include -#ifdef static -# undef static -#endif - t_matcher_list *get_matchers(void) { static t_matcher_list printf_matchers = (t_matcher_list){