ft_bzero, norming ft_memset

This commit is contained in:
Tanguy MAZE 2018-04-06 10:54:02 +02:00
parent ca233d4b2f
commit cae2c29bc8
3 changed files with 25 additions and 6 deletions

View File

@ -6,7 +6,7 @@
# By: tmaze <marvin@42.fr> +#+ +:+ +#+ # # By: tmaze <marvin@42.fr> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ # # +#+#+#+#+#+ +#+ #
# Created: 2018/04/04 10:51:59 by tmaze #+# #+# # # Created: 2018/04/04 10:51:59 by tmaze #+# #+# #
# Updated: 2018/04/05 15:43:32 by tmaze ### ########.fr # # Updated: 2018/04/05 16:49:55 by tmaze ### ########.fr #
# # # #
#******************************************************************************# #******************************************************************************#
@ -18,6 +18,7 @@ NAME = libft.a
SRCS = \ SRCS = \
ft_memset.c \ ft_memset.c \
ft_bzero.c \
ft_strlen.c \ ft_strlen.c \
ft_strdup.c \ ft_strdup.c \
ft_strcpy.c \ ft_strcpy.c \

18
ft_bzero.c Normal file
View File

@ -0,0 +1,18 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_bzero.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: tmaze <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2018/04/05 16:43:09 by tmaze #+# #+# */
/* Updated: 2018/04/06 10:49:12 by tmaze ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
void ft_bzero(void *s, size_t n)
{
ft_memset(s, 0, n);
}

View File

@ -6,7 +6,7 @@
/* By: tmaze <marvin@42.fr> +#+ +:+ +#+ */ /* By: tmaze <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2018/04/05 15:22:55 by tmaze #+# #+# */ /* Created: 2018/04/05 15:22:55 by tmaze #+# #+# */
/* Updated: 2018/04/05 16:19:06 by tmaze ### ########.fr */ /* Updated: 2018/04/06 10:51:34 by tmaze ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -14,10 +14,10 @@
void *ft_memset(void *b, int c, size_t len) void *ft_memset(void *b, int c, size_t len)
{ {
size_t i; size_t i;
i = 0; i = 0;
while (i < len) while (i < len)
*((char*)b + i++) = c; *((char*)b + i++) = c;
return (b); return (b);
} }