~nloomans/libft

3adb5b7a — Noah Loomans 3 years ago master
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).
8457a55e — Liewe Gutter 4 years ago
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.
f5883865 — Imre van Teylingen 4 years ago
Fix crash if there is no '=' present in envp
and give warning
c408d69a — Imre van Teylingen 4 years ago
Changed after a code review.

Largely:
- Removed strndup, cause strsub
- Created a private.h and moved all things the rest doesn't need there
241b7f9f — Imre van Teylingen 4 years ago
add ft_strndup

ft_strndup is useful when you want to create a substring from another
string
8018c00e — aholster 4 years ago
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.
add ft_getopt

This functions has been designed to be as close as possible to the
POSIX getopt, while still being norm and without using global variables.

Reference: http://man7.org/linux/man-pages/man3/getopt.3p.html
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);
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fix normify script
init: ft_strfoversplit
Next