[MPlayer-dev-eng] [PATCH] Move declarations of vo_font, sub_font to correct header file

Bryan Henderson giraffedata at gmail.com
Tue Jun 17 05:31:51 CEST 2008


On 6/16/08, Diego Biurrun <diego at biurrun.de> wrote:
> On Mon, Jun 16, 2008 at 02:36:56AM +0000, Bryan Henderson wrote:
>> The global variables vo_font and sub_font are defined in libvo/sub.c,
>> but declared in libvo/font_load.h.  They aren't even used by the font
>> loader code.
>>
>> This patch moves the declarations to libvo/sub.h.
>
>> --- libvo/sub.h	(revision 27074)
>> +++ libvo/sub.h	(working copy)
>> @@ -50,6 +75,9 @@
>>
>> +extern struct font_desc* vo_font;
>> +extern struct font_desc* sub_font;
>
> This will likely break 'make checkheaders', the declaration of struct
> font_desc is not available in sub.h.

It should be OK.  You don't have to completely define a struct in
order to point to it, and these declarations will implicitly define
struct font_desc.

That's how one does opaque objects in C -- define the struct only in
the files that implement the object and have everyone else just pass
around opaque pointers to it.  If there aren't a ton of header files
in Mplayer that work this way already, there should be.

I tried to run 'make checkheaders' to confirm, but it seems to be
broken -- maybe because of the recent make file rewrite?  It wants to
compile every .h found by wildcard search of the tree, but at least
one of them -- cfg-common-opts.h -- is designed to function only
inside another file.



More information about the MPlayer-dev-eng mailing list