[hackers] [scc] [libc] Make strrchr style consistent with the rest || Quentin Rameau

From: <git_AT_suckless.org>
Date: Fri, 17 Feb 2017 10:52:57 +0100 (CET)

commit 5c0f46cb8b438001dc32193afa7ce5e7270c4fef
Author: Quentin Rameau <quinq_AT_fifth.space>
AuthorDate: Fri Feb 17 01:29:50 2017 +0100
Commit: Quentin Rameau <quinq_AT_fifth.space>
CommitDate: Fri Feb 17 10:51:39 2017 +0100

    [libc] Make strrchr style consistent with the rest

diff --git a/libc/src/strrchr.c b/libc/src/strrchr.c
index 2f246d1..5b8b366 100644
--- a/libc/src/strrchr.c
+++ b/libc/src/strrchr.c
_AT_@ -5,11 +5,11 @@
 char *
 strrchr(const char *s, int c)
 {
- char *t;
+ const char *t = s;
 
- for (t = (char *) s; *t; ++t)
- /* nothing */;
+ while (*t)
+ ++t;
         while (t > s && *t != c)
                 --t;
- return (*t == c) ? t : NULL;
+ return (*t == c) ? (char *)t : NULL;
 }
Received on Fri Feb 17 2017 - 10:52:57 CET

This archive was generated by hypermail 2.3.0 : Fri Feb 17 2017 - 11:01:07 CET