git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v2] compat: Add simplified merge sort implementation from glibc

From
BDBrian Downing <bdowning-ou/tddhfglreowh0uzbu5w@public.gmane.org>
Date
Feb 6, 2008, 02:47 UTC
Message-ID
<20080206024732.GR26392@lavos.net>
In-Reply-To
<alpine.LSU.1.00.0802052220500.8543-OGWIkrnhIhzN0uC3ymp8PA@public.gmane.org>
On Tue, Feb 05, 2008 at 10:21:58PM +0000, Johannes Schindelin wrote:
Show 13 quoted lines
> On Tue, 5 Feb 2008, Brian Downing wrote:
> > diff --git a/compat/qsort.c b/compat/qsort.c
> > new file mode 100644
> > index 0000000..8663889
> > --- /dev/null
> > +++ b/compat/qsort.c
> > @@ -0,0 +1,60 @@
> > +#include "../git-compat-util.h"
> > +
> > +/* This merge sort implementation is simplified from glibc's. */
> > +static void msort_with_tmp(void *b, size_t n, size_t s,
> 
> Didn't you forget to include the original copyright, as well as yours?

I (perhaps naïvely) assumed the "from glibc" would be enough. If not, the original is:

/* An alternative to qsort, with an identical interface.
   This file is part of the GNU C Library.
   Copyright (C) 1992,95-97,99,2000,01,02,04 Free Software Foundation, Inc.
   Written by Mike Haertel, September 1988.
   The GNU C Library is free software; you can redistribute it and/or
   modify it under the terms of the GNU Lesser General Public
   License as published by the Free Software Foundation; either
   version 2.1 of the License, or (at your option) any later version.
   The GNU C Library is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   Lesser General Public License for more details.
   You should have received a copy of the GNU Lesser General Public
   License along with the GNU C Library; if not, write to the Free
   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
   02111-1307 USA.  */

(That was from glibc-2.3.6/stdlib/msort.c. I'm not sure of the exact version I referenced for the implementation, but it was a lot closer to 2.3.6 than the current 2.7.)

As far as my copyleft, I was just planning on it being under Git's blanket copyleft. I really only pruned and reformatted code; there's really nothing substantial to claim ownership of.

> BTW if these 60 lines have code that is really faster than Microsoft's 
> implementation of a sort, it is really fascinating to me.

Well, it's faster for us, but I bet our (usually mostly-sorted) tree input is just better for a sort like a merge sort rather than a quicksort.

-bcd
Previous: Johannes Schindelin
Message 17 of 17 in “compat: Add simplified merge sort implementation from glibc”
  1. compat: Add simplified merge sort implementation from glibcBrian Downing, Feb 5, 2008
  2. Applying patches from gmane can be dangerous.Junio C Hamano, Feb 7, 2008
  3. Nicolas PitreFeb 7, 2008
  4. Junio C HamanoFeb 7, 2008
  5. 'next' will be rewound and rebuilt after feature releases.Junio C Hamano, Feb 10, 2008
  6. Jari AaltoFeb 7, 2008
  7. Junio C HamanoFeb 7, 2008
  8. Mike HommeyFeb 7, 2008
  9. Johannes SchindelinFeb 7, 2008
  10. Brian DowningFeb 7, 2008
  11. Aidan Van DykFeb 7, 2008
  12. Brian DowningFeb 7, 2008
  13. Johannes SchindelinFeb 7, 2008
  14. Johannes SchindelinFeb 11, 2008
  15. Frank LichtenheldFeb 7, 2008
  16. Johannes SchindelinFeb 5, 2008
  17. Brian DowningFeb 6, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.