2 * fontconfig/src/fclist.c
4 * Copyright © 2000 Keith Packard
6 * Permission to use, copy, modify, distribute, and sell this software and its
7 * documentation for any purpose is hereby granted without fee, provided that
8 * the above copyright notice appear in all copies and that both that
9 * copyright notice and this permission notice appear in supporting
10 * documentation, and that the name of the author(s) not be used in
11 * advertising or publicity pertaining to distribution of the software without
12 * specific, written prior permission. The authors make no
13 * representations about the suitability of this software for any purpose. It
14 * is provided "as is" without express or implied warranty.
16 * THE AUTHOR(S) DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
17 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
18 * EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY SPECIAL, INDIRECT OR
19 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
20 * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
21 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
22 * PERFORMANCE OF THIS SOFTWARE.
27 #include "fcobjshash.h"
31 static int next_id = FC_MAX_BASE_OBJECT + 1;
32 struct FcObjectOtherTypeInfo {
33 struct FcObjectOtherTypeInfo *next;
39 _FcObjectLookupOtherTypeByName (const char *str, FcObject *id)
41 struct FcObjectOtherTypeInfo *ots, *ot;
46 for (ot = ots; ot; ot = ot->next)
47 if (0 == strcmp (ot->object.object, str))
52 ot = malloc (sizeof (*ot));
56 ot->object.object = strdup (str);
58 ot->id = next_id++; /* MT_unsafe */
71 FcObjectLookupBuiltinIdByName (const char *str)
73 const struct FcObjectTypeInfo *o = FcObjectTypeLookup (str, strlen (str));
82 FcObjectLookupIdByName (const char *str)
84 const struct FcObjectTypeInfo *o = FcObjectTypeLookup (str, strlen (str));
89 if (_FcObjectLookupOtherTypeByName (str, &id))
96 FcObjectLookupOtherNameById (FcObject id)
99 struct FcObjectOtherTypeInfo *ot;
101 for (ot = other_types; ot; ot = ot->next)
103 return ot->object.object;
109 FcObjectLookupOtherTypeByName (const char *str)
111 return _FcObjectLookupOtherTypeByName (str, NULL);
114 FcPrivate const FcObjectType *
115 FcObjectLookupOtherTypeById (FcObject id)
118 struct FcObjectOtherTypeInfo *ot;
120 for (ot = other_types; ot; ot = ot->next)
129 #include "fcaliastail.h"