-=| Damyan Ivanov, 05.06.2015 12:04:09 +0000 |=-
> Hi,
> 
> Attached is a patch that fixes failure to build firebird 3.0 on 
> Debian/kfreebsd (that's Debian system with GNU userland and FreeBSD 
> kernel).

Here's the patch itself.
Description: USE_QSORT_CTX on Debian/kFreeBSD
 If qsort_r is available, use it on all platforms. Use the platform-specific
 code otherwise.
 .
 Fixes a build failure on Debian/kFreeBSD which has qsort_r and defines
 FREEBSD, fooling the logic:
 https://buildd.debian.org/status/fetch.php?pkg=firebird3.0&arch=kfreebsd-amd64&ver=3.0.0~svn+61579.ds4-2&stamp=1433428041
Author: Damyan Ivanov <d...@debian.org>

--- a/src/jrd/recsrc/HashJoin.cpp
+++ b/src/jrd/recsrc/HashJoin.cpp
@@ -52,6 +52,7 @@ namespace
 	  qsort_compare_callback compare;
 	};
 
+#ifndef HAVE_QSORT_R
 #if defined(WIN_NT) || defined(DARWIN) || defined(FREEBSD)
 	int qsort_ctx_arg_swap(void* arg, const void* a1, const void* a2)
 	{
@@ -59,18 +60,16 @@ namespace
 	  return (ss->compare)(a1, a2, ss->arg);
 	}
 #endif
+#endif
 
 #define USE_QSORT_CTX
 
 	void qsort_ctx(void* base, size_t count, size_t width, qsort_compare_callback compare, void* arg)
 	{
-#if defined(LINUX)
 #ifdef HAVE_QSORT_R
 		qsort_r(base, count, width, compare, arg);
 #else
-#undef USE_QSORT_CTX
-#endif
-#elif defined(WIN_NT)
+#if defined(WIN_NT)
 		struct qsort_ctx_data tmp = {arg, compare};
 		qsort_s(base, count, width, &qsort_ctx_arg_swap, &tmp);
 #elif defined(DARWIN) || defined(FREEBSD)
@@ -79,6 +78,7 @@ namespace
 #else
 #undef USE_QSORT_CTX
 #endif
+#endif
 	}
 
 } // namespace
------------------------------------------------------------------------------
Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel

Reply via email to