From 3ca6576c426d6d5c299e2cfc94bf8f729c7bbe51 Mon Sep 17 00:00:00 2001 From: Adrian Cochrane Date: Sat, 7 Oct 2023 14:21:37 +1300 Subject: [PATCH] Improve lazy performance, release 0.3.0.1 --- cbits/charsetiter.c | 31 +++++++++++++++++++++++++++++++ fontconfig-pure.cabal | 2 +- 2 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 cbits/charsetiter.c diff --git a/cbits/charsetiter.c b/cbits/charsetiter.c new file mode 100644 index 0000000..db8e012 --- /dev/null +++ b/cbits/charsetiter.c @@ -0,0 +1,31 @@ +#include +#include + +struct my_FcCharSetIter { + FcCharSet *charset; + FcChar32 map[FC_CHARSET_MAP_SIZE]; + FcChar32 next; +}; + +struct my_FcCharSetIter *my_FcCharSetIterCreate(FcCharSet *a) { + struct my_FcCharSetIter *self = malloc(sizeof(struct my_FcCharSetIter)); + self->charset = FcCharSetCopy(a); + return self; +} + +void my_FcCharSetIterDestroy(struct my_FcCharSetIter *self) { + FcCharSetDestroy(self->charset); + free(self); +} + +FcChar32 my_FcCharSetIterStart(struct my_FcCharSetIter *self) { + return FcCharSetFirstPage(self->charset, self->map, &self->next); +} + +FcChar32 my_FcCharSetIterNext(struct my_FcCharSetIter *self) { + return FcCharSetNextPage(self->charset, self->map, &self->next); +} + +FcBool my_FcCharSetIterDone(FcChar32 chr) { + return chr == FC_CHARSET_DONE; +} diff --git a/fontconfig-pure.cabal b/fontconfig-pure.cabal index 28c9029..1892d27 100644 --- a/fontconfig-pure.cabal +++ b/fontconfig-pure.cabal @@ -10,7 +10,7 @@ name: fontconfig-pure -- PVP summary: +-+------- breaking API changes -- | | +----- non-breaking API additions -- | | | +--- code changes with no API change -version: 0.3.0.0 +version: 0.3.0.1 -- A short (one-line) description of the package. synopsis: Pure-functional language bindings to FontConfig -- 2.30.2