ell.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
From: Andrew Zaborowski <andrew.zaborowski@intel.com>
To: ell@lists.01.org
Subject: Re: [PATCH] queue: Fix an l_queue_insert corner case
Date: Tue, 02 Mar 2021 16:21:06 +0100	[thread overview]
Message-ID: <CAOq732+bJkphExwAf7A38QRP0aE9q_tP7rVS4tRQD9FV+2Nfog@mail.gmail.com> (raw)
In-Reply-To: <5542e25b-28f7-9450-255e-b485b9ff5b13@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1276 bytes --]

Hi Denis,

On Tue, 2 Mar 2021 at 16:03, Denis Kenzior <denkenz@gmail.com> wrote:
> On 3/1/21 4:57 PM, Andrew Zaborowski wrote:
> > The comment doc for the function says:
> >
> >   * Inserts @data pointer at a position in the queue determined by the
> >   * compare @function.  @function should return > 0 if the @data (first
> >   * parameter) should be inserted after the current entry (second parameter).
> >
>
> Right.  But the docs don't say anything about treatment of 0 returns.

Right, or about the treatment of any other value.

With this wording I'm pretty sure anyone you ask is going to interpret this as:

 - insert after current entry if returned value > 0
 - insert before current entry otherwise

>
> > however the function would insert @data after entries for which
> > @function returned a >= 0 value.  Change the check to > 0 to align with
> > the docs.
>
> The intent is that values that are 'equal' (@function returns 0) are inserted
> _after_ any entries already in the queue.  While not documented explicitly, I'm
> pretty sure that this is the only sensible behavior (and likely something we
> implicitly rely on).  So, I'm not sure this is the right fix?

We can change the docs to much that intent then...

Best regards

  reply	other threads:[~2021-03-02 15:21 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-01 22:57 [PATCH] queue: Fix an l_queue_insert corner case Andrew Zaborowski
2021-03-02 15:03 ` Denis Kenzior
2021-03-02 15:21   ` Andrew Zaborowski [this message]
2021-03-02 16:30     ` Denis Kenzior

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=CAOq732+bJkphExwAf7A38QRP0aE9q_tP7rVS4tRQD9FV+2Nfog@mail.gmail.com \
    --to=andrew.zaborowski@intel.com \
    --cc=ell@lists.01.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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).