summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authortjr <tjr@FreeBSD.org>2002-09-26 09:28:55 +0000
committertjr <tjr@FreeBSD.org>2002-09-26 09:28:55 +0000
commit9228738b8cc92ba9e9572b51f53ab8918f723077 (patch)
treeb4b51091d9e787c6f8cc63d55db76ccf12ddf722 /lib
parente0a783a53821c55e4e55fde1f02bd6b83e1c05f4 (diff)
downloadFreeBSD-src-9228738b8cc92ba9e9572b51f53ab8918f723077.zip
FreeBSD-src-9228738b8cc92ba9e9572b51f53ab8918f723077.tar.gz
Simplify by removing unneeded local variables and explicit null termination.
Diffstat (limited to 'lib')
-rw-r--r--lib/libc/string/wcscat.c20
1 files changed, 8 insertions, 12 deletions
diff --git a/lib/libc/string/wcscat.c b/lib/libc/string/wcscat.c
index e12d8df..1c96533 100644
--- a/lib/libc/string/wcscat.c
+++ b/lib/libc/string/wcscat.c
@@ -41,17 +41,13 @@ wcscat(s1, s2)
wchar_t * __restrict s1;
const wchar_t * __restrict s2;
{
- wchar_t *p;
- wchar_t *q;
- const wchar_t *r;
+ wchar_t *cp;
- p = s1;
- while (*p)
- p++;
- q = p;
- r = s2;
- while (*r)
- *q++ = *r++;
- *q = '\0';
- return s1;
+ cp = s1;
+ while (*cp != L'\0')
+ cp++;
+ while ((*cp++ = *s2++) != L'\0')
+ ;
+
+ return (s1);
}
OpenPOWER on IntegriCloud