ft_assign_free_str.c 1.1 KB

12345678910111213141516171819202122232425262728
  1. /* ************************************************************************** */
  2. /* */
  3. /* ::: :::::::: */
  4. /* ft_assign_free_str.c :+: :+: :+: */
  5. /* +:+ +:+ +:+ */
  6. /* By: mazimi <marvin@42.fr> +#+ +:+ +#+ */
  7. /* +#+#+#+#+#+ +#+ */
  8. /* Created: 2016/11/29 14:17:48 by mazimi #+# #+# */
  9. /* Updated: 2016/11/29 16:20:14 by mazimi ### ########.fr */
  10. /* */
  11. /* ************************************************************************** */
  12. #include "../libft.h"
  13. /*
  14. ** pass str trought f()
  15. ** free previous string
  16. ** return new value
  17. */
  18. char *ft_assign_free_str(char *str, char *(*f)(const char*))
  19. {
  20. char *tmp;
  21. tmp = f(str);
  22. ft_strdel(&str);
  23. return (tmp);
  24. }