Reduces number of mallocs called from FcStrBufChar in my small test
from 900 down to 6.
FcBool failed;
int len;
int size;
+ FcChar8 buf_static[16 * sizeof (void *)];
} FcStrBuf;
struct _FcCache {
void
FcStrBufInit (FcStrBuf *buf, FcChar8 *init, int size)
{
- buf->buf = init;
+ if (init)
+ {
+ buf->buf = init;
+ buf->size = size;
+ } else
+ {
+ buf->buf = buf->static_buf;
+ buf->size = sizeof (buf->static_buf);
+ }
buf->allocated = FcFalse;
buf->failed = FcFalse;
buf->len = 0;
- buf->size = size;
}
void