From: Duilio P. <dp...@fc...> - 2004-10-06 17:11:04
|
> IMHO these visual_log() serves just for debug, but not for the > programmers and methods to enable programmers to get the error messages > should be allowed. Shure, that's the only purpose of visual_log(). For checking function's preconditions, we have visual_log_return_{val_}if_fail(). Still missing an unified framework for the values that this methods will return, which is exactly what you propose. > * Better Error Handling: > > Take a look at visual_video_new: > > video = visual_mem_new0 (VisVideo, 1); > > Great, you allocated nothing, NULL is returned and where is it checked? > Nowhere... visual_mem_new0() never returns NULL, if cannot get it a new chunk of memory, it shows a message an raises an error. > What about visual_video_new_with_buffer()? > > VisVideo *visual_video_new_with_buffer (int width, int height, > VisVideoDepth depth) > { > VisVideo *video; > int ret; > > video = visual_video_new (); > > Uncaught error... > > visual_video_set_depth (video, depth); > > another... This is true. > visual_video_set_dimension (video, width, height); > > even another... Another one. > video->screenbuffer = NULL; > ret = visual_video_allocate_buffer (video); > > another... > > if (ret < 0) { > /* > * Restore the flag set by visual_video_new(). > */ > video->flags = > VISUAL_VIDEO_FLAG_EXTERNAL_BUFFER; > visual_video_free (video); > return NULL; > } > > return video; > } I think your idea is right. I guess Dennis has not done this yet waiting for 0.1.8, the really, really cleaned up release :-) Bye, Duilio. |