summaryrefslogtreecommitdiff
path: root/src/util/patcache.c
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2015-09-02 00:04:32 -0700
committerKeith Packard <keithp@keithp.com>2015-12-08 20:37:48 -0800
commit135fb032e940ce226c9feb13e6e903f3ecbc5eb0 (patch)
treeb6cea9b925c7be27a13964924b7811823f52f2e2 /src/util/patcache.c
parenteb67d10ae82b364a4324e96ce53baaa4e5e75f97 (diff)
Eliminate calls back to X server or font server functions by name (v4)libXfont2-2.0.0
This eliminates the weak symbol adventures and makes all of the calls back to the X server or Font server go through a table of functions instead, clarifying the required API. As this is a rather major change to the API for the library, it now installs itself as libXfont2 instead of libXfont, and the package config file is now xfont2.pc. All of the installed headers remain the same as the original library; there's now a new include file, libxfont2.h, which defines the X server and Font server interfaces. This moves util/atom.c to stubs/atom.c and reformats that file, hence the diff being larger than it would otherwise be. v2: Rename to libXfont2 instead of libXfont_2 as suggested by Emil Velikov Fix whitespace in stubs/atom.c, which was moved from util/ v3: Remove select masks from API. Expose single 'font_init' function for all library initialization. v4: Change name of distributed tarballs to libXfont2 as well Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'src/util/patcache.c')
-rw-r--r--src/util/patcache.c35
1 files changed, 18 insertions, 17 deletions
diff --git a/src/util/patcache.c b/src/util/patcache.c
index 2101015..e76f1f4 100644
--- a/src/util/patcache.c
+++ b/src/util/patcache.c
@@ -31,6 +31,7 @@ in this Software without prior written authorization from The Open Group.
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
+#include "libxfontint.h"
#include <X11/fonts/fontmisc.h>
#include <X11/fonts/fontstruct.h>
@@ -55,15 +56,15 @@ typedef struct _FontPatternCacheEntry {
FontPtr pFont; /* associated font */
} FontPatternCacheEntryRec, *FontPatternCacheEntryPtr;
-typedef struct _FontPatternCache {
+typedef struct _xfont2_pattern_cache {
FontPatternCacheEntryPtr buckets[NBUCKETS];
FontPatternCacheEntryRec entries[NENTRIES];
FontPatternCacheEntryPtr free;
-} FontPatternCacheRec;
+} xfont2_pattern_cache_rec;
/* Empty cache (for rehash) */
void
-EmptyFontPatternCache (FontPatternCachePtr cache)
+xfont2_empty_font_pattern_cache(xfont2_pattern_cache_ptr cache)
{
int i;
@@ -83,10 +84,10 @@ EmptyFontPatternCache (FontPatternCachePtr cache)
}
/* Create and initialize cache */
-FontPatternCachePtr
-MakeFontPatternCache (void)
+xfont2_pattern_cache_ptr
+xfont2_make_font_pattern_cache(void)
{
- FontPatternCachePtr cache;
+ xfont2_pattern_cache_ptr cache;
int i;
cache = malloc (sizeof *cache);
if (!cache)
@@ -96,13 +97,13 @@ MakeFontPatternCache (void)
cache->entries[i].pattern = 0;
cache->entries[i].pFont = 0;
}
- EmptyFontPatternCache (cache);
+ xfont2_empty_font_pattern_cache (cache);
return cache;
}
/* toss cache */
void
-FreeFontPatternCache (FontPatternCachePtr cache)
+xfont2_free_font_pattern_cache(xfont2_pattern_cache_ptr cache)
{
int i;
@@ -127,10 +128,10 @@ Hash (const char *string, int len)
/* add entry */
void
-CacheFontPattern (FontPatternCachePtr cache,
- const char *pattern,
- int patlen,
- FontPtr pFont)
+xfont2_cache_font_pattern(xfont2_pattern_cache_ptr cache,
+ const char * pattern,
+ int patlen,
+ FontPtr pFont)
{
FontPatternCacheEntryPtr e;
char *newpat;
@@ -173,9 +174,9 @@ CacheFontPattern (FontPatternCachePtr cache,
/* find matching entry */
FontPtr
-FindCachedFontPattern (FontPatternCachePtr cache,
- const char *pattern,
- int patlen)
+xfont2_find_cached_font_pattern(xfont2_pattern_cache_ptr cache,
+ const char * pattern,
+ int patlen)
{
int hash;
int i;
@@ -195,8 +196,8 @@ FindCachedFontPattern (FontPatternCachePtr cache,
}
void
-RemoveCachedFontPattern (FontPatternCachePtr cache,
- FontPtr pFont)
+xfont2_remove_cached_font_pattern(xfont2_pattern_cache_ptr cache,
+ FontPtr pFont)
{
FontPatternCacheEntryPtr e;
int i;