From 640017411c7d423e9375892337b423230aaab894 Mon Sep 17 00:00:00 2001 From: Yury Gribov Date: Fri, 30 Jan 2015 06:18:46 +0000 Subject: [PATCH] Replace code dup with a macro. Differential Revision: http://reviews.llvm.org/D7172 llvm-svn: 227559 --- compiler-rt/lib/asan/asan_report.cc | 2 +- compiler-rt/lib/msan/msan_interceptors.cc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/compiler-rt/lib/asan/asan_report.cc b/compiler-rt/lib/asan/asan_report.cc index b632ccee2c8a..8706d5decc0b 100644 --- a/compiler-rt/lib/asan/asan_report.cc +++ b/compiler-rt/lib/asan/asan_report.cc @@ -53,7 +53,7 @@ void AppendToErrorMessageBuffer(const char *buffer) { buffer, remaining); error_message_buffer[error_message_buffer_size - 1] = '\0'; // FIXME: reallocate the buffer instead of truncating the message. - error_message_buffer_pos += remaining > length ? length : remaining; + error_message_buffer_pos += Min(remaining, length); } } diff --git a/compiler-rt/lib/msan/msan_interceptors.cc b/compiler-rt/lib/msan/msan_interceptors.cc index 8e521b16fd71..71fccd5feb3d 100644 --- a/compiler-rt/lib/msan/msan_interceptors.cc +++ b/compiler-rt/lib/msan/msan_interceptors.cc @@ -952,7 +952,7 @@ INTERCEPTOR(SSIZE_T, recvfrom, int fd, void *buf, SIZE_T len, int flags, __msan_unpoison(buf, res); if (srcaddr) { SIZE_T sz = *addrlen; - __msan_unpoison(srcaddr, (sz < srcaddr_sz) ? sz : srcaddr_sz); + __msan_unpoison(srcaddr, Min(sz, srcaddr_sz)); } } return res; -- GitLab