OSDN Git Service

Ignore spin wait requests with no designated referrer.
authorKeith Marshall <keith@users.osdn.me>
Mon, 22 Jun 2020 14:10:29 +0000 (15:10 +0100)
committerKeith Marshall <keith@users.osdn.me>
Mon, 22 Jun 2020 14:10:29 +0000 (15:10 +0100)
ChangeLog
src/pkgstat.h

index 67b2d90..4bf3af3 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 2020-06-22  Keith Marshall  <keith@users.osdn.me>
 
+       Ignore spin wait requests with no designated referrer.
+
+       * src/pkgstat.h (pkgSpinWait::UpdateIndex) [this]: Cannot test for
+       nullptr, since C++ specifies result as "undefined behaviour"; test...
+       [referrer]: ...this predesignated static class property instead.
+
+2020-06-22  Keith Marshall  <keith@users.osdn.me>
+
        Support options interpretation from an unborn options object.
 
        * src/pkgopts.h (pkgOpts::Test, pkgOpts::IsSet, pkgOpts::GetValue)
index 9337469..d312c9a 100644 (file)
@@ -4,8 +4,8 @@
  *
  * $Id$
  *
- * Written by Keith Marshall <keithmarshall@users.sourceforge.net>
- * Copyright (C) 2012, MinGW.org Project
+ * Written by Keith Marshall <keith@users.osdn.me>
+ * Copyright (C) 2012, 2020, MinGW.org Project
  *
  *
  * Public declaration of the pkgSpinWait class, which provides an
@@ -47,7 +47,7 @@ class pkgSpinWait
   protected:
     static pkgSpinWait *referrer; int index;
     pkgSpinWait( void ): index( 0 ){ referrer = this; }
-    int UpdateIndex(){ return this ? index = (1 + index) % 4 : 0; }
+    int UpdateIndex(){ return referrer ? index = (1 + index) % 4 : 0; }
     virtual int DispatchReport( const char *, va_list ) = 0;
     ~pkgSpinWait(){ referrer = NULL; }
 };