Liu Steven (12020-01-31): > Just more safe than without check. This is a mistake, a common one: this is not safer, it is less: the caller has the incorrect assumption that their pointer is not NULL, and you are letting them keep it, and even in some extents validating it.
> I think if it return -EINVAL maybe better than NULL, is it? If it was possible (you accurately noticed that not), it would be actually worse because it introduce a extra case for something that is not supposed to happen in the first place. Remember, FFmpeg is programmed in C, not Java or Python: when the programmers do something stupid, like dividing by 0 or dereferencing NULL, the program crashes: this is the correct behavior. Unless there is a useful semantic to give to the NULL case, crashing immediately is the right behavior. And saying the user "the protocol you specified does not exist" when the issue is they did not specify a protocol is not a useful semantic. Regards, -- Nicolas George
signature.asc
Description: PGP signature
_______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".