diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2010-10-19 23:07:49 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2010-10-19 23:07:49 +0200 |
commit | 0016bcee374606e79c48a1a97479b0521f947942 (patch) | |
tree | cad91be9d3821dfb26f433b19ca0fb24d9c1ba8a /libbb/safe_strncpy.c | |
parent | ef6c6d8cfef071435ccf275ad404a501626b706c (diff) | |
download | busybox-w32-0016bcee374606e79c48a1a97479b0521f947942.tar.gz busybox-w32-0016bcee374606e79c48a1a97479b0521f947942.tar.bz2 busybox-w32-0016bcee374606e79c48a1a97479b0521f947942.zip |
klogd: do not log partial lines
function old new delta
overlapping_strcpy 15 18 +3
klogd_main 438 436 -2
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'libbb/safe_strncpy.c')
-rw-r--r-- | libbb/safe_strncpy.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/libbb/safe_strncpy.c b/libbb/safe_strncpy.c index 8eb6a014f..5eb0db0bd 100644 --- a/libbb/safe_strncpy.c +++ b/libbb/safe_strncpy.c | |||
@@ -20,8 +20,13 @@ char* FAST_FUNC safe_strncpy(char *dst, const char *src, size_t size) | |||
20 | /* Like strcpy but can copy overlapping strings. */ | 20 | /* Like strcpy but can copy overlapping strings. */ |
21 | void FAST_FUNC overlapping_strcpy(char *dst, const char *src) | 21 | void FAST_FUNC overlapping_strcpy(char *dst, const char *src) |
22 | { | 22 | { |
23 | while ((*dst = *src) != '\0') { | 23 | /* Cheap optimization for dst == src case - |
24 | dst++; | 24 | * better to have it here than in many callers. |
25 | src++; | 25 | */ |
26 | if (dst != src) { | ||
27 | while ((*dst = *src) != '\0') { | ||
28 | dst++; | ||
29 | src++; | ||
30 | } | ||
26 | } | 31 | } |
27 | } | 32 | } |