Trying to trace the source of the segfault
I will breakdown the parser for a slight moment then relink it.
This commit is contained in:
@@ -3,26 +3,22 @@
|
||||
/* ::: :::::::: */
|
||||
/* ft_strcmp.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: tmaze <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* By: mndhlovu <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2018/04/03 15:38:27 by tmaze #+# #+# */
|
||||
/* Updated: 2018/04/08 15:30:24 by tmaze ### ########.fr */
|
||||
/* Created: 2018/11/07 17:33:42 by mndhlovu #+# #+# */
|
||||
/* Updated: 2018/11/09 17:56:30 by mndhlovu ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "libft.h"
|
||||
#include <string.h>
|
||||
|
||||
int ft_strcmp(const char *s1, const char *s2)
|
||||
int ft_strcmp(const char *s1, const char *s2)
|
||||
{
|
||||
int i;
|
||||
int diff;
|
||||
size_t len;
|
||||
|
||||
i = 1;
|
||||
diff = (unsigned char)s1[0] - (unsigned char)s2[0];
|
||||
while (diff == 0 && s1[i - 1] && s2[i - 1])
|
||||
{
|
||||
diff = (unsigned char)s1[i] - (unsigned char)s2[i];
|
||||
i++;
|
||||
}
|
||||
return (diff);
|
||||
len = 0;
|
||||
while (s1[len] && s2[len] && s1[len] == s2[len])
|
||||
len++;
|
||||
return ((unsigned char)s1[len] - (unsigned char)s2[len]);
|
||||
}
|
||||
|
Reference in New Issue
Block a user