clang-format
This commit is contained in:
@@ -43,26 +43,24 @@
|
||||
* C standard string function: find leftmost instance of a character
|
||||
* in a string.
|
||||
*/
|
||||
char *
|
||||
strchr(const char *s, int ch_arg)
|
||||
{
|
||||
/* avoid sign-extension problems */
|
||||
const char ch = ch_arg;
|
||||
char *strchr(const char *s, int ch_arg) {
|
||||
/* avoid sign-extension problems */
|
||||
const char ch = ch_arg;
|
||||
|
||||
/* scan from left to right */
|
||||
while (*s) {
|
||||
/* if we hit it, return it */
|
||||
if (*s == ch) {
|
||||
return (char *)s;
|
||||
}
|
||||
s++;
|
||||
}
|
||||
/* scan from left to right */
|
||||
while (*s) {
|
||||
/* if we hit it, return it */
|
||||
if (*s == ch) {
|
||||
return (char *)s;
|
||||
}
|
||||
s++;
|
||||
}
|
||||
|
||||
/* if we were looking for the 0, return that */
|
||||
if (*s == ch) {
|
||||
return (char *)s;
|
||||
}
|
||||
/* if we were looking for the 0, return that */
|
||||
if (*s == ch) {
|
||||
return (char *)s;
|
||||
}
|
||||
|
||||
/* didn't find it */
|
||||
return NULL;
|
||||
/* didn't find it */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user