[Fontconfig] 2.4 branch fc-cache

James Cloos cloos at jhcloos.com
Wed Sep 14 10:06:32 EST 2005


fc-cache isn't creating fonts.cache-2 files in directories w/ only
sub directories and no font files.

In src/fccache.c::FcDirCacheWrite() there is this:

    current_dir_block = FcDirCacheProduce (set, &metadata);

    if (!metadata.count)
    {
        unlink ((char *)cache_file);
        free (cache_file);
        return FcTrue;
    }

well before we get to:

    for (i = 0; i < dirs->size; i++)
        FcCacheWriteString (fd, (char *)dirs->strs[i]);
    FcCacheWriteString (fd, "");


The unlink() call should probably either be conditioned on
metadata.count NOR dirs->size or there should be a nested if
to write out a directories-only cache-2 file if there are no
font files in that dir, yes?

It does seem unlikely that readdir(2) followed by n stat(2) calls
is a win over a list of the sub dirs.

-JimC
-- 
James H. Cloos, Jr. <cloos at jhcloos.com>




More information about the Fontconfig mailing list