Skip to content

Commit

Permalink
new norm applied
Browse files Browse the repository at this point in the history
  • Loading branch information
Francisco jesus Gata valdes committed Mar 8, 2021
1 parent feb272e commit 6766315
Show file tree
Hide file tree
Showing 40 changed files with 178 additions and 183 deletions.
22 changes: 11 additions & 11 deletions ft_atoi.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,23 @@
/* By: fgata-va <fgata-va@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/11/07 18:43:44 by fgata-va #+# #+# */
/* Updated: 2019/11/20 16:17:56 by fgata-va ### ########.fr */
/* Updated: 2021/03/04 19:04:23 by fgata-va ### ########.fr */
/* */
/* ************************************************************************** */

#include "libft.h"

static int ft_clean_garbage(int i, const char *str)
static int ft_clean_garbage(int i, const char *str)
{
while (str[i] == '\t' || str[i] == '\n' || str[i] == '\v' ||
str[i] == '\f' || str[i] == '\r' || str[i] == ' ')
while (str[i] == '\t' || str[i] == '\n' || str[i] == '\v'\
|| str[i] == '\f' || str[i] == '\r' || str[i] == ' ')
{
i++;
}
return (i);
}

static int ft_negative(int *n, const char c, int i)
static int ft_negative(int *n, const char c, int i)
{
if (c == '-' || c == '+')
{
Expand All @@ -35,9 +35,9 @@ static int ft_negative(int *n, const char c, int i)
return (i);
}

static long ft_store_nmb(int *x, const char *str, long resp, int n)
static long ft_store_nmb(int *x, const char *str, long resp, int n)
{
int i;
int i;

i = *x;
while (str[i] >= 48 && str[i] <= 57)
Expand All @@ -53,11 +53,11 @@ static long ft_store_nmb(int *x, const char *str, long resp, int n)
return (resp);
}

int ft_atoi(const char *str)
int ft_atoi(const char *str)
{
long resp;
int i;
int n;
long resp;
int i;
int n;

i = 0;
resp = 0;
Expand Down
4 changes: 2 additions & 2 deletions ft_bzero.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@
/* By: fgata-va <fgata-va@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/11/04 13:27:10 by fgata-va #+# #+# */
/* Updated: 2019/11/19 13:11:59 by fgata-va ### ########.fr */
/* Updated: 2021/03/04 19:13:37 by fgata-va ### ########.fr */
/* */
/* ************************************************************************** */

#include "libft.h"

void ft_bzero(void *s, size_t n)
{
unsigned int i;
unsigned int i;

i = 0;
while (i < n)
Expand Down
9 changes: 5 additions & 4 deletions ft_calloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,18 @@
/* By: fgata-va <fgata-va@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/11/08 15:16:28 by fgata-va #+# #+# */
/* Updated: 2019/11/19 13:11:55 by fgata-va ### ########.fr */
/* Updated: 2021/03/04 19:18:16 by fgata-va ### ########.fr */
/* */
/* ************************************************************************** */

#include "libft.h"

void *ft_calloc(size_t count, size_t size)
void *ft_calloc(size_t count, size_t size)
{
void *s;
void *s;

if (!(s = malloc(size * count)))
s = malloc(size * count);
if (!s)
return (NULL);
ft_bzero(s, count * size);
return (s);
Expand Down
4 changes: 2 additions & 2 deletions ft_isalnum.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
/* By: fgata-va <fgata-va@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/11/07 21:48:59 by fgata-va #+# #+# */
/* Updated: 2019/11/08 20:09:42 by fgata-va ### ########.fr */
/* Updated: 2021/03/04 19:04:39 by fgata-va ### ########.fr */
/* */
/* ************************************************************************** */

#include "libft.h"

int ft_isalnum(int c)
int ft_isalnum(int c)
{
if ((c >= 65 && c <= 90) || (c >= 97 && c <= 122) || (c >= 48 && c <= 57))
return (1);
Expand Down
4 changes: 2 additions & 2 deletions ft_isalpha.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
/* By: fgata-va <fgata-va@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/11/07 21:26:57 by fgata-va #+# #+# */
/* Updated: 2019/11/08 20:09:38 by fgata-va ### ########.fr */
/* Updated: 2021/03/04 19:14:03 by fgata-va ### ########.fr */
/* */
/* ************************************************************************** */

#include "libft.h"

int ft_isalpha(int c)
int ft_isalpha(int c)
{
if ((c >= 65 && c <= 90) || (c >= 97 && c <= 122))
return (1);
Expand Down
4 changes: 2 additions & 2 deletions ft_isascii.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
/* By: fgata-va <fgata-va@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/11/07 21:51:21 by fgata-va #+# #+# */
/* Updated: 2019/11/10 23:34:39 by fgata-va ### ########.fr */
/* Updated: 2021/03/04 19:16:51 by fgata-va ### ########.fr */
/* */
/* ************************************************************************** */

#include "libft.h"

int ft_isascii(int c)
int ft_isascii(int c)
{
if (c >= 0 && c <= 127)
return (1);
Expand Down
4 changes: 2 additions & 2 deletions ft_isdigit.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
/* By: fgata-va <fgata-va@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/11/07 21:35:46 by fgata-va #+# #+# */
/* Updated: 2019/11/10 19:04:26 by fgata-va ### ########.fr */
/* Updated: 2021/03/04 19:06:24 by fgata-va ### ########.fr */
/* */
/* ************************************************************************** */

#include "libft.h"

int ft_isdigit(int c)
int ft_isdigit(int c)
{
if (c >= 48 && c <= 57)
return (1);
Expand Down
4 changes: 2 additions & 2 deletions ft_isprint.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
/* By: fgata-va <fgata-va@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/11/07 21:53:24 by fgata-va #+# #+# */
/* Updated: 2019/11/10 19:04:36 by fgata-va ### ########.fr */
/* Updated: 2021/03/04 19:14:19 by fgata-va ### ########.fr */
/* */
/* ************************************************************************** */

#include "libft.h"

int ft_isprint(int c)
int ft_isprint(int c)
{
if (c >= 32 && c <= 126)
return (1);
Expand Down
12 changes: 6 additions & 6 deletions ft_itoa.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@
/* By: fgata-va <fgata-va@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/11/21 17:07:18 by fgata-va #+# #+# */
/* Updated: 2019/11/25 16:59:04 by fgata-va ### ########.fr */
/* Updated: 2021/03/04 19:17:40 by fgata-va ### ########.fr */
/* */
/* ************************************************************************** */

#include "libft.h"

static char *ft_revstr(char *str)
static char *ft_revstr(char *str)
{
char tmp[13];
int i;
int j;
char tmp[13];
int i;
int j;

i = 0;
j = ft_strlen(str) - 1;
Expand All @@ -36,7 +36,7 @@ static char *ft_revstr(char *str)
return (str);
}

char *ft_itoa(int n)
char *ft_itoa(int n)
{
char tmp[12];
char *rtmp;
Expand Down
4 changes: 2 additions & 2 deletions ft_lstclear_bonus.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@
/* By: fgata-va <fgata-va@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/11/29 18:01:40 by fgata-va #+# #+# */
/* Updated: 2019/11/29 19:07:27 by fgata-va ### ########.fr */
/* Updated: 2021/03/05 13:37:27 by fgata-va ### ########.fr */
/* */
/* ************************************************************************** */

#include "libft.h"

void ft_lstclear(t_list **lst, void (*del)(void *))
{
t_list *aux;
t_list *aux;

if (lst)
{
Expand Down
4 changes: 2 additions & 2 deletions ft_lstlast_bonus.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
/* By: fgata-va <fgata-va@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/11/29 15:13:53 by fgata-va #+# #+# */
/* Updated: 2019/11/29 15:20:21 by fgata-va ### ########.fr */
/* Updated: 2021/03/05 13:35:58 by fgata-va ### ########.fr */
/* */
/* ************************************************************************** */

#include "libft.h"

t_list *ft_lstlast(t_list *lst)
t_list *ft_lstlast(t_list *lst)
{
t_list *current;

Expand Down
16 changes: 9 additions & 7 deletions ft_lstmap_bonus.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,28 @@
/* By: fgata-va <fgata-va@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/11/29 20:36:46 by fgata-va #+# #+# */
/* Updated: 2019/12/09 11:52:34 by fgata-va ### ########.fr */
/* Updated: 2021/03/05 13:14:41 by fgata-va ### ########.fr */
/* */
/* ************************************************************************** */

#include "libft.h"

t_list *ft_lstmap(t_list *l, void *(*f)(void *), void (*d)(void *))
t_list *ft_lstmap(t_list *l, void *(*f)(void *), void (*d)(void *))
{
t_list *newlst;
t_list *rlst;
t_list *newlst;
t_list *rlst;

if (!l || !f)
if (!l || !f || !d)
return (NULL);
if (!(newlst = ft_lstnew((*f)(l->content))))
newlst = ft_lstnew((*f)(l->content));
if (!newlst)
return (NULL);
rlst = newlst;
l = l->next;
while (l)
{
if (!(newlst->next = ft_lstnew((*f)(l->content))))
newlst->next = ft_lstnew((*f)(l->content));
if (!newlst->next)
{
ft_lstclear(&rlst, d);
return (NULL);
Expand Down
7 changes: 4 additions & 3 deletions ft_lstnew_bonus.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,18 @@
/* By: fgata-va <fgata-va@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/11/27 11:03:50 by fgata-va #+# #+# */
/* Updated: 2019/11/29 12:59:34 by fgata-va ### ########.fr */
/* Updated: 2021/03/05 12:46:37 by fgata-va ### ########.fr */
/* */
/* ************************************************************************** */

#include "libft.h"

t_list *ft_lstnew(void const *content)
t_list *ft_lstnew(void const *content)
{
t_list *lst;

if (!(lst = malloc(sizeof(t_list))))
lst = malloc(sizeof(t_list));
if (!lst)
return (NULL);
lst->content = (void *)content;
lst->next = NULL;
Expand Down
4 changes: 2 additions & 2 deletions ft_lstsize_bonus.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
/* By: fgata-va <fgata-va@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/11/29 13:24:48 by fgata-va #+# #+# */
/* Updated: 2019/12/01 21:50:04 by fgata-va ### ########.fr */
/* Updated: 2021/03/05 12:51:55 by fgata-va ### ########.fr */
/* */
/* ************************************************************************** */

#include "libft.h"

int ft_lstsize(t_list *lst)
int ft_lstsize(t_list *lst)
{
int size;
t_list *current;
Expand Down
6 changes: 3 additions & 3 deletions ft_memccpy.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
/* By: fgata-va <fgata-va@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/11/05 11:28:44 by fgata-va #+# #+# */
/* Updated: 2020/02/07 16:30:51 by fgata-va ### ########.fr */
/* Updated: 2021/03/04 19:05:26 by fgata-va ### ########.fr */
/* */
/* ************************************************************************** */

Expand All @@ -19,9 +19,9 @@ void *ft_memccpy(void *dst, const void *src, int c, size_t n)
i = 0;
while (i < n)
{
((unsigned char*)dst)[i] = ((unsigned char*)src)[i];
((unsigned char *)dst)[i] = ((unsigned char *)src)[i];
i++;
if (((unsigned char*)src)[i - 1] == (unsigned char)c)
if (((unsigned char *)src)[i - 1] == (unsigned char)c)
return (dst + i);
}
return (NULL);
Expand Down
4 changes: 2 additions & 2 deletions ft_memcpy.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
/* By: fgata-va <fgata-va@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/11/05 11:10:01 by fgata-va #+# #+# */
/* Updated: 2019/11/19 13:12:51 by fgata-va ### ########.fr */
/* Updated: 2021/03/04 19:07:05 by fgata-va ### ########.fr */
/* */
/* ************************************************************************** */

#include "libft.h"

void *ft_memcpy(void *dst, const void *src, size_t n)
void *ft_memcpy(void *dst, const void *src, size_t n)
{
size_t i;
unsigned char *str1;
Expand Down
4 changes: 2 additions & 2 deletions ft_memset.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
/* By: fgata-va <fgata-va@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/11/04 12:20:43 by fgata-va #+# #+# */
/* Updated: 2019/11/19 13:13:00 by fgata-va ### ########.fr */
/* Updated: 2021/03/04 19:18:44 by fgata-va ### ########.fr */
/* */
/* ************************************************************************** */

Expand All @@ -19,7 +19,7 @@ void *ft_memset(void *b, int c, size_t len)
i = 0;
while (i < len)
{
((unsigned char*)b)[i] = (unsigned char)c;
((unsigned char *)b)[i] = (unsigned char)c;
i++;
}
return (b);
Expand Down
6 changes: 3 additions & 3 deletions ft_printf/ft_chars_strings.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@
/* By: fgata-va <fgata-va@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/01/22 13:12:55 by fgata-va #+# #+# */
/* Updated: 2020/02/11 17:58:36 by fgata-va ### ########.fr */
/* Updated: 2021/03/05 13:38:30 by fgata-va ### ########.fr */
/* */
/* ************************************************************************** */

#include "ft_printf.h"

void ft_strings(va_list ap, t_flags *data)
{
const char *str;
const char *str;

str = (const char *)va_arg(ap, const char *);
if (str && ft_strlen(str) > 0)
Expand All @@ -27,7 +27,7 @@ void ft_strings(va_list ap, t_flags *data)

void ft_chrs(va_list ap, t_flags *data)
{
char c;
char c;

c = va_arg(ap, int);
if (data->width > 0 && data->minus != 1)
Expand Down
Loading

0 comments on commit 6766315

Please sign in to comment.