From 167d5e33fcb821e51e2f9dcf460591737c3c7972 Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Tue, 3 Jan 2006 14:50:18 +0000 Subject: Complete split of all the string functions. Hope haven't broken too much. wcscoll/strcoll needs some love ... --- libc/string/strrchr.c | 31 +++++++++++++++++++++++++------ 1 file changed, 25 insertions(+), 6 deletions(-) (limited to 'libc/string/strrchr.c') diff --git a/libc/string/strrchr.c b/libc/string/strrchr.c index 374abb694..cb30afea7 100644 --- a/libc/string/strrchr.c +++ b/libc/string/strrchr.c @@ -1,16 +1,35 @@ /* + * Copyright (C) 2002 Manuel Novoa III * Copyright (C) 2000-2005 Erik Andersen * * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. */ -#define L_strrchr -#define Wstrrchr __strrchr +#include "_string.h" -#include "wstring.c" +#ifdef WANT_WIDE +# define __Wstrrchr __wcsrchr +# define Wstrrchr wcsrchr +#else +# define __Wstrrchr __strrchr +# define Wstrrchr strrchr +#endif -strong_alias(__strrchr, strrchr) +Wchar attribute_hidden *__Wstrrchr(register const Wchar *s, Wint c) +{ + register const Wchar *p; -weak_alias(strrchr, rindex) + p = NULL; + do { + if (*s == (Wchar) c) { + p = s; + } + } while (*s++); -#undef L_strrchr + return (Wchar *) p; /* silence the warning */ +} + +strong_alias(__Wstrrchr,Wstrrchr) +#ifndef WANT_WIDE +strong_alias(__strrchr,rindex) +#endif -- cgit v1.2.3