scanner: Fix undefined behavior around qsort
authorFergus Dall <sidereal@google.com>
Thu, 22 Sep 2022 21:58:13 +0000 (07:58 +1000)
committerSimon Ser <contact@emersion.fr>
Tue, 3 Jan 2023 11:05:35 +0000 (11:05 +0000)
commit41aed7a38a928863d5759ac2a93251d35aa1f657
tree89bf65d07a8bd179508a72d7de9ffa0c6b814b08
parent7f1c51a55613350488fa88f283462fca18f533a1
scanner: Fix undefined behavior around qsort

According to clang, qsort cannot be passed a null pointer, even if the size is
specified to be zero. The scanner can hit this while trying to sort forward
declarations if it happens to be building a protocol file that doesn't require
any, either in the header or the source.

Signed-off-by: Fergus Dall <sidereal@google.com>
src/scanner.c