Linux SNPS ARC Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: andriy.shevchenko@linux.intel.com (Andy Shevchenko)
To: linux-snps-arc@lists.infradead.org
Subject: [PATCH v2 5/5] Lib: sort.h: replace int size with size_t size in the swap function
Date: Mon, 1 Apr 2019 13:28:06 +0300	[thread overview]
Message-ID: <20190401102806.GE9224@smile.fi.intel.com> (raw)
In-Reply-To: <201904010956.x319u70q021113@sdf.org>

On Mon, Apr 01, 2019@09:56:07AM +0000, George Spelvin wrote:
> On Mon, 1 Apr 2019@12:35:55 +0300, Andy Shevchenko wrote:
> > Hmm... If (*swap)() is called recursively it means the change might increase
> > stack usage on 64-bit platforms.
> > 
> > Am I missing something?
> 
> Under what conceivable circumstance would someone write a recursive
> (*swap)() function?
> 
> You're technically right, but the precondition is more fantastical
> than "if the U.K.'s parliament get their shit together before the
> 12th", so I have a hard time worrying about it.
> 
> But you did make me think of something: the whole reason swap()
> takes a size argument is for the benefit of the (no longer existing)
> generic swap functions.  All of the custom swap functions ignore
> it.
> 
> So how about *deleting* the parameter instead?  That simplifies
> everything.

I like this idea!

-- 
With Best Regards,
Andy Shevchenko

      reply	other threads:[~2019-04-01 10:28 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-31 18:28 [PATCH v2 0/5] simple sort swap function improvements Andrey Abramov
2019-03-31 18:31 ` [PATCH v2 1/5] arch/arc: unwind.c: replace swap function with built-in one Andrey Abramov
2019-04-01 17:53   ` Vineet Gupta
2019-03-31 18:35 ` [PATCH v2 2/5] powerpc: module_[32|64].c: " Andrey Abramov
2019-04-01 11:08   ` Michael Ellerman
2019-03-31 18:42 ` [PATCH v2 3/5] ocfs2: dir, refcounttree, xattr: replace swap functions " Andrey Abramov
2019-03-31 18:47 ` [PATCH v2 4/5] ubifs: find.c: replace swap function " Andrey Abramov
2019-03-31 18:52 ` [PATCH v2 5/5] Lib: sort.h: replace int size with size_t size in the swap function Andrey Abramov
2019-04-01  9:35   ` Andy Shevchenko
2019-04-01  9:56     ` George Spelvin
2019-04-01 10:28       ` Andy Shevchenko [this message]

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=20190401102806.GE9224@smile.fi.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=linux-snps-arc@lists.infradead.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