mmaping FcInit

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Friday 25 March 2005 22:25, Owen Taylor wrote:
> On Fri, 2005-03-25 at 01:53 -0500, Patrick Lam wrote:
> > BTW, Owen's suggested struct:
> > struct FcPattern {
> >     int refcount;
> >     FcPatternStorage storage; /* dynamic, static */
> >
> >     union {
> >       FcPatternDynamic *dynamic;
> >       FcPatternStatic *static;
> >     } u;
> >   };
> >
> > still seems to be a struct, and thus requiring mallocness and a pointer.
>
> The point of my suggestion is that we need a single *public* structure
> for:
>
>   - Patterns retrieved from the database of fonts on disk
>   - Patterns created on the fly through the FcPattern API
>
> But that public structure can be small, lightweight, and created on
> the fly.

Do you really? FcPattern is a completely opaque type. For patterns on the 
disk, you can just return a pointer to them. All that should be needed is one 
bitflag in the pattern structure itself marking it a begin readonly, and 
using the same data structure for dynamic patterns. 

This requires using the same endianness and packing for dynamic and static 
patterns and thus makes building up dynamic pattern a little more complex, 
but I don't think the overhead would be noticable (and the code is needed for 
the cache building anyway). The advantage would the that retrieving of 
properties from the pattern could use the same code.

Cheers,
Lars

[Index of Archives]     [Fedora Fonts]     [Fedora Users]     [Fedora Cloud]     [Kernel]     [Fedora Packaging]     [Fedora Desktop]     [PAM]     [Gimp Graphics Editor]     [Yosemite News]

  Powered by Linux