-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_newbuffer.c
26 lines (23 loc) · 1.18 KB
/
ft_newbuffer.c
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
26
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_newbuffer.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cyildiri <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/10/29 18:04:30 by cyildiri #+# #+# */
/* Updated: 2016/10/29 18:15:39 by cyildiri ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
t_buff *ft_newbuffer(int buffer_len, size_t elem_size)
{
t_buff *buff;
if (!(buff = (t_buff *)ft_memalloc(sizeof(t_buff))))
return (NULL);
if (!(buff->buffer = ft_memalloc(elem_size * buffer_len)))
return (NULL);
buff->buffer_len = buffer_len;
buff->buf_util = 0;
return (buff);
}