From: Andrew Krieger Date: Tue, 29 Aug 2017 05:34:42 +0000 (-0700) Subject: Fix potentially uninitialized struct used on MSVC X-Git-Tag: v2017.09.04.00~14 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=e804df264c8e311d69244916977964f06243a614;p=folly.git Fix potentially uninitialized struct used on MSVC Summary: MSVC warns this might be used but uninitialized. Force the struct to be zero initialized. Reviewed By: yfeldblum Differential Revision: D5585320 fbshipit-source-id: 9454a2a4a66c7689f42b1eb211dc57f5d3b88fea --- diff --git a/folly/SharedMutex.h b/folly/SharedMutex.h index 0968f5ba..b6a1a263 100644 --- a/folly/SharedMutex.h +++ b/folly/SharedMutex.h @@ -850,6 +850,7 @@ class SharedMutexImpl { WaitContext& ctx) { #ifdef RUSAGE_THREAD struct rusage usage; + std::memset(&usage, 0, sizeof(usage)); long before = -1; #endif for (uint32_t yieldCount = 0; yieldCount < kMaxSoftYieldCount; @@ -1005,6 +1006,7 @@ class SharedMutexImpl { #ifdef RUSAGE_THREAD struct rusage usage; + std::memset(&usage, 0, sizeof(usage)); long before = -1; #endif for (uint32_t yieldCount = 0; yieldCount < kMaxSoftYieldCount;