From 9bb91e932857c2eacd3afc0f4223fd42e0eed883 Mon Sep 17 00:00:00 2001 From: Orgad Shaneh Date: Mon, 12 Jun 2017 13:08:57 -0700 Subject: [PATCH] Dedup release Summary: cc tamird sagar0 Closes https://github.com/facebook/rocksdb/pull/2325 Differential Revision: D5098302 Pulled By: sagar0 fbshipit-source-id: 297c5506b5d9b2ed1d7719c8caf0b96cffe503b8 --- port/win/env_win.cc | 15 +++++---------- port/win/io_win.cc | 22 ++++++++-------------- 2 files changed, 13 insertions(+), 24 deletions(-) diff --git a/port/win/env_win.cc b/port/win/env_win.cc index 1b97f756a..0b51d72f0 100644 --- a/port/win/env_win.cc +++ b/port/win/env_win.cc @@ -1088,19 +1088,14 @@ std::string Env::GenerateUniqueId() { UuidCreateSequential(&uuid); RPC_CSTR rpc_str; -#ifndef NDEBUG - assert(UuidToStringA(&uuid, &rpc_str) == RPC_S_OK); -#else - UuidToStringA(&uuid, &rpc_str); -#endif + auto status = UuidToStringA(&uuid, &rpc_str); + (void)status; + assert(status == RPC_S_OK); result = reinterpret_cast(rpc_str); -#ifndef NDEBUG - assert(RpcStringFreeA(&rpc_str) == RPC_S_OK); -#else - RpcStringFreeA(&rpc_str); -#endif + status = RpcStringFreeA(&rpc_str); + assert(status == RPC_S_OK); return result; } diff --git a/port/win/io_win.cc b/port/win/io_win.cc index 0b0eccfce..bf5d18327 100644 --- a/port/win/io_win.cc +++ b/port/win/io_win.cc @@ -32,7 +32,7 @@ bool IsPowerOfTwo(const size_t alignment) { } inline -bool IsSectorAligned(const size_t off) { +bool IsSectorAligned(const size_t off) { return (off & (kSectorSize - 1)) == 0; } @@ -194,13 +194,12 @@ WinMmapReadableFile::WinMmapReadableFile(const std::string& fileName, length_(length) {} WinMmapReadableFile::~WinMmapReadableFile() { -#ifndef NDEBUG - assert(::UnmapViewOfFile(mapped_region_)); - assert(::CloseHandle(hMap_)); -#else - ::UnmapViewOfFile(mapped_region_); - ::CloseHandle(hMap_); -#endif + BOOL ret = ::UnmapViewOfFile(mapped_region_); + (void)ret; + assert(ret); + + ret = ::CloseHandle(hMap_); + assert(ret); } Status WinMmapReadableFile::Read(uint64_t offset, size_t n, Slice* result, @@ -747,9 +746,8 @@ Status WinWritableImpl::AppendImpl(const Slice& data) { assert(data.size() < std::numeric_limits::max()); -#ifndef NDEBUG uint64_t written = 0; -#endif + (void)written; if (file_data_->use_direct_io()) { @@ -769,9 +767,7 @@ Status WinWritableImpl::AppendImpl(const Slice& data) { "Failed to pwrite for: " + file_data_->GetName(), lastError); } else { -#ifndef NDEBUG written = ret; -#endif } } else { @@ -785,9 +781,7 @@ Status WinWritableImpl::AppendImpl(const Slice& data) { lastError); } else { -#ifndef NDEBUG written = bytesWritten; -#endif } }