19# include <sys/types.h>
21# define BUFFER_SIZE 128
275 __attribute__((format(printf, 2, 3)));
691void *
ft_calloc(
size_t count,
size_t size);
704bool ft_realloc(
char **buff,
size_t cap,
size_t newcap);
718long min(
long a,
long b);
728long max(
long a,
long b);
752long power(
int a,
int b);
764size_t modulo(
long a,
size_t b);
808void *
ft_memchr(const
void *s,
int c,
size_t n);
819int ft_memcmp(const
void *s1, const
void *s2,
size_t n);
832void *
ft_memcpy(
void *dst, const
void *src,
size_t n);
843void *
ft_memmove(
void *dst, const
void *src,
size_t len);
854void *
ft_memset(
void *b,
int c,
size_t len);
869int ft_vdprintf(
int fd, const
char *fstring, va_list args);
884int ft_dprintf(
int fd, const
char *fstring, ...)
885 __attribute__((format(printf, 2, 3)));
895int ft_vprintf(const
char *fstring, va_list args);
910 __attribute__((format(printf, 1, 2)));
996char *
str_chr(const
char *s,
int c);
1016void str_iteri(
char *s,
void (*f)(
unsigned int,
char*));
1028char *
str_join(
char const *s1,
char const *s2);
1039size_t str_lcat(
char *dst, const
char *src,
size_t dstsize);
1050size_t str_lcpy(
char *dst, const
char *src,
size_t dstsize);
1071char *
str_mapi(
char const *s,
char (*f)(
unsigned int,
char));
1082int str_ncmp(const
char *s1, const
char *s2,
size_t n);
1095char *
str_nstr(const
char *haystack, const
char *needle,
size_t len);
1108char *
str_rchr(const
char *s,
int c);
1120char *
str_trim(
char const *s1,
char const *set);
1133char *
str_sub(
char const *s,
unsigned int start,
size_t len);
bool buff_adjust(t_buff *buff)
Shrinks buffer capacity to match its current length.
Definition buff_life_cycle.c:66
bool buff_read_all(t_buff *buff, int fd)
Reads all available data from a file descriptor into buffer.
Definition buff_read.c:43
bool buff_prepend(t_buff *b, const char *str, long n)
Prepends a string to the beginning of the buffer.
Definition buff_ops.c:17
void buff_free(t_buff *b)
Frees the buffer's internal data.
Definition buff_life_cycle.c:88
bool buff_append(t_buff *b, const char *str, long n)
Appends a string to the end of the buffer.
Definition buff_ops.c:74
bool buff_insert(t_buff *b, size_t index, const char *str, long n)
Inserts a string at a specific index in the buffer.
Definition buff_ops.c:45
void buff_rm_part(t_buff *buff, size_t i_start, ssize_t len)
Removes a portion of the buffer starting at i_start.
Definition buff_ops.c:108
bool buff_init(t_buff *b, size_t initial_cap)
Initializes a buffer with the specified initial capacity.
Definition buff_life_cycle.c:19
t_buff * buff_dup_n(const t_buff *src, size_t n)
Duplicates up to n bytes of a buffer into a new buffer.
Definition buff_ops.c:89
bool buff_append_format(t_buff *buff, const char *fstring,...)
Appends formatted string to buffer using variadic arguments.
Definition buff_format.c:16
bool buff_append_vformat(t_buff *buff, const char *fstring, va_list args)
Appends formatted string to buffer using va_list.
Definition buff_format.c:27
int buff_read_until(t_buff *buff, int fd, char c)
Reads from a file descriptor until a specific character is found.
Definition buff_read.c:19
int buff_get_index(t_buff *buff, char c)
Finds the index of a character in the buffer.
Definition buff_utils.c:15
int ft_isdigit(int c)
Checks if a character is a digit ('0'-'9').
Definition ft_isdigit.c:13
bool ft_isincharset(char c, const char *charset)
Checks if a character is present in a character set.
Definition ft_isincharset.c:15
int ft_isalnum(int c)
Checks if a character is alphanumeric.
Definition ft_isalnum.c:13
int ft_tolower(int c)
Converts an uppercase letter to lowercase.
Definition ft_tolower.c:13
int ft_isprint(int c)
Checks if a character is printable (32-126).
Definition ft_isprint.c:13
int ft_isascii(int c)
Checks if a character is a valid ASCII character (0-127).
Definition ft_isascii.c:13
int ft_isalpha(int c)
Checks if a character is alphabetic.
Definition ft_isalpha.c:13
int ft_isspace(char c)
Checks if a character is whitespace (9-13).
Definition ft_isspace.c:13
int ft_toupper(int c)
Converts a lowercase letter to uppercase.
Definition ft_toupper.c:13
long ft_atol(const char *str)
Converts a string to a long integer.
Definition ft_atol.c:15
char * ft_ultoa_base(unsigned long n, const char *base)
Converts an unsigned long to a string in a given base.
Definition ft_ultoa_base.c:18
bool parse_int(char *s, int *out)
Parses a string to an integer with overflow detection.
Definition parse_int.c:16
char * ft_itoa(int n)
Converts an integer to a string.
Definition variants.c:20
char * ft_ltoa(long n)
Converts a long integer to a string.
Definition ft_ltoa.c:18
char * ft_utoa(unsigned int n)
Converts an unsigned integer to a string.
Definition variants.c:25
int ft_atoi(const char *str)
Converts a string to an integer.
Definition variants.c:15
t_buff * get_next_chunk(int fd, char separator)
Reads the next chunk from a file descriptor until separator is found.
Definition gnc.c:19
void get_next_chunk_free(void)
Frees all internal stashes used by get_next_chunk.
Definition gnc.c:86
t_list list_map(t_list list, void *(*f)(void *), void(*del)(void *))
Creates a new list by applying a function to each element.
Definition list_apply.c:30
void * list_get_content(t_list list, bool(*select_function)(void *))
Finds content in list matching a selection function.
Definition list_get.c:16
void list_iter(t_list lst, void(*f)(void *))
Applies a function to each element of the list.
Definition list_apply.c:16
size_t list_get_size(t_list list)
Calculates the number of nodes in the list.
Definition list_size.c:15
void * list_get_content_n(t_list list, size_t index)
Gets content at a specific index in the list.
Definition list_get.c:32
bool list_add_end(t_list *list, void *new_content)
Adds a new element at the end of the list.
Definition list_life_cycle.c:31
void list_rm(t_list *list, t_node *node, void(*del_content)(void *))
Removes a specific node from the list.
Definition list_life_cycle.c:54
t_node * list_get_node_last(t_list list)
Gets the last node in the list.
Definition list_get.c:69
t_node * node_new(void *content, t_node *prev, t_node *next)
Creates a new list node.
Definition node.c:16
void node_free(t_node **node, void(*del_content)(void *))
Frees a node and optionally its content.
Definition node.c:29
bool list_add_start(t_list *list, void *new_content)
Adds a new element at the start of the list.
Definition list_life_cycle.c:16
void list_rm_all(t_list *list, void(*del_content)(void *))
Removes all nodes from the list.
Definition list_life_cycle.c:74
void * list_get_content_last(t_list list)
Gets the content of the last node in the list.
Definition list_get.c:42
t_node * list_get_node_n(t_list list, size_t index)
Gets the node at a specific index in the list.
Definition list_get.c:52
bool ft_realloc(char **buff, size_t cap, size_t newcap)
Reallocates a buffer to a new capacity.
Definition ft_realloc.c:16
void * ft_calloc(size_t count, size_t size)
Allocates and zeroes memory for an array.
Definition ft_calloc.c:17
long min(long a, long b)
Returns the minimum of two long integers.
Definition min_max_abs.c:15
int square_root_exact(int nb)
Calculates the exact integer square root.
Definition square_root.c:13
size_t modulo(long a, size_t b)
Computes the modulo of a signed integer with an unsigned modulus.
Definition modulo.c:15
long max(long a, long b)
Returns the maximum of two long integers.
Definition min_max_abs.c:23
int square_root_rounded(int nb)
Calculates the nearest integer square root.
Definition square_root.c:29
long power(int a, int b)
Computes a raised to the power of b.
Definition power.c:1
size_t absolute(long nbr)
Returns the absolute value of a long integer.
Definition min_max_abs.c:31
int ft_memcmp(const void *s1, const void *s2, size_t n)
Compares two memory areas byte by byte.
Definition ft_memcmp.c:15
void * ft_memset(void *b, int c, size_t len)
Fills memory with a constant byte.
Definition ft_memset.c:15
void ft_bzero(void *s, size_t n)
Sets n bytes of memory to zero.
Definition ft_bzero.c:15
void * ft_memcpy(void *dst, const void *src, size_t n)
Copies n bytes from src to dst.
Definition ft_memcpy.c:15
void * ft_memchr(const void *s, int c, size_t n)
Locates the first occurrence of a byte in memory.
Definition ft_memchr.c:15
void * ft_memmove(void *dst, const void *src, size_t len)
Copies n bytes from src to dst, handling overlapping memory.
Definition ft_memmove.c:15
int ft_dprintf(int fd, const char *fstring,...)
Writes formatted output to a file descriptor.
Definition printer.c:36
int ft_vprintf(const char *fstring, va_list args)
Writes formatted output to stdout using va_list.
Definition printer.c:49
int ft_printf(const char *fstring,...)
Writes formatted output to stdout.
Definition printer.c:54
int ft_vdprintf(int fd, const char *fstring, va_list args)
Writes formatted output to a file descriptor using va_list.
Definition printer.c:18
void ft_putnbr_fd(int n, int fd)
Writes an integer to a file descriptor.
Definition ft_putnbr_fd.c:17
void ft_putstr_fd(char *s, int fd)
Writes a string to a file descriptor.
Definition ft_putstr_fd.c:16
void ft_putendl_fd(char *s, int fd)
Writes a string followed by newline to a file descriptor.
Definition ft_putendl_fd.c:16
char ** str_split(char const *s, char c)
Splits a string into an array of strings using a delimiter.
Definition str_split.c:18
char * str_join(char const *s1, char const *s2)
Concatenates two strings into a new string.
Definition str_join.c:16
size_t str_lcat(char *dst, const char *src, size_t dstsize)
Appends src to dst with size limit.
Definition str_lcat.c:15
size_t str_len(const char *s)
Calculates the length of a string.
Definition str_len.c:15
size_t str_lcpy(char *dst, const char *src, size_t dstsize)
Copies src to dst with size limit.
Definition str_lcpy.c:15
char * str_mapi(char const *s, char(*f)(unsigned int, char))
Creates a new string by applying a function to each character.
Definition str_mapi.c:16
char * str_nstr(const char *haystack, const char *needle, size_t len)
Locates a substring within a string, limited by length.
Definition str_nstr.c:15
char * str_sub(char const *s, unsigned int start, size_t len)
Extracts a substring from a string.
Definition str_sub.c:16
char * str_rchr(const char *s, int c)
Locates the last occurrence of a character in a string.
Definition str_rchr.c:15
char * str_chr(const char *s, int c)
Locates the first occurrence of a character in a string.
Definition str_strchr.c:15
void str_iteri(char *s, void(*f)(unsigned int, char *))
Applies a function to each character of a string with its index.
Definition str_iteri.c:13
char * str_trim(char const *s1, char const *set)
Trims characters from the beginning and end of a string.
Definition str_trim.c:18
char * str_dup(const char *s1)
Duplicates a string.
Definition str_dup.c:18
int str_ncmp(const char *s1, const char *s2, size_t n)
Compares at most n characters of two strings.
Definition str_ncmp.c:15
size_t str_count_words(char const *s, char sep)
Counts words in a string separated by a delimiter.
Definition str_split.c:47
void str_array_free(char ***tab_ptr)
Frees all strings in a null-terminated array and the tab itself.
Definition str_split.c:87
void ft_putchar_fd(char c, int fd)
Writes a character to a file descriptor.
Definition ft_putchar_fd.c:15
t_node * t_list
Type alias for a pointer to a list node (list head).
Definition libft.h:63
Dynamic buffer structure for efficient string/data manipulation.
Definition libft.h:32
size_t cap
Current allocated capacity (in bytes).
Definition libft.h:36
size_t len
Current length of data in the buffer (in bytes).
Definition libft.h:38
char * data
Pointer to the allocated data (owned by the buffer).
Definition libft.h:34
Doubly linked list node structure.
Definition libft.h:50
void * content
Pointer to the node's content (owned by the node).
Definition libft.h:52
struct s_node * next
Pointer to the next node (borrowed, may be NULL).
Definition libft.h:56
struct s_node * prev
Pointer to the previous node (borrowed, may be NULL).
Definition libft.h:54