Added icon for MadMatrix.
[AROS-Contrib.git] / vpdf / fcstr.c
blobc8426e17b836d6c8ba0d821f4f750c593026a93d
2 #include <stdlib.h>
3 #include <ctype.h>
4 #include <string.h>
6 #define FcChar32 unsigned int
7 #define FcChar8 char
8 #define FcChar16 unsigned short
9 #define FcBool int
10 #define FcTrue 1
11 #define FcFalse 0
12 #define FcMemAlloc(group, size)
13 #define FcMemFree(group, size)
14 #define intptr_t unsigned int
16 #define FC_CHARSET_MAP_SIZE (256/32)
17 #define FC_CHARSET_DONE ((FcChar32) -1)
18 #define FC_UTF8_MAX_LEN 6
20 typedef enum { FcEndianBig, FcEndianLittle } FcEndian;
22 typedef struct _FcCaseFold {
23 unsigned int upper;
24 unsigned short method : 2;
25 unsigned short count : 14;
26 short offset; /* lower - upper for RANGE, table id for FULL */
27 } FcCaseFold;
29 typedef struct _FcStrBuf {
30 char *buf;
31 int allocated;
32 int failed;
33 int len;
34 int size;
35 char buf_static[16 * sizeof (void *)];
36 } FcStrBuf;
38 struct _FcCharSet {
39 int ref; /* reference count */
40 int num; /* size of leaves and numbers arrays */
41 intptr_t leaves_offset;
42 intptr_t numbers_offset;
43 }FcCharSet;
46 typedef struct _FcStrSet {
47 int ref; /* reference count */
48 int num;
49 int size;
50 FcChar8 **strs;
51 } FcStrSet;
55 #define FC_CASE_FOLD_RANGE 0
56 #define FC_CASE_FOLD_EVEN_ODD 1
57 #define FC_CASE_FOLD_FULL 2
59 static int FcUtf8ToUcs4 (const FcChar8 *src_orig, FcChar32 *dst, int len);
60 static int FcUcs4ToUtf8 (FcChar32 ucs4, FcChar8 dest[FC_UTF8_MAX_LEN]);
61 static FcBool FcStrBufChar (FcStrBuf *buf, FcChar8 c);
63 static FcChar8 *FcStrCopy (const FcChar8 *s)
65 int len;
66 FcChar8 *r;
68 if (!s)
69 return 0;
70 len = strlen ((char *) s) + 1;
71 r = (FcChar8 *) malloc (len);
72 if (!r)
73 return 0;
74 FcMemAlloc (FC_MEM_STRING, len);
75 memcpy (r, s, len);
76 return r;
79 static FcChar8 *FcStrPlus (const FcChar8 *s1, const FcChar8 *s2)
81 int l = strlen ((char *)s1) + strlen ((char *) s2) + 1;
82 FcChar8 *s = malloc (l);
84 if (!s)
85 return 0;
86 FcMemAlloc (FC_MEM_STRING, l);
87 strcpy ((char *) s, (char *) s1);
88 strcat ((char *) s, (char *) s2);
89 return s;
92 static void FcStrFree (FcChar8 *s)
94 FcMemFree (FC_MEM_STRING, strlen ((char *) s) + 1);
95 free (s);
98 #include "fccase.h"
100 #define FcCaseFoldUpperCount(cf) \
101 ((cf)->method == FC_CASE_FOLD_FULL ? 1 : (cf)->count)
104 #define FC_STR_CANON_BUF_LEN 1024
106 typedef struct _FcCaseWalker {
107 const FcChar8 *read;
108 const FcChar8 *src;
109 FcChar8 utf8[FC_MAX_CASE_FOLD_CHARS + 1];
110 } FcCaseWalker;
112 static void FcStrCaseWalkerInit (const FcChar8 *src, FcCaseWalker *w)
114 w->src = src;
115 w->read = 0;
118 static FcChar8 FcStrCaseWalkerLong (FcCaseWalker *w, FcChar8 r)
120 FcChar32 ucs4;
121 int slen;
122 int len = strlen((char*)w->src);
124 slen = FcUtf8ToUcs4 (w->src - 1, &ucs4, len + 1);
125 if (slen <= 0)
126 return r;
127 if (FC_MIN_FOLD_CHAR <= ucs4 && ucs4 <= FC_MAX_FOLD_CHAR)
129 int min = 0;
130 int max = FC_NUM_CASE_FOLD;
132 while (min <= max)
134 int mid = (min + max) >> 1;
135 FcChar32 low = fcCaseFold[mid].upper;
136 FcChar32 high = low + FcCaseFoldUpperCount (&fcCaseFold[mid]);
138 if (high <= ucs4)
139 min = mid + 1;
140 else if (ucs4 < low)
141 max = mid - 1;
142 else
144 const FcCaseFold *fold = &fcCaseFold[mid];
145 int dlen;
147 switch (fold->method) {
148 case FC_CASE_FOLD_EVEN_ODD:
149 if ((ucs4 & 1) != (fold->upper & 1))
150 return r;
151 /* fall through ... */
152 default:
153 dlen = FcUcs4ToUtf8 (ucs4 + fold->offset, w->utf8);
154 break;
155 case FC_CASE_FOLD_FULL:
156 dlen = fold->count;
157 memcpy (w->utf8, fcCaseFoldChars + fold->offset, dlen);
158 break;
161 /* consume rest of src utf-8 bytes */
162 w->src += slen - 1;
164 /* read from temp buffer */
165 w->utf8[dlen] = '\0';
166 w->read = w->utf8;
167 return *w->read++;
171 return r;
174 static FcChar8 FcStrCaseWalkerNext (FcCaseWalker *w)
176 FcChar8 r;
178 if (w->read)
180 if ((r = *w->read++))
181 return r;
182 w->read = 0;
184 r = *w->src++;
186 if ((r & 0xc0) == 0xc0)
187 return FcStrCaseWalkerLong (w, r);
188 if ('A' <= r && r <= 'Z')
189 r = r - 'A' + 'a';
190 return r;
193 static FcChar8 FcStrCaseWalkerNextIgnoreBlanks (FcCaseWalker *w)
195 FcChar8 r;
197 if (w->read)
199 if ((r = *w->read++))
200 return r;
201 w->read = 0;
205 r = *w->src++;
206 } while (r == ' ');
208 if ((r & 0xc0) == 0xc0)
209 return FcStrCaseWalkerLong (w, r);
210 if ('A' <= r && r <= 'Z')
211 r = r - 'A' + 'a';
212 return r;
215 static FcChar8 *FcStrDowncase (const FcChar8 *s)
217 FcCaseWalker w;
218 int len = 0;
219 FcChar8 *dst, *d;
221 FcStrCaseWalkerInit (s, &w);
222 while (FcStrCaseWalkerNext (&w))
223 len++;
224 d = dst = malloc (len + 1);
225 if (!d)
226 return 0;
227 FcMemAlloc (FC_MEM_STRING, len + 1);
228 FcStrCaseWalkerInit (s, &w);
229 while ((*d++ = FcStrCaseWalkerNext (&w)));
230 return dst;
233 static int FcStrCmpIgnoreCase (const FcChar8 *s1, const FcChar8 *s2)
235 FcCaseWalker w1, w2;
236 FcChar8 c1, c2;
238 if (s1 == s2) return 0;
240 FcStrCaseWalkerInit (s1, &w1);
241 FcStrCaseWalkerInit (s2, &w2);
243 for (;;)
245 c1 = FcStrCaseWalkerNext (&w1);
246 c2 = FcStrCaseWalkerNext (&w2);
247 if (!c1 || (c1 != c2))
248 break;
250 return (int) c1 - (int) c2;
253 static int FcStrCmpIgnoreBlanksAndCase (const FcChar8 *s1, const FcChar8 *s2)
255 FcCaseWalker w1, w2;
256 FcChar8 c1, c2;
258 if (s1 == s2) return 0;
260 FcStrCaseWalkerInit (s1, &w1);
261 FcStrCaseWalkerInit (s2, &w2);
263 for (;;)
265 c1 = FcStrCaseWalkerNextIgnoreBlanks (&w1);
266 c2 = FcStrCaseWalkerNextIgnoreBlanks (&w2);
267 if (!c1 || (c1 != c2))
268 break;
270 return (int) c1 - (int) c2;
273 static int FcStrCmp (const FcChar8 *s1, const FcChar8 *s2)
275 FcChar8 c1, c2;
277 if (s1 == s2)
278 return 0;
279 for (;;)
281 c1 = *s1++;
282 c2 = *s2++;
283 if (!c1 || c1 != c2)
284 break;
286 return (int) c1 - (int) c2;
290 * Return a hash value for a string
293 static FcChar32 FcStrHashIgnoreCase (const FcChar8 *s)
295 FcChar32 h = 0;
296 FcCaseWalker w;
297 FcChar8 c;
299 FcStrCaseWalkerInit (s, &w);
300 while ((c = FcStrCaseWalkerNext (&w)))
301 h = ((h << 3) ^ (h >> 3)) ^ c;
302 return h;
306 * Is the head of s1 equal to s2?
309 static FcBool
310 FcStrIsAtIgnoreBlanksAndCase (const FcChar8 *s1, const FcChar8 *s2)
312 FcCaseWalker w1, w2;
313 FcChar8 c1, c2;
315 FcStrCaseWalkerInit (s1, &w1);
316 FcStrCaseWalkerInit (s2, &w2);
318 for (;;)
320 c1 = FcStrCaseWalkerNextIgnoreBlanks (&w1);
321 c2 = FcStrCaseWalkerNextIgnoreBlanks (&w2);
322 if (!c1 || (c1 != c2))
323 break;
325 return c1 == c2 || !c2;
329 * Does s1 contain an instance of s2 (ignoring blanks and case)?
332 static const FcChar8 *FcStrContainsIgnoreBlanksAndCase (const FcChar8 *s1, const FcChar8 *s2)
334 while (*s1)
336 if (FcStrIsAtIgnoreBlanksAndCase (s1, s2))
337 return s1;
338 s1++;
340 return 0;
343 static FcBool FcCharIsPunct (const FcChar8 c)
345 if (c < '0')
346 return FcTrue;
347 if (c <= '9')
348 return FcFalse;
349 if (c < 'A')
350 return FcTrue;
351 if (c <= 'Z')
352 return FcFalse;
353 if (c < 'a')
354 return FcTrue;
355 if (c <= 'z')
356 return FcFalse;
357 if (c <= '~')
358 return FcTrue;
359 return FcFalse;
363 * Is the head of s1 equal to s2?
366 static FcBool FcStrIsAtIgnoreCase (const FcChar8 *s1, const FcChar8 *s2)
368 FcCaseWalker w1, w2;
369 FcChar8 c1, c2;
371 FcStrCaseWalkerInit (s1, &w1);
372 FcStrCaseWalkerInit (s2, &w2);
374 for (;;)
376 c1 = FcStrCaseWalkerNext (&w1);
377 c2 = FcStrCaseWalkerNext (&w2);
378 if (!c1 || (c1 != c2))
379 break;
381 return c1 == c2 || !c2;
385 * Does s1 contain an instance of s2 (ignoring blanks and case)?
388 static const FcChar8 *FcStrContainsIgnoreCase (const FcChar8 *s1, const FcChar8 *s2)
390 while (*s1)
392 if (FcStrIsAtIgnoreCase (s1, s2))
393 return s1;
394 s1++;
396 return 0;
400 * Does s1 contain an instance of s2 on a word boundary (ignoring case)?
403 static const FcChar8 *FcStrContainsWord (const FcChar8 *s1, const FcChar8 *s2)
405 FcBool wordStart = FcTrue;
406 int s1len = strlen ((char *) s1);
407 int s2len = strlen ((char *) s2);
409 while (s1len >= s2len)
411 if (wordStart &&
412 FcStrIsAtIgnoreCase (s1, s2) &&
413 (s1len == s2len || FcCharIsPunct (s1[s2len])))
415 return s1;
417 wordStart = FcFalse;
418 if (FcCharIsPunct (*s1))
419 wordStart = FcTrue;
420 s1++;
421 s1len--;
423 return 0;
426 static const FcChar8 *FcStrStrIgnoreCase (const FcChar8 *s1, const FcChar8 *s2)
428 FcCaseWalker w1, w2;
429 FcChar8 c1, c2;
430 const FcChar8 *cur;
432 if (!s1 || !s2)
433 return 0;
435 if (s1 == s2)
436 return s1;
438 FcStrCaseWalkerInit (s1, &w1);
439 FcStrCaseWalkerInit (s2, &w2);
441 c2 = FcStrCaseWalkerNext (&w2);
443 for (;;)
445 cur = w1.src;
446 c1 = FcStrCaseWalkerNext (&w1);
447 if (!c1)
448 break;
449 if (c1 == c2)
451 FcCaseWalker w1t = w1;
452 FcCaseWalker w2t = w2;
453 FcChar8 c1t, c2t;
455 for (;;)
457 c1t = FcStrCaseWalkerNext (&w1t);
458 c2t = FcStrCaseWalkerNext (&w2t);
460 if (!c2t)
461 return cur;
462 if (c2t != c1t)
463 break;
467 return 0;
470 static const FcChar8 *FcStrStr (const FcChar8 *s1, const FcChar8 *s2)
472 FcChar8 c1, c2;
473 const FcChar8 * p = s1;
474 const FcChar8 * b = s2;
476 if (!s1 || !s2)
477 return 0;
479 if (s1 == s2)
480 return s1;
482 again:
483 c2 = *s2++;
485 if (!c2)
486 return 0;
488 for (;;)
490 p = s1;
491 c1 = *s1++;
492 if (!c1 || c1 == c2)
493 break;
496 if (c1 != c2)
497 return 0;
499 for (;;)
501 c1 = *s1;
502 c2 = *s2;
503 if (c1 && c2 && c1 != c2)
505 s1 = p + 1;
506 s2 = b;
507 goto again;
509 if (!c2)
510 return p;
511 if (!c1)
512 return 0;
513 ++ s1;
514 ++ s2;
516 /* never reached. */
519 static int FcUtf8ToUcs4 (const FcChar8 *src_orig,
520 FcChar32 *dst,
521 int len)
523 const FcChar8 *src = src_orig;
524 FcChar8 s;
525 int extra;
526 FcChar32 result;
528 if (len == 0)
529 return 0;
531 s = *src++;
532 len--;
534 if (!(s & 0x80))
536 result = s;
537 extra = 0;
539 else if (!(s & 0x40))
541 return -1;
543 else if (!(s & 0x20))
545 result = s & 0x1f;
546 extra = 1;
548 else if (!(s & 0x10))
550 result = s & 0xf;
551 extra = 2;
553 else if (!(s & 0x08))
555 result = s & 0x07;
556 extra = 3;
558 else if (!(s & 0x04))
560 result = s & 0x03;
561 extra = 4;
563 else if ( ! (s & 0x02))
565 result = s & 0x01;
566 extra = 5;
568 else
570 return -1;
572 if (extra > len)
573 return -1;
575 while (extra--)
577 result <<= 6;
578 s = *src++;
580 if ((s & 0xc0) != 0x80)
581 return -1;
583 result |= s & 0x3f;
585 *dst = result;
586 return src - src_orig;
589 static FcBool FcUtf8Len (const FcChar8 *string,
590 int len,
591 int *nchar,
592 int *wchar)
594 int n;
595 int clen;
596 FcChar32 c;
597 FcChar32 max;
599 n = 0;
600 max = 0;
601 while (len)
603 clen = FcUtf8ToUcs4 (string, &c, len);
604 if (clen <= 0) /* malformed UTF8 string */
605 return FcFalse;
606 if (c > max)
607 max = c;
608 string += clen;
609 len -= clen;
610 n++;
612 *nchar = n;
613 if (max >= 0x10000)
614 *wchar = 4;
615 else if (max > 0x100)
616 *wchar = 2;
617 else
618 *wchar = 1;
619 return FcTrue;
622 static int FcUcs4ToUtf8 (FcChar32 ucs4,
623 FcChar8 dest[FC_UTF8_MAX_LEN])
625 int bits;
626 FcChar8 *d = dest;
628 if (ucs4 < 0x80) { *d++= ucs4; bits= -6; }
629 else if (ucs4 < 0x800) { *d++= ((ucs4 >> 6) & 0x1F) | 0xC0; bits= 0; }
630 else if (ucs4 < 0x10000) { *d++= ((ucs4 >> 12) & 0x0F) | 0xE0; bits= 6; }
631 else if (ucs4 < 0x200000) { *d++= ((ucs4 >> 18) & 0x07) | 0xF0; bits= 12; }
632 else if (ucs4 < 0x4000000) { *d++= ((ucs4 >> 24) & 0x03) | 0xF8; bits= 18; }
633 else if (ucs4 < 0x80000000) { *d++= ((ucs4 >> 30) & 0x01) | 0xFC; bits= 24; }
634 else return 0;
636 for ( ; bits >= 0; bits-= 6) {
637 *d++= ((ucs4 >> bits) & 0x3F) | 0x80;
639 return d - dest;
642 #define GetUtf16(src,endian) \
643 ((FcChar16) ((src)[endian == FcEndianBig ? 0 : 1] << 8) | \
644 (FcChar16) ((src)[endian == FcEndianBig ? 1 : 0]))
646 static int FcUtf16ToUcs4 (const FcChar8 *src_orig,
647 FcEndian endian,
648 FcChar32 *dst,
649 int len) /* in bytes */
651 const FcChar8 *src = src_orig;
652 FcChar16 a, b;
653 FcChar32 result;
655 if (len < 2)
656 return 0;
658 a = GetUtf16 (src, endian); src += 2; len -= 2;
661 * Check for surrogate
663 if ((a & 0xfc00) == 0xd800)
665 if (len < 2)
666 return 0;
667 b = GetUtf16 (src, endian); src += 2; len -= 2;
669 * Check for invalid surrogate sequence
671 if ((b & 0xfc00) != 0xdc00)
672 return 0;
673 result = ((((FcChar32) a & 0x3ff) << 10) |
674 ((FcChar32) b & 0x3ff)) + 0x10000;
676 else
677 result = a;
678 *dst = result;
679 return src - src_orig;
682 static FcBool FcUtf16Len (const FcChar8 *string,
683 FcEndian endian,
684 int len, /* in bytes */
685 int *nchar,
686 int *wchar)
688 int n;
689 int clen;
690 FcChar32 c;
691 FcChar32 max;
693 n = 0;
694 max = 0;
695 while (len)
697 clen = FcUtf16ToUcs4 (string, endian, &c, len);
698 if (clen <= 0) /* malformed UTF8 string */
699 return FcFalse;
700 if (c > max)
701 max = c;
702 string += clen;
703 len -= clen;
704 n++;
706 *nchar = n;
707 if (max >= 0x10000)
708 *wchar = 4;
709 else if (max > 0x100)
710 *wchar = 2;
711 else
712 *wchar = 1;
713 return FcTrue;
716 static void FcStrBufInit (FcStrBuf *buf, FcChar8 *init, int size)
718 if (init)
720 buf->buf = init;
721 buf->size = size;
722 } else
724 buf->buf = buf->buf_static;
725 buf->size = sizeof (buf->buf_static);
727 buf->allocated = FcFalse;
728 buf->failed = FcFalse;
729 buf->len = 0;
732 static void FcStrBufDestroy (FcStrBuf *buf)
734 if (buf->allocated)
736 FcMemFree (FC_MEM_STRBUF, buf->size);
737 free (buf->buf);
738 FcStrBufInit (buf, 0, 0);
742 static FcChar8 *FcStrBufDone (FcStrBuf *buf)
744 FcChar8 *ret;
746 if (buf->failed)
747 ret = NULL;
748 else
749 ret = malloc (buf->len + 1);
750 if (ret)
752 FcMemAlloc (FC_MEM_STRING, buf->len + 1);
753 memcpy (ret, buf->buf, buf->len);
754 ret[buf->len] = '\0';
756 FcStrBufDestroy (buf);
757 return ret;
760 static FcChar8 *FcStrBufDoneStatic (FcStrBuf *buf)
762 FcStrBufChar (buf, '\0');
764 if (buf->failed)
765 return NULL;
767 return buf->buf;
770 static FcBool FcStrBufChar (FcStrBuf *buf, FcChar8 c)
772 if (buf->len == buf->size)
774 FcChar8 *new;
775 int size;
777 if (buf->failed)
778 return FcFalse;
780 if (buf->allocated)
782 size = buf->size * 2;
783 new = realloc (buf->buf, size);
785 else
787 size = buf->size + 64;
788 new = malloc (size);
789 if (new)
791 buf->allocated = FcTrue;
792 memcpy (new, buf->buf, buf->len);
795 if (!new)
797 buf->failed = FcTrue;
798 return FcFalse;
800 if (buf->size)
801 FcMemFree (FC_MEM_STRBUF, buf->size);
802 FcMemAlloc (FC_MEM_STRBUF, size);
803 buf->size = size;
804 buf->buf = new;
806 buf->buf[buf->len++] = c;
807 return FcTrue;
810 static FcBool FcStrBufString (FcStrBuf *buf, const FcChar8 *s)
812 FcChar8 c;
813 while ((c = *s++))
814 if (!FcStrBufChar (buf, c))
815 return FcFalse;
816 return FcTrue;
819 static FcBool FcStrBufData (FcStrBuf *buf, const FcChar8 *s, int len)
821 while (len-- > 0)
822 if (!FcStrBufChar (buf, *s++))
823 return FcFalse;
824 return FcTrue;
829 static FcStrSet *FcStrSetCreate (void)
831 FcStrSet *set = malloc (sizeof (FcStrSet));
832 if (!set)
833 return 0;
834 FcMemAlloc (FC_MEM_STRSET, sizeof (FcStrSet));
835 set->ref = 1;
836 set->num = 0;
837 set->size = 0;
838 set->strs = 0;
839 return set;
842 static FcBool FcStrSetMember (FcStrSet *set, const FcChar8 *s);
845 static FcBool _FcStrSetAppend (FcStrSet *set, FcChar8 *s)
847 if (FcStrSetMember (set, s))
849 FcStrFree (s);
850 return FcTrue;
852 if (set->num == set->size)
854 FcChar8 **strs = malloc ((set->size + 2) * sizeof (FcChar8 *));
856 if (!strs)
857 return FcFalse;
858 FcMemAlloc (FC_MEM_STRSET, (set->size + 2) * sizeof (FcChar8 *));
859 if (set->num)
860 memcpy (strs, set->strs, set->num * sizeof (FcChar8 *));
861 if (set->strs)
863 FcMemFree (FC_MEM_STRSET, (set->size + 1) * sizeof (FcChar8 *));
864 free (set->strs);
866 set->size = set->size + 1;
867 set->strs = strs;
869 set->strs[set->num++] = s;
870 set->strs[set->num] = 0;
871 return FcTrue;
876 static FcBool FcStrSetMember (FcStrSet *set, const FcChar8 *s)
878 int i;
880 for (i = 0; i < set->num; i++)
881 if (!FcStrCmp (set->strs[i], s))
882 return FcTrue;
883 return FcFalse;
886 static FcBool FcStrSetEqual (FcStrSet *sa, FcStrSet *sb)
888 int i;
889 if (sa->num != sb->num)
890 return FcFalse;
891 for (i = 0; i < sa->num; i++)
892 if (!FcStrSetMember (sb, sa->strs[i]))
893 return FcFalse;
894 return FcTrue;
897 static FcBool FcStrSetAdd (FcStrSet *set, const FcChar8 *s)
899 FcChar8 *new = FcStrCopy (s);
900 if (!new)
901 return FcFalse;
902 if (!_FcStrSetAppend (set, new))
904 FcStrFree (new);
905 return FcFalse;
907 return FcTrue;
910 #if 0
911 FcBool
912 FcStrSetAddFilename (FcStrSet *set, const FcChar8 *s)
914 FcChar8 *new = FcStrCopyFilename (s);
915 if (!new)
916 return FcFalse;
917 if (!_FcStrSetAppend (set, new))
919 FcStrFree (new);
920 return FcFalse;
922 return FcTrue;
924 #endif
926 static FcBool FcStrSetDel (FcStrSet *set, const FcChar8 *s)
928 int i;
930 for (i = 0; i < set->num; i++)
931 if (!FcStrCmp (set->strs[i], s))
933 FcStrFree (set->strs[i]);
935 * copy remaining string pointers and trailing
936 * NULL
938 memmove (&set->strs[i], &set->strs[i+1],
939 (set->num - i) * sizeof (FcChar8 *));
940 set->num--;
941 return FcTrue;
943 return FcFalse;
946 static void FcStrSetDestroy (FcStrSet *set)
948 if (--set->ref == 0)
950 int i;
952 for (i = 0; i < set->num; i++)
953 FcStrFree (set->strs[i]);
954 if (set->strs)
956 FcMemFree (FC_MEM_STRSET, (set->size + 1) * sizeof (FcChar8 *));
957 free (set->strs);
959 FcMemFree (FC_MEM_STRSET, sizeof (FcStrSet));
960 free (set);