]> git.baikalelectronics.ru Git - kernel.git/commit
unifdef: use memcpy instead of strncpy
authorLinus Torvalds <torvalds@linux-foundation.org>
Fri, 30 Nov 2018 22:45:01 +0000 (14:45 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 30 Nov 2018 22:45:01 +0000 (14:45 -0800)
commit84d7fa6450d98e2e23a053a9fc872bfbb04c99a1
tree036a6170d809343dbd5969efbc937667398b56bb
parentc2d11b212b558fdab8a7b459486aed3139b6376c
unifdef: use memcpy instead of strncpy

New versions of gcc reasonably warn about the odd pattern of

strncpy(p, q, strlen(q));

which really doesn't make sense: the strncpy() ends up being just a slow
and odd way to write memcpy() in this case.

There was a comment about _why_ the code used strncpy - to avoid the
terminating NUL byte, but memcpy does the same and avoids the warning.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
scripts/unifdef.c