ALT Linux Team development discussions
 help / color / mirror / Atom feed
From: "Dmitry V. Levin" <ldv@altlinux.org>
To: ALT Devel discussion list <devel@lists.altlinux.org>
Subject: [devel] [PATCH apt 2/3] apt-pkg/contrib/mmap.cc: revert confusing change of Flags to this->Flags
Date: Tue, 10 Dec 2019 02:56:49 +0300
Message-ID: <20191209235648.GB15867@altlinux.org> (raw)
In-Reply-To: <20191209235406.GA15810@altlinux.org>

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


  parent reply	other threads:[~2019-12-09 23:56 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-06 13:16 [devel] [PATCH for apt 1/2] Add option for debugging DynamicMMap::Allocate Aleksei Nikiforov
2019-12-06 13:16 ` [devel] [PATCH for apt 2/2] Fix pointer arithmetics Aleksei Nikiforov
2019-12-06 13:36   ` Ivan A. Melnikov
2019-12-06 15:32     ` Aleksei Nikiforov
2019-12-06 15:36     ` [devel] [PATCH for apt 2/2 v2] " Aleksei Nikiforov
2019-12-07 14:52       ` Andrey Savchenko
2019-12-08 22:56         ` Dmitry V. Levin
2019-12-09  6:54         ` Aleksei Nikiforov
2019-12-12 19:20           ` Andrey Savchenko
2019-12-13  7:58             ` Aleksei Nikiforov
2019-12-08 23:21       ` Dmitry V. Levin
2019-12-09  7:08         ` Aleksei Nikiforov
2019-12-10  0:07           ` Dmitry V. Levin
2019-12-10  8:18             ` Aleksei Nikiforov
2019-12-10 10:20               ` Dmitry V. Levin
2019-12-10 10:58                 ` Aleksei Nikiforov
2019-12-10 22:20                   ` Dmitry V. Levin
2019-12-11  7:50                     ` Aleksei Nikiforov
2019-12-12 19:43                       ` Andrey Savchenko
2019-12-13  8:01                         ` Aleksei Nikiforov
2019-12-08 23:31   ` [devel] [PATCH for apt 2/2] " Dmitry V. Levin
2019-12-09  7:09     ` Aleksei Nikiforov
2019-12-09  7:16     ` [devel] [PATCH for apt 2/2 v3] " Aleksei Nikiforov
2019-12-09 23:54   ` [devel] [PATCH apt 0/3] Fix 0.5.15lorg2-alt70~9 fallout Dmitry V. Levin
2019-12-09 23:56     ` [devel] [PATCH apt 1/3] apt-pkg/cacheiterators.h: revert #include <set> Dmitry V. Levin
2019-12-09 23:56     ` Dmitry V. Levin [this message]
2019-12-09 23:56     ` [devel] [PATCH apt 3/3] Fix UB in pointer arithmetic Dmitry V. Levin
2019-12-10  8:18       ` Aleksei Nikiforov
2019-12-08 22:50 ` [devel] [PATCH for apt 1/2] Add option for debugging DynamicMMap::Allocate Dmitry V. Levin
2019-12-09  6:58   ` Aleksei Nikiforov
2019-12-09 10:24     ` Dmitry V. Levin
2019-12-09 11:03       ` [devel] [PATCH for apt 1/2 v3] Add Debug::DynamicMMap::Allocate option Aleksei Nikiforov
2019-12-09 22:59         ` Dmitry V. Levin
2019-12-09  7:00   ` [devel] [PATCH for apt 1/2 v2] Add option for debugging Debug::DynamicMMap::Allocate Aleksei Nikiforov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191209235648.GB15867@altlinux.org \
    --to=ldv@altlinux.org \
    --cc=devel@lists.altlinux.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

ALT Linux Team development discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://lore.altlinux.org/devel/0 devel/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 devel devel/ http://lore.altlinux.org/devel \
		devel@altlinux.org devel@altlinux.ru devel@lists.altlinux.org devel@lists.altlinux.ru devel@linux.iplabs.ru mandrake-russian@linuxteam.iplabs.ru sisyphus@linuxteam.iplabs.ru
	public-inbox-index devel

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://lore.altlinux.org/org.altlinux.lists.devel


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git