-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathutils_1.c
53 lines (46 loc) · 1.46 KB
/
utils_1.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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* utils_1.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: jaesjeon <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/11/03 11:59:53 by jaesjeon #+# #+# */
/* Updated: 2022/11/12 19:01:53 by jaesjeon ### ########.fr */
/* */
/* ************************************************************************** */
#include "cub3d.h"
#include <stdlib.h>
void multi_free(void *ptr1, void *ptr2, void *ptr3, void *ptr4)
{
free(ptr1);
free(ptr2);
free(ptr3);
free(ptr4);
}
void *my_malloc(size_t len)
{
void *ptr;
ptr = malloc(len);
if (ptr == NULL)
exit_with_err("Malloc error", E_NOMEM);
return (ptr);
}
void ft_memset(void *ptr, unsigned char value, size_t size)
{
size_t idx;
unsigned char *target;
target = (unsigned char *)ptr;
idx = 0;
while (idx < size)
target[idx++] = value;
}
void remove_newline(char *line)
{
while (*line)
{
if (*line == '\n')
*line = '\0';
line++;
}
}