Improve SDL API function argument validation