Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Libft ft_strsplit potential testing issue #30

Open
ivanjoy opened this issue Jun 27, 2017 · 2 comments
Open

Libft ft_strsplit potential testing issue #30

ivanjoy opened this issue Jun 27, 2017 · 2 comments

Comments

@ivanjoy
Copy link

ivanjoy commented Jun 27, 2017

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.

@QuentinPerez
Copy link
Owner

Hi @ivanjoy, yes the message is not really relevant

@gabtoubl
Copy link

@QuentinPerez I think that what @ivanjoy means is that if (ret == NULL || ret[0] != NULL) should be if (ret == NULL || ret[0] == NULL)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants