From 9abedc8d181e5c460a88e62809f746abf0f8a8c5 Mon Sep 17 00:00:00 2001 From: /dev/humancontroller Date: Sun, 13 Jul 2014 19:00:45 +0200 Subject: make strrchr() and strchr() standard-conformant --- src/game/bg_lib.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/game/bg_lib.c b/src/game/bg_lib.c index bb12f286..4f9ee094 100644 --- a/src/game/bg_lib.c +++ b/src/game/bg_lib.c @@ -269,7 +269,7 @@ char *strrchr( const char *string, int c ) int i, length = strlen( string ); char *p; - for( i = length - 1; i >= 0; i-- ) + for( i = length /*sic*/; i >= 0; i-- ) { p = (char *)&string[ i ]; @@ -289,7 +289,7 @@ char *strchr( const char *string, int c ) string++; } - return (char *)0; + return c == '\0' ? (char *)string : (char *)0; } char *strstr( const char *string, const char *strCharSet ) -- cgit