1 file changed, +5, -5
35d9814improves readability of memchr
author
mogiya <git@mogiya.dev> on 17-03-2026 14:41 UTC
committer
mogiya <git@mogiya.dev> on 17-03-2026 14:41 UTC
parent45e8871
+5, -5
    @@ -6,7 +6,7 @@
 6 6 /*   By: mleitao <mleitao@student.42.fr>            +#+  +:+       +#+        */
 7 7 /*                                                +#+#+#+#+#+   +#+           */
 8 8 /*   Created: 2026/03/12 15:38:05 by mleitao           #+#    #+#             */
 9  -/*   Updated: 2026/03/12 16:05:19 by mleitao          ###   ########.fr       */
   9+/*   Updated: 2026/03/17 14:40:04 by mleitao          ###   ########.fr       */
1010 /*                                                                            */
1111 /* ************************************************************************** */
1212 
    @@ -14,11 +14,11 @@
1414 
1515 void	*ft_memchr(const void *s, int c, size_t n)
1616 {
17  -	const unsigned char	*usp;
  17+	const unsigned char	*p;
1818 
19  -	usp = (const unsigned char *)s;
  19+	p = (const unsigned char *)s;
2020 	while (n--)
21  -		if (*usp++ == (unsigned char)c)
22  -			return ((void *)(usp - 1));
  21+		if (*p++ == (unsigned char)c)
  22+			return ((void *)(p - 1));
2323 	return (NULL);
2424 }