aboutsummaryrefslogtreecommitdiff
path: root/libft/src/dstr/ft_dstrwrap.c
blob: 0acf68496c5473e954794ba203c866dc1be85cae (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
/* ************************************************************************** */
/*                                                                            */
/*                                                        :::      ::::::::   */
/*   ft_dstrwrap.c                                      :+:      :+:    :+:   */
/*                                                    +:+ +:+         +:+     */
/*   By: charles <charles.cabergs@gmail.com>        +#+  +:+       +#+        */
/*                                                +#+#+#+#+#+   +#+           */
/*   Created: 2020/06/09 17:32:30 by charles           #+#    #+#             */
/*   Updated: 2020/06/09 17:33:57 by charles          ###   ########.fr       */
/*                                                                            */
/* ************************************************************************** */

#include "libft_dstr.h"

t_ftdstr	*ft_dstrwrap(char *str)
{
	t_ftdstr	*dstr;

	if ((dstr = (t_ftdstr*)malloc(sizeof(t_ftdstr))) == NULL)
		return (NULL);
	dstr->str = str;
	dstr->length = ft_strlen(str);
	dstr->capacity = dstr->length + 1;
	return (dstr);
}