[Libreoffice-commits] core.git: sal/osl

Stephan Bergmann (via logerrit) logerrit at kemper.freedesktop.org
Thu Jun 4 21:20:50 UTC 2020


 sal/osl/unx/conditn.cxx |   14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

New commits:
commit dbcfb91c259e8397b3de20f9b3e481b4abadf996
Author:     Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Thu Jun 4 14:49:28 2020 +0200
Commit:     Stephan Bergmann <sbergman at redhat.com>
CommitDate: Thu Jun 4 23:20:17 2020 +0200

    Remove useless Result variable
    
    It always had a statically known value ever since
    9399c662f36c385b0c705eb34e636a9aec450282 "initial import".  The always-true
    check for
    
      Result == osl_cond_result_ok
    
    in the SAL_INFO invocation was apparently a glitch introduced with
    a883b6b13b67898accdc1ffe3fd9e770612352b1 "Improve logging".
    
    Change-Id: I83ebb3fb02c8f080d560fdff86a98ee5f6a9c204
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95513
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/sal/osl/unx/conditn.cxx b/sal/osl/unx/conditn.cxx
index d73d67e91b37..602240922b8c 100644
--- a/sal/osl/unx/conditn.cxx
+++ b/sal/osl/unx/conditn.cxx
@@ -172,7 +172,6 @@ oslConditionResult SAL_CALL osl_waitCondition(oslCondition Condition, const Time
 {
     oslConditionImpl* pCond;
     int nRet=0;
-    oslConditionResult Result = osl_cond_result_ok;
 
     assert(Condition);
     pCond = static_cast<oslConditionImpl*>(Condition);
@@ -206,18 +205,16 @@ oslConditionResult SAL_CALL osl_waitCondition(oslCondition Condition, const Time
                 {
                     if ( ret == ETIME || ret == ETIMEDOUT )
                     {
-                        Result = osl_cond_result_timeout;
                         nRet = pthread_mutex_unlock(&pCond->m_Lock);
                         SAL_WARN_IF( nRet != 0, "sal.osl.condition", "osl_waitCondition(" << pCond << "): pthread_mutex_unlock failed: " << UnixErrnoString(nRet) );
 
-                        return Result;
+                        return osl_cond_result_timeout;
                     }
                     if ( ret != EINTR )
                     {
-                        Result = osl_cond_result_error;
                         nRet = pthread_mutex_unlock(&pCond->m_Lock);
                         SAL_WARN_IF( nRet != 0, "sal.osl.condition", "osl_waitCondition(" << pCond << "): pthread_mutex_unlock failed: " << UnixErrnoString(nRet) );
-                        return Result;
+                        return osl_cond_result_error;
                     }
                 }
             }
@@ -232,11 +229,10 @@ oslConditionResult SAL_CALL osl_waitCondition(oslCondition Condition, const Time
             if ( nRet != 0 )
             {
                 SAL_WARN( "sal.osl.condition", "osl_waitCondition(" << pCond << "): pthread_cond_wait failed: " << UnixErrnoString(nRet) );
-                Result = osl_cond_result_error;
                 nRet = pthread_mutex_unlock(&pCond->m_Lock);
                 SAL_WARN_IF( nRet != 0, "sal.osl.condition", "osl_waitCondition(" << pCond << "): pthread_mutex_unlock failed: " << UnixErrnoString(nRet) );
 
-                return Result;
+                return osl_cond_result_error;
             }
         }
     }
@@ -244,9 +240,9 @@ oslConditionResult SAL_CALL osl_waitCondition(oslCondition Condition, const Time
     nRet = pthread_mutex_unlock(&pCond->m_Lock);
     SAL_WARN_IF( nRet != 0, "sal.osl.condition", "osl_waitCondition(" << pCond << "): pthread_mutex_unlock failed: " << UnixErrnoString(nRet) );
 
-    SAL_INFO( "sal.osl.condition", "osl_waitCondition(" << pCond << "): " << (Result == osl_cond_result_ok ? "OK" : "ERROR") );
+    SAL_INFO( "sal.osl.condition", "osl_waitCondition(" << pCond << "): OK" );
 
-    return Result;
+    return osl_cond_result_ok;
 }
 
 sal_Bool SAL_CALL osl_checkCondition(oslCondition Condition)


More information about the Libreoffice-commits mailing list