}
int cmp_int(const int *a, const int *b) {
- assert(a);
- assert(b);
+ /* This is called from qsort()s inner loops. Correctly implemented qsort will never pass NULL so we
+ just suppress the check via POINTER_MAY_BE_NULL instead of assert() to avoid the runtime cost. */
+ POINTER_MAY_BE_NULL(a);
+ POINTER_MAY_BE_NULL(b);
return CMP(*a, *b);
}
int cmp_uint16(const uint16_t *a, const uint16_t *b) {
- assert(a);
- assert(b);
+ /* This is called from qsort()s inner loops. Correctly implemented qsort will never pass NULL so we
+ just suppress the check via POINTER_MAY_BE_NULL instead of assert() to avoid the runtime cost. */
+ POINTER_MAY_BE_NULL(a);
+ POINTER_MAY_BE_NULL(b);
return CMP(*a, *b);
}
}
static int str_compare(char * const *a, char * const *b) {
- assert(a);
- assert(b);
+ /* This is called from qsort()s inner loops. Correctly implemented qsort will never pass NULL so we
+ just suppress the check via POINTER_MAY_BE_NULL instead of assert() to avoid the runtime cost. */
+ POINTER_MAY_BE_NULL(a);
+ POINTER_MAY_BE_NULL(b);
return strcmp(*a, *b);
}
}
static int job_compare_id(Job * const *a, Job * const *b) {
- assert(a);
- assert(b);
- assert(*a);
- assert(*b);
+ /* This is called from qsort()s inner loops. Correctly implemented qsort will never pass NULL so we
+ just suppress the check via POINTER_MAY_BE_NULL instead of assert() to avoid the runtime cost. */
+ POINTER_MAY_BE_NULL(a);
+ POINTER_MAY_BE_NULL(b);
return CMP((*a)->id, (*b)->id);
}
static int table_data_compare(const size_t *a, const size_t *b, Table *t) {
int r;
- assert(a);
- assert(b);
+ /* This is called from qsort()s inner loops. Correctly implemented qsort will never pass NULL so we
+ just suppress the check via POINTER_MAY_BE_NULL instead of assert() to avoid the runtime cost. */
+ POINTER_MAY_BE_NULL(a);
+ POINTER_MAY_BE_NULL(b);
assert(t);
assert(t->sort_map);