This makes them return NULL when the haystack is NULL.
/* By: ljiriste <ljiriste@student.42prague.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/08/15 10:41:10 by ljiriste #+# #+# */
-/* Updated: 2023/12/09 15:44:56 by ljiriste ### ########.fr */
+/* Updated: 2024/07/21 19:02:33 by ljiriste ### ########.fr */
/* */
/* ************************************************************************** */
char *ft_strchr(const char *s, int c)
{
+ if (!s)
+ return (NULL);
while (*s)
{
if (*s == (char)c)
/* By: ljiriste <ljiriste@student.42prague.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/08/15 10:46:09 by ljiriste #+# #+# */
-/* Updated: 2023/12/09 15:24:36 by ljiriste ### ########.fr */
+/* Updated: 2024/07/21 18:41:05 by ljiriste ### ########.fr */
/* */
/* ************************************************************************** */
{
char *result;
+ if (!s)
+ return (NULL);
result = NULL;
while (*s)
{