[pan] remove register storage class from cc code



commit 79677ce1208e80e2a18202d2b4268db97a0c7c52
Author: Dominique Dumont <dod debian org>
Date:   Wed Oct 20 17:55:50 2021 +0200

    remove register storage class from cc code
    
    or code included in C++ files.
    
    I've left register in pan/gui/xface.c as it does not trigger warnings
    
    register storage class is deprecated in C++ 17.
    
    See https://stackoverflow.com/questions/3207018/register-keyword-in-c

 pan/data/parts.cc                  |  4 +--
 pan/general/file-util.cc           |  2 +-
 pan/usenet-utils/MersenneTwister.h | 56 +++++++++++++++++++-------------------
 3 files changed, 31 insertions(+), 31 deletions(-)
---
diff --git a/pan/data/parts.cc b/pan/data/parts.cc
index ce55abf..d83253c 100644
--- a/pan/data/parts.cc
+++ b/pan/data/parts.cc
@@ -76,8 +76,8 @@ namespace
                    const StringView  & mid,
                    const Quark       & key_mid)
   {
-    register uint8_t b=0, e=0;
-    register const char *k, *m;
+    uint8_t b=0, e=0;
+    const char *k, *m;
     const StringView& key (key_mid.to_view());
     const int shorter = (int) std::min (key.len, mid.len);
 
diff --git a/pan/general/file-util.cc b/pan/general/file-util.cc
index b8f066c..45c3a23 100644
--- a/pan/general/file-util.cc
+++ b/pan/general/file-util.cc
@@ -210,7 +210,7 @@ file :: sanitize (const StringView& fname)
 char*
 file :: normalize_inplace (char * filename)
 {
-  register char *in, *out;
+  char *in, *out;
   pan_return_val_if_fail (filename && *filename, filename);
 
   for (in=out=filename; *in; )
diff --git a/pan/usenet-utils/MersenneTwister.h b/pan/usenet-utils/MersenneTwister.h
index df1b9ec..6880a9c 100644
--- a/pan/usenet-utils/MersenneTwister.h
+++ b/pan/usenet-utils/MersenneTwister.h
@@ -170,9 +170,9 @@ inline void MTRand::initialize( const uint32 seed )
        // See Knuth TAOCP Vol 2, 3rd Ed, p.106 for multiplier.
        // In previous versions, most significant bits (MSBs) of the seed affect
        // only MSBs of the state array.  Modified 9 Jan 2002 by Makoto Matsumoto.
-       register uint32 *s = state;
-       register uint32 *r = state;
-       register int i = 1;
+       uint32 *s = state;
+       uint32 *r = state;
+       int i = 1;
        *s++ = seed & 0xffffffffUL;
        for( ; i < N; ++i )
        {
@@ -186,8 +186,8 @@ inline void MTRand::reload()
        // Generate N new values in state
        // Made clearer and faster by Matthew Bellew (matthew bellew home com)
        static const int MmN = int(M) - int(N);  // in case enums are unsigned
-       register uint32 *p = state;
-       register int i;
+       uint32 *p = state;
+       int i;
        for( i = N - M; i--; ++p )
                *p = twist( p[M], p[0], p[1] );
        for( i = M; --i; ++p )
@@ -213,9 +213,9 @@ inline void MTRand::seed( uint32 *const bigSeed, const uint32 seedLength )
        // in each element are discarded.
        // Just call seed() if you want to get array from /dev/urandom
        initialize(19650218UL);
-       register int i = 1;
-       register uint32 j = 0;
-       register int k = ( N > seedLength ? N : seedLength );
+       int i = 1;
+       uint32 j = 0;
+       int k = ( N > seedLength ? N : seedLength );
        for( ; k; --k )
        {
                state[i] =
@@ -249,9 +249,9 @@ inline void MTRand::seed()
        if( urandom )
        {
                uint32 bigSeed[N];
-               register uint32 *s = bigSeed;
-               register int i = N;
-               register bool success = true;
+               uint32 *s = bigSeed;
+               int i = N;
+               bool success = true;
                while( success && i-- )
                        success = fread( s++, sizeof(uint32), 1, urandom );
                fclose(urandom);
@@ -273,9 +273,9 @@ inline MTRand::MTRand()
 
 inline MTRand::MTRand( const MTRand& o )
 {
-       register const uint32 *t = o.state;
-       register uint32 *s = state;
-       register int i = N;
+       const uint32 *t = o.state;
+       uint32 *s = state;
+       int i = N;
        for( ; i--; *s++ = *t++ ) {}
        left = o.left;
        pNext = &state[N-left];
@@ -289,7 +289,7 @@ inline MTRand::uint32 MTRand::randInt()
        if( left == 0 ) reload();
        --left;
        
-       register uint32 s1;
+       uint32 s1;
        s1 = *pNext++;
        s1 ^= (s1 >> 11);
        s1 ^= (s1 <<  7) & 0x9d2c5680UL;
@@ -363,18 +363,18 @@ inline double MTRand::operator()()
 
 inline void MTRand::save( uint32* saveArray ) const
 {
-       register const uint32 *s = state;
-       register uint32 *sa = saveArray;
-       register int i = N;
+       const uint32 *s = state;
+       uint32 *sa = saveArray;
+       int i = N;
        for( ; i--; *sa++ = *s++ ) {}
        *sa = left;
 }
 
 inline void MTRand::load( uint32 *const loadArray )
 {
-       register uint32 *s = state;
-       register uint32 *la = loadArray;
-       register int i = N;
+       uint32 *s = state;
+       uint32 *la = loadArray;
+       int i = N;
        for( ; i--; *s++ = *la++ ) {}
        left = *la;
        pNext = &state[N-left];
@@ -382,16 +382,16 @@ inline void MTRand::load( uint32 *const loadArray )
 
 inline std::ostream& operator<<( std::ostream& os, const MTRand& mtrand )
 {
-       register const MTRand::uint32 *s = mtrand.state;
-       register int i = mtrand.N;
+       const MTRand::uint32 *s = mtrand.state;
+       int i = mtrand.N;
        for( ; i--; os << *s++ << "\t" ) {}
        return os << mtrand.left;
 }
 
 inline std::istream& operator>>( std::istream& is, MTRand& mtrand )
 {
-       register MTRand::uint32 *s = mtrand.state;
-       register int i = mtrand.N;
+       MTRand::uint32 *s = mtrand.state;
+       int i = mtrand.N;
        for( ; i--; is >> *s++ ) {}
        is >> mtrand.left;
        mtrand.pNext = &mtrand.state[mtrand.N-mtrand.left];
@@ -401,9 +401,9 @@ inline std::istream& operator>>( std::istream& is, MTRand& mtrand )
 inline MTRand& MTRand::operator=( const MTRand& o )
 {
        if( this == &o ) return (*this);
-       register const uint32 *t = o.state;
-       register uint32 *s = state;
-       register int i = N;
+       const uint32 *t = o.state;
+       uint32 *s = state;
+       int i = N;
        for( ; i--; *s++ = *t++ ) {}
        left = o.left;
        pNext = &state[N-left];


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]