Skip to content

Libft ft_strsplit potential testing issue #30

@ivanjoy

Description

@ivanjoy

Line 524 and 533 both check if the return of ft_strsplit is NULL (ret == NULL) and if the returned char matrix's first element is not NULL (ret[0] != NULL), when the error message says the issue is that "Your function has return NULL (ret == NULL) or the first pointer in your tab is NULL" (ret[0] == NULL). Is this an oversight or am I misunderstanding your error message?

relevant code:

523     ret = ft_strsplit("", '*');
524     if (ret == NULL || ret[0] != NULL) //<------ Here
525     {
526         printf("Error Line %d, Funct %s : \
527                \nYour function has return NULL or the first pointer in your      tab is NULL\n", __LINE__ - 2, __func__);
528         uf_free_tab((void **)ret);
529         return (0);
530     }
and
532     ret = ft_strsplit("*********", '*');
533     if (ret == NULL || ret[0] != NULL) //<------ Here
534     {
535         printf("Error Line %d, Funct %s : \
536                \nYour function has return NULL or the first pointer in your      tab is NULL\n", __LINE__ - 2, __func__);
537         uf_free_tab((void **)ret);
538         return (0);
539     }

moderately relatedly, the __LINE__ -2 bit in each of these printfs returns the line # of the opening bracket of the if statement rather than the if statement itself.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions