strlen 0 if NULL strng
This commit is contained in:
parent
bb70477db2
commit
5f76351438
2 changed files with 5 additions and 0 deletions
|
|
@ -5,6 +5,8 @@ size_t ft_strlen(const char *s)
|
|||
int i;
|
||||
|
||||
i = 0;
|
||||
if (!s)
|
||||
return (0);
|
||||
while (s[i])
|
||||
i++;
|
||||
return (i);
|
||||
|
|
|
|||
|
|
@ -7,6 +7,9 @@
|
|||
# define ABS(x) (((x) < 0) ? -(x) : (x))
|
||||
# define NEG(x) (((x) < 0) ? 1 : 0)
|
||||
# define POS(x) (((x) > 0) ? 1 : 0)
|
||||
# define MIN(a, b) ((a) < (b) ? (a) : (b))
|
||||
# define MAX(a, b) ((a) > (b) ? (a) : (b))
|
||||
# define DIST(a, b) (ABS((a) - (b)))
|
||||
|
||||
typedef struct s_list
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue