RE: [AD] Font loadin: Feature Request

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


Title: RE: [AD] Font loadin: Feature Request

> inline FONT *load_font(const char *file, const char *fnt)
> {
>       if (!file || !fnt) return NULL;
>       DATAFILE *dat = load_datafile_object(file, fnt);
>
>       if (!dat) return NULL;
>       FONT *font = (FONT *)dat->dat;
>
>       unload_datafile_object(dat);
>      
>       return font;
> }

You'd better split it in two and call the last bit unload_font, because
you'll be getting a pointer to invalid memory if you use that. I actually
use this trick, but by setting dat->dat to NULL before (it frees the list
of properties, but leaves the object itself). I then unload the object
myself.

--
Vincent Penquerc'h



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/