diff options
author | Vedant Kumar <vsk@apple.com> | 2015-10-01 00:22:21 +0000 |
---|---|---|
committer | Vedant Kumar <vsk@apple.com> | 2015-10-01 00:22:21 +0000 |
commit | e05b308c2300c260e9494c52b972934fc89d5f6d (patch) | |
tree | 5125ad237a8d757db22de3090fdc83be5a30613e /lib/msan/msan_allocator.cc | |
parent | 98379eaa5baabd991a6c353cbdd61b539bb369b4 (diff) |
[compiler-rt] Apply modernize-use-nullptr fixes in sanitizers
- Trim spaces.
- Use nullptr in place of 0 for pointer variables.
- Use '!p' in place of 'p == 0' for null pointer checks.
- Add blank lines to separate function definitions.
- Add 'extern "C"' or 'namespace foo' comments after the appropriate
closing brackets
This is a continuation of work from 409b7b82. The focus here is on the
various sanitizers (not sanitizer_common, as before).
Patch by Eugene Zelenko!
Differential Revision: http://reviews.llvm.org/D13225
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@248966 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/msan/msan_allocator.cc')
-rw-r--r-- | lib/msan/msan_allocator.cc | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/msan/msan_allocator.cc b/lib/msan/msan_allocator.cc index 006d993f0..865a4586b 100644 --- a/lib/msan/msan_allocator.cc +++ b/lib/msan/msan_allocator.cc @@ -165,7 +165,7 @@ void MsanDeallocate(StackTrace *stack, void *p) { void *MsanCalloc(StackTrace *stack, uptr nmemb, uptr size) { if (CallocShouldReturnNullDueToOverflow(size, nmemb)) return allocator.ReturnNullOrDie(); - return MsanReallocate(stack, 0, nmemb * size, sizeof(u64), true); + return MsanReallocate(stack, nullptr, nmemb * size, sizeof(u64), true); } void *MsanReallocate(StackTrace *stack, void *old_p, uptr new_size, @@ -174,7 +174,7 @@ void *MsanReallocate(StackTrace *stack, void *old_p, uptr new_size, return MsanAllocate(stack, new_size, alignment, zeroise); if (!new_size) { MsanDeallocate(stack, old_p); - return 0; + return nullptr; } Metadata *meta = reinterpret_cast<Metadata*>(allocator.GetMetaData(old_p)); uptr old_size = meta->requested_size; @@ -204,14 +204,14 @@ void *MsanReallocate(StackTrace *stack, void *old_p, uptr new_size, } static uptr AllocationSize(const void *p) { - if (p == 0) return 0; + if (!p) return 0; const void *beg = allocator.GetBlockBegin(p); if (beg != p) return 0; Metadata *b = (Metadata *)allocator.GetMetaData(p); return b->requested_size; } -} // namespace __msan +} // namespace __msan using namespace __msan; |