ALT Linux Team development discussions
 help / color / mirror / Atom feed
From: Aleksei Nikiforov <darktemplar@altlinux.org>
To: Ivan Zakharyaschev <imz@altlinux.org>
Cc: Anton Farygin <rider@altlinux.org>,
	ALT Linux Team development discussions <devel@lists.altlinux.org>,
	"Vladimir D. Seleznev" <vseleznv@altlinux.org>
Subject: Re: [devel] [SCM] packages/apt: heads/rework-dynamic-mmap
Date: Thu, 30 Jan 2020 12:30:41 +0300
Message-ID: <5e9b34ca-ea2e-73e1-bbdb-d5ef12c610fa@altlinux.org> (raw)
In-Reply-To: <alpine.LFD.2.20.2001291928090.6363@imap.altlinux.org>

29.01.2020 19:32, Ivan Zakharyaschev пишет:
> 
> On Wed, 29 Jan 2020, Ivan Zakharyaschev wrote:
> 
>> On Wed, 29 Jan 2020, Aleksei Nikiforov wrote:
> 
>>> Вот второй фрагмент изменений под вопросом:
>>>
>>>> @@ -544,18 +562,24 @@ bool
>>> pkgCacheGenerator::ListParser::NewProvides(pkgCache::VerIterator &Ver,
>>>>    #endif
>>>>
>>>>       // Get a structure
>>>> -   unsigned long Provides =
>>> Owner->AllocateInMap(sizeof(pkgCache::Provides));
>>>> -   if (Provides == 0)
>>>> +   const auto Provides =
>>> Owner->AllocateInMap(sizeof(pkgCache::Provides));
>>>> +   const auto idxVersion = Version.empty()
>>>> +                         ? std::experimental::optional<unsigned long>()
>>>> +                         : WriteString(Version);
>>>> +   if (!Provides || (!Version.empty() && !idxVersion))
>>>>          return false;
>>>>       Cache.HeaderP->ProvidesCount++;
>>>>
>>>>       // Fill it in
>>>> -   pkgCache::PrvIterator Prv(Cache,Cache.ProvideP +
>>> Provides,Cache.PkgP);
>>>> +   pkgCache::PrvIterator Prv(Cache,Cache.ProvideP +
>>> *Provides,Cache.PkgP);
>>>>       Prv->Version = Ver.Index();
>>>>       Prv->NextPkgProv = Ver->ProvidesList;
>>>>       Ver->ProvidesList = Prv.Index();
>>>> -   if (Version.empty() == false && (Prv->ProvideVersion =
>>> WriteString(Version)) == 0)
>>>> -      return false;
>>>> +
>>>> +   if (Version.empty() == false)
>>>> +   {
>>>> +      Prv->ProvideVersion = *idxVersion;
>>>> +   }
>>>>
>>>>       // Locate the target package
>>>>       pkgCache::PkgIterator Pkg;
> 
> У меня возник вопрос: а в случае, если Version.empty() истинно, нужно ли
> как-то заполнять Prv->ProvideVersion специально?
> 
> Раньше (то, что минусами отмечено) в таком случае Prv->ProvideVersion
> никак не трогали (потому что происходил shortcut в вычислении &&).
> 

Сложно ответить на этот вопрос, но на всякий случай выставлять особое 
значение "ноль" думаю повредить не должно.

С уважением,
Алексей Никифоров


  reply	other threads:[~2020-01-30  9:30 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-29 16:24   ` Ivan Zakharyaschev
2020-01-29 16:32     ` Ivan Zakharyaschev
2020-01-30  9:30       ` Aleksei Nikiforov [this message]
2020-01-30  8:56     ` Aleksei Nikiforov
2020-02-11 13:47       ` Ivan Zakharyaschev
2020-02-11 13:51         ` [devel] std::optional; was: " Ivan Zakharyaschev
2020-02-11 20:06           ` [devel] std::optional Dmitry V. Levin
2020-02-11 14:00         ` [devel] [SCM] packages/apt: heads/rework-dynamic-mmap Dmitry V. Levin
2020-02-11 14:24           ` Ivan Zakharyaschev
2020-02-11 17:05             ` Ivan Zakharyaschev
2020-02-11 18:14               ` Dmitry V. Levin
2020-02-12  2:14                 ` Ivan Zakharyaschev
2020-02-12  8:47                   ` Dmitry V. Levin

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=5e9b34ca-ea2e-73e1-bbdb-d5ef12c610fa@altlinux.org \
    --to=darktemplar@altlinux.org \
    --cc=devel@lists.altlinux.org \
    --cc=imz@altlinux.org \
    --cc=rider@altlinux.org \
    --cc=vseleznv@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