#include "../ft_mem/ft_mem.h"
#include "ft_string.h"
#include <stdlib.h>
Go to the source code of this file.
◆ check_and_handle_alloc_error()
| static int check_and_handle_alloc_error |
( |
char ** |
p_p_ret, |
|
|
size_t |
p_p_ret_index |
|
) |
| |
|
static |
Definition at line 38 of file ft_split.c.
42 if (p_p_ret[p_p_ret_index] != NULL)
45 while (current_index < p_p_ret_index)
46 free(p_p_ret[current_index++]);
◆ count_char()
| static size_t count_char |
( |
const char * |
s, |
|
|
char |
c |
|
) |
| |
|
static |
Definition at line 17 of file ft_split.c.
26 while (*s !=
'\0' && *s == c)
◆ ft_split()
| char** ft_split |
( |
char const * |
s, |
|
|
char |
c |
|
) |
| |
Definition at line 51 of file ft_split.c.
55 const char *p_top_to_dup;
59 while (*s !=
'\0' && *s == c)
63 while (p_p_ret != NULL && *s !=
'\0')
66 while (*s !=
'\0' && *s != c)
68 p_p_ret[p_p_ret_index]
69 =
ft_substr(p_top_to_dup, 0, (
size_t)s - (
size_t)p_top_to_dup);
72 while (*s !=
'\0' && *s == c)
void * ft_calloc(size_t count, size_t size)
static int check_and_handle_alloc_error(char **p_p_ret, size_t p_p_ret_index)
static size_t count_char(const char *s, char c)
char * ft_substr(char const *s, unsigned int start, size_t len)