bsearch: return NULL without calling compare function if count==0.

This is explicitly required in C99 and later.
This commit is contained in:
Stephen Heumann 2023-02-17 20:31:55 -06:00
parent b3f028da2f
commit b03e462125
1 changed files with 4 additions and 0 deletions

View File

@ -333,6 +333,10 @@ addr equ 13 address of array element of index test
csubroutine (4:key,4:base,4:count,4:size,4:compar),16
lda count if count is 0 then
ora count+2
jeq lb5 just return a null pointer
lda compar patch the call address
sta >jsl+1
lda compar+1