Merge "Fix unnecessary call to __strncpy_chk2"
This commit is contained in:
commit
6aed6077fb
1 changed files with 4 additions and 0 deletions
|
@ -135,6 +135,10 @@ char* strncpy(char* __restrict dest, const char* __restrict src, size_t n) {
|
||||||
return __builtin___strncpy_chk(dest, src, n, bos_dest);
|
return __builtin___strncpy_chk(dest, src, n, bos_dest);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (__builtin_constant_p(n) && (n <= bos_src)) {
|
||||||
|
return __builtin___strncpy_chk(dest, src, n, bos_dest);
|
||||||
|
}
|
||||||
|
|
||||||
size_t slen = __builtin_strlen(src);
|
size_t slen = __builtin_strlen(src);
|
||||||
if (__builtin_constant_p(slen)) {
|
if (__builtin_constant_p(slen)) {
|
||||||
return __builtin___strncpy_chk(dest, src, n, bos_dest);
|
return __builtin___strncpy_chk(dest, src, n, bos_dest);
|
||||||
|
|
Loading…
Reference in a new issue