clang-format

This commit is contained in:
2024-09-10 13:03:02 -04:00
parent 53c617d779
commit d66450e427
381 changed files with 28864 additions and 34170 deletions

View File

@@ -43,27 +43,25 @@
* C standard string function: find rightmost instance of a character
* in a string.
*/
char *
strrchr(const char *s, int ch_arg)
{
/* avoid sign-extension problems */
const char ch = ch_arg;
char *strrchr(const char *s, int ch_arg) {
/* avoid sign-extension problems */
const char ch = ch_arg;
/* start one past the last character INCLUDING NULL TERMINATOR */
size_t i = strlen(s)+1;
/* start one past the last character INCLUDING NULL TERMINATOR */
size_t i = strlen(s) + 1;
/* go from right to left; stop at 0 */
while (i > 0) {
/* go from right to left; stop at 0 */
while (i > 0) {
/* decrement first */
i--;
/* decrement first */
i--;
/* now check the character we're over */
if (s[i] == ch) {
return (char *)(s+i);
}
}
/* now check the character we're over */
if (s[i] == ch) {
return (char *)(s + i);
}
}
/* didn't find it */
return NULL;
/* didn't find it */
return NULL;
}