From bf263810b0a47a68fae0681e6e6d2229a488c069 Mon Sep 17 00:00:00 2001 From: Charles Date: Fri, 3 Apr 2020 15:11:33 +0200 Subject: Added Dynamic string struct (no test, no doc) --- src/dstr/ft_dstrunwrap.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 src/dstr/ft_dstrunwrap.c (limited to 'src/dstr/ft_dstrunwrap.c') diff --git a/src/dstr/ft_dstrunwrap.c b/src/dstr/ft_dstrunwrap.c new file mode 100644 index 0000000..ba62a23 --- /dev/null +++ b/src/dstr/ft_dstrunwrap.c @@ -0,0 +1,22 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_dstrunwrap.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: charles +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2020/04/03 13:59:35 by charles #+# #+# */ +/* Updated: 2020/04/03 14:00:36 by charles ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include "libft_dstr.h" + +char *ft_dstrunwrap(t_ftdstr *dstr) +{ + char *tmp; + + tmp = dstr->str; + free(dstr); + return (tmp); +} -- cgit From 42316d8393d32bd88fb8e0cba6825185f78dacd0 Mon Sep 17 00:00:00 2001 From: Charles Date: Sat, 4 Apr 2020 21:28:21 +0200 Subject: Added test and doc for dynamic string --- src/dstr/ft_dstrunwrap.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/dstr/ft_dstrunwrap.c') diff --git a/src/dstr/ft_dstrunwrap.c b/src/dstr/ft_dstrunwrap.c index ba62a23..5b29b5b 100644 --- a/src/dstr/ft_dstrunwrap.c +++ b/src/dstr/ft_dstrunwrap.c @@ -6,12 +6,18 @@ /* By: charles +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2020/04/03 13:59:35 by charles #+# #+# */ -/* Updated: 2020/04/03 14:00:36 by charles ### ########.fr */ +/* Updated: 2020/04/04 19:58:41 by charles ### ########.fr */ /* */ /* ************************************************************************** */ #include "libft_dstr.h" +/* +** \brief Destroy dynamic string but keep the underlying static string +** \param dstr Dynamic string to unwrap +** \return Underlying string of the dynamic one +*/ + char *ft_dstrunwrap(t_ftdstr *dstr) { char *tmp; -- cgit