-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathget_next_line_bonus.h
41 lines (35 loc) · 1.81 KB
/
get_next_line_bonus.h
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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* get_next_line_bonus.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: aschenk <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/01/11 14:02:24 by aschenk #+# #+# */
/* Updated: 2024/01/17 19:02:06 by aschenk ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef GET_NEXT_LINE_BONUS_H
# define GET_NEXT_LINE_BONUS_H
// Default value of 42 for BUFFER_SIZE if not defined during compilation
# ifndef BUFFER_SIZE
# define BUFFER_SIZE 42
# endif
// Default value of 1024 for available file descriptors.
// You can check the actual number via 'cat /proc/sys/fs/file-max';
// it's a staggering '9223372036854775807' on my system!
// It is a stretch to allocate an array with this amount of entries, but if
// need be, you can easily adjust while compiling via the '-D FD_SIZE_=n' flag.
# ifndef FD_SIZE
# define FD_SIZE 1024
# endif
# include <stdlib.h> // malloc(), free()
# include <unistd.h> // read()
# include <stddef.h> // size_t
# include <stdint.h> // SIZE_MAX
char *ft_stash_buf_join(char *stash, char *buffer); // in utils
char *ft_strchr(const char *s, int c); // in utils
char *ft_trim_until_newline(char *stash); // in utils
void *ft_calloc(size_t nmemb, size_t size);
char *get_next_line(int fd);
#endif