qsort can reuse qsort_r if available.
bsearch always passes key as the first comparator argument, so we
can use it to wrap the original comparator.
Details
Details
Diff Detail
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Comment Actions
this looks good. Too good, even. Why did not we do it before?
compiler-rt/lib/sanitizer_common/sanitizer_platform_interceptors.h | ||
---|---|---|
573 ↗ | (On Diff #368829) | I'd rather place this logic in the .inc file - i.e. define the thread-local qsort interceptor if SANITIZER_INTERCEPT_QSORT && !SANITIZER_INTERCEPT_QSORT_R |
compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc | ||
---|---|---|
9982 | Wouldn't it be easier to call the qsort_r interceptor directly? | |
9987 | Let's avoid nested ifdef-else-endif-else-endif? | |
9989–9997 | do you need a !qsort_r check here to avoid defining two interceptors for qsort? |
Comment Actions
cleanup
compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc | ||
---|---|---|
9989–9997 | it was not needed with nested ifs |
Wouldn't it be easier to call the qsort_r interceptor directly?