From 2bbbc11246253909bf154a2efc543eb6413cf79a Mon Sep 17 00:00:00 2001 From: Jonas 'Sortie' Termansen Date: Wed, 24 Sep 2014 21:01:51 +0200 Subject: [PATCH] Update strcpy(3) and wcscpy(3) to current coding conventions. --- libc/string/strcpy.cpp | 10 +++++----- libc/wchar/wcscpy.cpp | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/libc/string/strcpy.cpp b/libc/string/strcpy.cpp index 1b367024..fdb6a94e 100644 --- a/libc/string/strcpy.cpp +++ b/libc/string/strcpy.cpp @@ -26,9 +26,9 @@ extern "C" char* strcpy(char* dest, const char* src) { - char* origdest = dest; - while ( *src ) - *dest++ = *src++; - *dest = '\0'; - return origdest; + size_t index; + for ( index = 0; src[index]; index++ ) + dest[index] = src[index]; + dest[index] = '\0'; + return dest; } diff --git a/libc/wchar/wcscpy.cpp b/libc/wchar/wcscpy.cpp index 89f9caad..9e5d2325 100644 --- a/libc/wchar/wcscpy.cpp +++ b/libc/wchar/wcscpy.cpp @@ -26,9 +26,9 @@ extern "C" wchar_t* wcscpy(wchar_t* dest, const wchar_t* src) { - wchar_t* origdest = dest; - while ( *src ) - *dest++ = *src++; - *dest = '\0'; - return origdest; + size_t index; + for ( index = 0; src[index]; index++ ) + dest[index] = src[index]; + dest[index] = '\0'; + return dest; }