diff options
author | Joseph Hunkeler <jhunkeler@gmail.com> | 2011-05-03 10:10:59 -0400 |
---|---|---|
committer | Joseph Hunkeler <jhunkeler@gmail.com> | 2011-05-03 10:10:59 -0400 |
commit | ff108a1414736fe057b4eada10f4a8c3dc32ac39 (patch) | |
tree | 942d28cad437dd20bf29cb60ad58ad4949b87c96 /compat/strchrnul.c | |
parent | 91af8f14863a516ff9aa80b703d8a34583e6e107 (diff) | |
parent | 4957bf13b26a403271c9838a9b74b9f61682fa8e (diff) | |
download | duser-ff108a1414736fe057b4eada10f4a8c3dc32ac39.tar.gz |
Merge pull request #5 from extrarius/master.
Various code clean ups to solve potential problems
Diffstat (limited to 'compat/strchrnul.c')
-rw-r--r-- | compat/strchrnul.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/compat/strchrnul.c b/compat/strchrnul.c index ffc4f85..da8898b 100644 --- a/compat/strchrnul.c +++ b/compat/strchrnul.c @@ -18,9 +18,8 @@ * along with duser. If not, see <http://www.gnu.org/licenses/>. **/ -#include <stdio.h> #include <string.h> -#include <ctype.h> +#include "strchrnul.h" /* * Locate a char in a string @@ -35,10 +34,12 @@ * if c is not found in s, then it returns a pointer to the * null byte at the end of s, rather than NULL. */ -char *strchrnul(const char* s, int c) +char * +strchrnul (const char *s, int c_in) { - while(*s && *s != c) - { - s++; - } + char c = c_in; + while (*s && (*s != c)) + s++; + + return (char *) s; } |