refactor: only the usefull header
- Removing all 'libft.h' mention - Using the include only on the files needed by
This commit is contained in:
parent
afb804195a
commit
905ffd4b72
48 changed files with 142 additions and 120 deletions
|
|
@ -6,11 +6,14 @@
|
|||
/* By: rparodi <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2023/11/14 17:27:44 by rparodi #+# #+# */
|
||||
/* Updated: 2024/10/31 18:01:28 by rparodi ### ########.fr */
|
||||
/* Updated: 2025/09/01 17:58:00 by rparodi ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "libft.h"
|
||||
#include "str.h"
|
||||
#include <stdarg.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
|
||||
void _print_char(int fd, char c, int *ret_value);
|
||||
void _print_nbr(int fd, int nb, int *ret_value);
|
||||
|
|
|
|||
|
|
@ -6,18 +6,13 @@
|
|||
/* By: rparodi <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2023/11/16 12:13:14 by rparodi #+# #+# */
|
||||
/* Updated: 2024/10/31 16:16:45 by rparodi ### ########.fr */
|
||||
/* Updated: 2025/09/01 17:57:36 by rparodi ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "libft.h"
|
||||
|
||||
void _print_char(int fd, char c, int *ret_value);
|
||||
void _print_nbr(int fd, int nb, int *ret_value);
|
||||
void _print_base(\
|
||||
int fd, unsigned long long nbr, int *ret_value, char c);
|
||||
void _print_unsigned(int fd, unsigned int nb, int *ret_value);
|
||||
void _print_str(int fd, char *str, int *ret_value);
|
||||
#include "str.h"
|
||||
#include <limits.h>
|
||||
#include <unistd.h>
|
||||
|
||||
void _print_char(int fd, char c, int *ret_value)
|
||||
{
|
||||
|
|
@ -25,6 +20,25 @@ void _print_char(int fd, char c, int *ret_value)
|
|||
(*ret_value)++;
|
||||
}
|
||||
|
||||
void _print_unsigned(int fd, unsigned int nb, int *ret_value)
|
||||
{
|
||||
if (nb >= 10)
|
||||
{
|
||||
_print_unsigned(fd, nb / 10, ret_value);
|
||||
nb = nb % 10;
|
||||
}
|
||||
if (nb < 10)
|
||||
_print_char(fd, nb + 48, ret_value);
|
||||
}
|
||||
|
||||
void _print_str(int fd, char *str, int *ret_value)
|
||||
{
|
||||
if (!str)
|
||||
*ret_value += write(fd, "(null)", 6);
|
||||
else
|
||||
*ret_value += write(fd, str, ft_strlen(str));
|
||||
}
|
||||
|
||||
void _print_nbr(int fd, int nb, int *ret_value)
|
||||
{
|
||||
if (nb < 0)
|
||||
|
|
@ -36,8 +50,7 @@ void _print_nbr(int fd, int nb, int *ret_value)
|
|||
return ;
|
||||
}
|
||||
nb = -nb;
|
||||
_print_char(fd, '-', ret_value);
|
||||
}
|
||||
_print_char(fd, '-', ret_value); }
|
||||
if (nb >= 10)
|
||||
{
|
||||
_print_nbr(fd, nb / 10, ret_value);
|
||||
|
|
@ -76,22 +89,3 @@ void _print_base(\
|
|||
_print_char(fd, base[nbr % 16], ret_value);
|
||||
}
|
||||
}
|
||||
|
||||
void _print_unsigned(int fd, unsigned int nb, int *ret_value)
|
||||
{
|
||||
if (nb >= 10)
|
||||
{
|
||||
_print_unsigned(fd, nb / 10, ret_value);
|
||||
nb = nb % 10;
|
||||
}
|
||||
if (nb < 10)
|
||||
_print_char(fd, nb + 48, ret_value);
|
||||
}
|
||||
|
||||
void _print_str(int fd, char *str, int *ret_value)
|
||||
{
|
||||
if (!str)
|
||||
*ret_value += write(fd, "(null)", 6);
|
||||
else
|
||||
*ret_value += write(fd, str, ft_strlen(str));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,11 +6,11 @@
|
|||
/* By: rparodi <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2023/11/09 13:58:22 by rparodi #+# #+# */
|
||||
/* Updated: 2024/10/31 18:02:37 by rparodi ### ########.fr */
|
||||
/* Updated: 2025/09/01 17:46:44 by rparodi ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "libft.h"
|
||||
#include <unistd.h>
|
||||
|
||||
/**
|
||||
* @brief print an character on a file descriptor
|
||||
|
|
|
|||
|
|
@ -6,11 +6,11 @@
|
|||
/* By: rparodi <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2023/11/09 13:59:01 by rparodi #+# #+# */
|
||||
/* Updated: 2024/10/31 18:03:47 by rparodi ### ########.fr */
|
||||
/* Updated: 2025/09/01 17:46:30 by rparodi ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "libft.h"
|
||||
#include "print.h"
|
||||
|
||||
/**
|
||||
* @brief Print a string follow by a new line on a file descriptor
|
||||
|
|
|
|||
|
|
@ -6,11 +6,13 @@
|
|||
/* By: rparodi <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2023/11/09 13:59:18 by rparodi #+# #+# */
|
||||
/* Updated: 2024/10/31 18:04:17 by rparodi ### ########.fr */
|
||||
/* Updated: 2025/09/01 17:47:41 by rparodi ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "libft.h"
|
||||
#include "print.h"
|
||||
#include "memory.h"
|
||||
#include <unistd.h>
|
||||
|
||||
static int ft_check_sign(int n, char *str, size_t *i, int fd)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -6,11 +6,12 @@
|
|||
/* By: rparodi <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2023/11/09 13:58:46 by rparodi #+# #+# */
|
||||
/* Updated: 2024/10/31 18:05:11 by rparodi ### ########.fr */
|
||||
/* Updated: 2025/09/01 17:48:07 by rparodi ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "libft.h"
|
||||
#include "str.h"
|
||||
#include <unistd.h>
|
||||
|
||||
/**
|
||||
* @brief print a string on a file descriptor
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue