Thread (5 messages) flat view 5 messages, 3 authors, 2016-12-21

Re: [PATCH 1/3] compat: add qsort_s()

From: Jeff King <hidden>
Date: 2016-12-01 20:26:09

On Thu, Dec 01, 2016 at 12:22:37PM -0800, Junio C Hamano wrote:
Junio C Hamano [off-list ref] writes:
quoted
Eh, wait.  BSD and Microsoft have paramters reordered in the
callback comparison function.  I suspect that would not fly very
well.
Hmm.  We could do it like this, which may not be too bad.
Heh. Exactly, but I was too lazy to write it out in my other email. :)

The no-cost version would be more like:

#ifdef APPLE_QSORT_R
#define DECLARE_CMP(func) int func(void *data, const void *va, const void *vb)
#else
#define DECLARE_CMP(func) int func(const void *va, const void *vb, void *data)
#endif

and then:

  DECLARE_CMP(foocmp);
  ...

  DECLARE_CMP(foocmp)
  {
	const struct foo *a = va, *b = vb;
	... etc ...
  }

-Peff
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help