minishell icon indicating copy to clipboard operation
minishell copied to clipboard

[LIB] Add new linked list functions to libft

Open itislu opened this issue 1 year ago • 3 comments

  • ~~ft_lstadd_back_eff()~~ ft_lstadd_back_tail()
  • ~~ft_lstnew_back_eff()~~ ft_lstnew_back_tail()
  • ft_lstdup()
  • ft_lstsize_d()

The efficient versions of ft_lstadd_back expect a tail pointer of the list to avoid traversing the whole list. I made those function in an older, unmerged branch in February already.

itislu avatar Jun 07 '24 17:06 itislu

I think *_eff is really confused, why not just replace the logic?

LeaYeh avatar Jun 08 '24 22:06 LeaYeh

Because it requires a tail pointer as a third argument. The caller has to provide that, which would require to add that parameter to all calls of ft_lstadd_back() and ft_lstnew_back().

itislu avatar Jun 08 '24 22:06 itislu

I see the interface change, but i will suggest you to use efficient but not the brief

LeaYeh avatar Jun 08 '24 22:06 LeaYeh

I renamed the functions:

  • ft_lstadd_back_eff() -> ft_lstadd_back_tail()
  • ft_lstnew_back_eff() -> ft_lstnew_back_tail()

itislu avatar May 28 '25 22:05 itislu