diff options
-rw-r--r-- | src/fcint.h | 1 | ||||
-rw-r--r-- | src/fcstr.c | 11 |
2 files changed, 10 insertions, 2 deletions
diff --git a/src/fcint.h b/src/fcint.h index b667e547..be520e78 100644 --- a/src/fcint.h +++ b/src/fcint.h @@ -313,6 +313,7 @@ typedef struct _FcStrBuf { FcBool failed; int len; int size; + FcChar8 buf_static[16 * sizeof (void *)]; } FcStrBuf; struct _FcCache { diff --git a/src/fcstr.c b/src/fcstr.c index 3b84ac0d..4fbb1a21 100644 --- a/src/fcstr.c +++ b/src/fcstr.c @@ -710,11 +710,18 @@ FcUtf16Len (const FcChar8 *string, 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 |