From: Dennis S. <sy...@yo...> - 2004-07-02 21:13:41
|
On Fri, 2004-07-02 at 11:56 -0300, Duilio Javier Protti wrote: > Why not just freed the video->screenbuffer if it is an allocated > buffer, and set the new one? Because if I do this, what value must > contain the video->flags? The reason we don't do this is because a user can swap buffers and the such. We shouldn't do un expected behavior regarding the screenbuffer allocation management. Be very careful with automating the screenbuffer memory management. (Or rather limit this as much as possible) Although I do agree with the ALLOCATED flags changes. > The problem is that the void* not give us information about where > it points, if it is an allocated or an external buffer. > > I was thinking about adding a flag argument to visual_video_set_buffer() > to give this info, but I'm not shure, we must trust so much on the > client and the interface will be more 'hard' to learn. What do you think > about it? If a user allocates his own screenbuffer the memory management is also in his hands. He can use the free_with_buffer calls to free his buffer or do it manually with his own frees. In most cases a user that allocates a buffer himself would be using visual_video_allocate stuff. The visual_video_set_buffer must be seen as a real low level call and not too much highlevelness should be done here. > > Of course there are other possibilities such as changing the semantic > of the constructors. I like more this option, but need discussion. > > > Also, please have a space between everything and '('. > > I don't understand this. Do you mean change 'if (x)' for 'if ( x )'? > I like that, but is not the style you use on the sources. I meant HAVE_ALLOCATED_BUFFER(video). I don't make an exception for macros. I always have spaces between 'blah' and '(' :) Thanks a lot, Dennis |