FreeBSD Bugzilla – Attachment 97013 Details for
Bug 135718
[patch] enhance qsort(3) to properly handle 32-bit aligned data on 64-bit systems
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
file.diff
file.diff (text/plain), 1.06 KB, created by
jhoward
on 2009-06-18 21:30:04 UTC
(
hide
)
Description:
file.diff
Filename:
MIME Type:
Creator:
jhoward
Created:
2009-06-18 21:30:04 UTC
Size:
1.06 KB
patch
obsolete
>--- qsort.c 2009-06-18 13:32:58.000000000 -0500 >+++ qsort.c.patched 2009-06-18 14:22:02.000000000 -0500 >@@ -34,6 +34,7 @@ > __FBSDID("$FreeBSD: src/lib/libc/stdlib/qsort.c,v 1.15 2008/01/14 09:21:34 das Exp $"); > > #include <stdlib.h> >+#include <limits.h> > > #ifdef I_AM_QSORT_R > typedef int cmp_t(void *, const void *, const void *); >@@ -59,8 +60,15 @@ > } while (--i > 0); \ > } > >-#define SWAPINIT(a, es) swaptype = ((char *)a - (char *)0) % sizeof(long) || \ >+#if LONG_BIT > WORD_BIT >+#define SWAPINIT(a, es) swaptype = ((char *)a - (char *)0) % sizeof(long) || \ >+ es % sizeof(long) ? ((char *)a - (char *)0) % sizeof(int) || es % \ >+ sizeof(int) ? 3 : 2 : es == sizeof(long)? 0 : 1; >+#else >+#define SWAPINIT(a, es) swaptype = ((char *)a - (char *)0) % sizeof(long) || \ > es % sizeof(long) ? 2 : es == sizeof(long)? 0 : 1; >+#endif >+ > > static inline void > swapfunc(a, b, n, swaptype) >@@ -69,6 +77,10 @@ > { > if(swaptype <= 1) > swapcode(long, a, b, n) >+#if LONG_BIT > WORD_BIT >+ else if(swaptype <= 2) >+ swapcode(int, a, b, n) >+#endif > else > swapcode(char, a, b, n) > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 135718
:
97013
|
148195
|
152798