2006-12-04 Kazunori Asayama <asayama@sm.sony.co.jp>

* libc/machine/spu/strncpy.c: Add padding.
This commit is contained in:
Jeff Johnston 2006-12-04 17:29:10 +00:00
parent 3e2d7a911f
commit 489bb390ce
2 changed files with 9 additions and 0 deletions

View File

@ -1,3 +1,7 @@
2006-12-04 Kazunori Asayama <asayama@sm.sony.co.jp>
* libc/machine/spu/strncpy.c: Add padding.
2006-12-04 Kazunori Asayama <asayama@sm.sony.co.jp>
* testsuite/newlib.string/tstring.c:

View File

@ -76,6 +76,11 @@ char * strncpy(char * __restrict__ dest, const char * __restrict__ src, size_t n
*/
len = spu_extract(spu_sel(spu_promote((unsigned int)len, 0), N, gt), 0);
/* Padding
*/
if (len != n) {
memset(dest + len, 0, n - len);
}
/* Perform a memcpy of the resulting length
*/
return ((char *)memcpy((void *)dest, (const void *)src, len));