Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/pipeline/pass_similarity.c
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,12 @@ static int collect_fp_entries(cbm_gbuf_t *gbuf, fp_entry_t **out_entries) {
};
}
}
/* Canonicalize (determinism) — see cmp_fp_entry_by_qn. */
qsort(entries, (size_t)count, sizeof(fp_entry_t), cmp_fp_entry_by_qn);
/* Canonicalize (determinism) — see cmp_fp_entry_by_qn. Avoid passing the
* NULL empty-set buffer to qsort: libc treats zero elements as a no-op,
* but the standard function contract still requires a valid base pointer. */
if (count > 1) {
qsort(entries, (size_t)count, sizeof(fp_entry_t), cmp_fp_entry_by_qn);
}
*out_entries = entries;
return count;
}
Expand Down
Loading