Last active
August 5, 2021 11:09
-
-
Save siefca/03cf5a90280c28342081da5f2b1f03bd to your computer and use it in GitHub Desktop.
streq
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <string.h> | |
#undef streq | |
#ifndef STREQ | |
# define STREQ streq | |
#endif | |
int | |
STREQ (const char *p1, const char *p2) | |
{ | |
const unsigned char *s1 = (const unsigned char *) p1; | |
const unsigned char *s2 = (const unsigned char *) p2; | |
unsigned char c1, c2; | |
do | |
{ | |
c1 = (unsigned char) *s1++; | |
c2 = (unsigned char) *s2++; | |
} | |
while (c1 == c2 && c1 != '\0'); | |
return (c1 == c2); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment