From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Date: Tue, 10 Dec 2019 02:56:49 +0300 From: "Dmitry V. Levin" To: ALT Devel discussion list Message-ID: <20191209235648.GB15867@altlinux.org> References: <20191209235406.GA15810@altlinux.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191209235406.GA15810@altlinux.org> Subject: [devel] [PATCH apt 2/3] apt-pkg/contrib/mmap.cc: revert confusing change of Flags to this->Flags X-BeenThere: devel@lists.altlinux.org X-Mailman-Version: 2.1.12 Precedence: list Reply-To: ALT Linux Team development discussions List-Id: ALT Linux Team development discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Dec 2019 23:56:50 -0000 Archived-At: List-Archive: List-Post: Commit 6d5e6a689d07de8feef2cbecb24bc42d5994861b aka 0.5.15lorg2-alt70~9 among other changes replaced Flags with this->Flags in many places where this is not just unnecessary but also confusing. Only those places where this->Flags is modified had to be changed this way. Fixes: 6d5e6a68 ("apt-pkg/pkgcachegen.{cc,h} changes") --- apt/apt-pkg/contrib/mmap.cc | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/apt/apt-pkg/contrib/mmap.cc b/apt/apt-pkg/contrib/mmap.cc index a3b06cc..2064fc4 100644 --- a/apt/apt-pkg/contrib/mmap.cc +++ b/apt/apt-pkg/contrib/mmap.cc @@ -46,7 +46,7 @@ MMap::MMap(FileFd &F,unsigned long Flags) : Flags(Flags), iSize(0), Base(nullptr) { - if ((this->Flags & NoImmMap) != NoImmMap) + if ((Flags & NoImmMap) != NoImmMap) Map(F); } /*}}}*/ @@ -76,9 +76,9 @@ bool MMap::Map(FileFd &Fd) // Set the permissions. int Prot = PROT_READ; int Map = MAP_SHARED; - if ((this->Flags & ReadOnly) != ReadOnly) + if ((Flags & ReadOnly) != ReadOnly) Prot |= PROT_WRITE; - if ((this->Flags & Public) != Public) + if ((Flags & Public) != Public) Map = MAP_PRIVATE; if (iSize == 0) @@ -97,7 +97,7 @@ bool MMap::Map(FileFd &Fd) /* */ bool MMap::Close(bool DoSync) { - if ((this->Flags & UnMapped) == UnMapped || validData() == false || iSize == 0) + if ((Flags & UnMapped) == UnMapped || validData() == false || iSize == 0) return true; if (DoSync == true) @@ -117,11 +117,11 @@ bool MMap::Close(bool DoSync) not return till all IO is complete */ bool MMap::Sync() { - if ((this->Flags & UnMapped) == UnMapped) + if ((Flags & UnMapped) == UnMapped) return true; #ifdef _POSIX_SYNCHRONIZED_IO - if ((this->Flags & ReadOnly) != ReadOnly) + if ((Flags & ReadOnly) != ReadOnly) if (msync((char *)Base,iSize,MS_SYNC) != 0) return _error->Errno("msync","Unable to write mmap"); #endif @@ -133,12 +133,12 @@ bool MMap::Sync() /* */ bool MMap::Sync(unsigned long Start,unsigned long Stop) { - if ((this->Flags & UnMapped) == UnMapped) + if ((Flags & UnMapped) == UnMapped) return true; #ifdef _POSIX_SYNCHRONIZED_IO unsigned long PSize = sysconf(_SC_PAGESIZE); - if ((this->Flags & ReadOnly) != ReadOnly) + if ((Flags & ReadOnly) != ReadOnly) if (msync((char *)Base+(int)(Start/PSize)*PSize,Stop - Start,MS_SYNC) != 0) return _error->Errno("msync","Unable to write mmap"); #endif @@ -362,7 +362,7 @@ bool DynamicMMap::Grow(unsigned long long size) { void *tmp_base = MAP_FAILED; #ifdef MREMAP_MAYMOVE - if ((this->Flags & Moveable) == Moveable) + if ((Flags & Moveable) == Moveable) tmp_base = mremap(Base, WorkSpace, newSize, MREMAP_MAYMOVE); else #endif @@ -376,7 +376,7 @@ bool DynamicMMap::Grow(unsigned long long size) Base = tmp_base; } else { - if ((this->Flags & Moveable) != Moveable) + if ((Flags & Moveable) != Moveable) return false; void *tmp_base = realloc(Base, newSize); -- ldv