From: Liubov Dmitrieva Date: Mon, 11 Mar 2013 13:06:38 +0000 (+0400) Subject: Inappropriate code style for Intel MPX in debug/wcpcpy_chk. Fix the code if MPX is... X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7f5505c12769e739442d52bf29903f93ff2322c2;p=thirdparty%2Fglibc.git Inappropriate code style for Intel MPX in debug/wcpcpy_chk. Fix the code if MPX is enabled. --- diff --git a/debug/wcpcpy_chk.c b/debug/wcpcpy_chk.c index 7c836e6bfba..d90f293c4a0 100644 --- a/debug/wcpcpy_chk.c +++ b/debug/wcpcpy_chk.c @@ -26,6 +26,7 @@ DEST. Check for overflows. */ wchar_t * __wcpcpy_chk (wchar_t *dest, const wchar_t *src, size_t destlen) +#ifndef __CHKP__ { wchar_t *wcp = (wchar_t *) dest - 1; wint_t c; @@ -42,3 +43,21 @@ __wcpcpy_chk (wchar_t *dest, const wchar_t *src, size_t destlen) return wcp; } +#else +{ + dest--; + wint_t c; + + do + { + if (__builtin_expect (destlen-- == 0, 0)) + __chk_fail (); + c = src[0]; + *++dest = c; + ++src; + } + while (c != L'\0'); + + return dest; +} +#endif