Merge branch 'tosh-contrib'
Merge changes made to libft for tosh
libft: fix define norm
Norme: ./libft/libft.h
Error (line 33): define must be a constant value
libft: fix naming norm error
Norme: ./ft_getopt.c
Error (line 49, col 9): _ not unixcase
libft: make all headers norm
add normify script for hand-in
Merge branch 'master' of github.com:nloomans/tosh into env
fix compile error on linux
Compile error included below:
../subprojects/libft/src/ft_getopt.c: In function ‘print_error’:
../subprojects/libft/src/ft_getopt.c:49:2: error: ignoring return value of ‘write’, declared with attribute warn_unused_result [-Werror=unused-result]
49 | write(STDERR_FILENO, argv0, ft_strlen(argv0));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../subprojects/libft/src/ft_getopt.c:50:2: error: ignoring return value of ‘write’, declared with attribute warn_unused_result [-Werror=unused-result]
50 | write(STDERR_FILENO, msg, ft_strlen(msg));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../subprojects/libft/src/ft_getopt.c:51:2: error: ignoring return value of ‘write’, declared with attribute warn_unused_result [-Werror=unused-result]
51 | write(STDERR_FILENO, &opt, 1);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../subprojects/libft/src/ft_getopt.c:52:2: error: ignoring return value of ‘write’, declared with attribute warn_unused_result [-Werror=unused-result]
52 | write(STDERR_FILENO, "\n", sizeof("\n"));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This compile error wasn't an actual issue in this case, as we can't
really do anything sane when the printing of errors fails. So let's
just ignore it instead.
The fix itself is kinda dirty (just casting the result to void directly
wasn't enough to silence it).
made memset significantly faster for very long strings.
Memory will now be set in chunks of the size of an unsigned long long,
until there are less characters left than the chunk size.
Fix crash if there is no '=' present in envp
and give warning
Changed after a code review.
Largely:
- Removed strndup, cause strsub
- Created a private.h and moved all things the rest doesn't need there
add ft_strndup
ft_strndup is useful when you want to create a substring from another
string
libft: BREAKING CHANGE: rewrite the linked list implementation
The new linked list implementation has been inspired by the list.h from
the Linux kernel. I originally used this in ft_select.
The old and now legacy t_list structure has been removed as to prevent
any confusion about which linked list implementation to use. ft_getline,
which used the old t_list implementation, has also been removed as the
function itself doesn't serve much purpose. The code itself was old and
horrible in any case.
rm src/ft_putendl_fd.c
Commit cd52fd2c ("remove the ft_put* family of functions") didn't remove
this final file.
remove ft_put* functions in Makefile
Commit cd52fd2c ("remove the ft_put* family of functions") didn't remove
the references to the files in the Makefile. This breaks all Makefile
builds.
fix sourcehut annotatec
The inc directory was not used for annotation, breaking ft_getline.c
with the following error:
Scanning 7/64 ./src/ft_getline.c ./src/ft_getline.c:15:10: fatal error: ft_getline.h: No such file or directory
15 | #include "ft_getline.h"
| ^~~~~~~~~~~~~~
compilation terminated.
0 symbols 0 references# Please enter the commit message for your changes. Lines starting
remove the ft_put* family of functions
These where poorly designed as they return an void instead of an int.
Most write functions return the amount of characters printed on success
and -1 on failure. These return a void making it impossible to test for
failure.
This will fix the following compile error:
../subprojects/libft/src/ft_putchar_fd.c: In function ‘ft_putchar_fd’:
../subprojects/libft/src/ft_putchar_fd.c:18:8: error: ignoring return value of ‘write’, declared with attribute warn_unused_result [-Werror=unused-result]
(void)write(fd, (void *)&c, (size_t)1);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~