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

From: <git_AT_suckless.org>
Date: Fri, 17 Feb 2017 11:01:40 +0100 (CET)

commit ff2c7c9b2b116228e9170c5b77c987572b5ad5ba
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 11:00:33 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 - 11:01:40 CET

This archive was generated by hypermail 2.3.0 : Fri Feb 17 2017 - 11:12:40 CET