summaryrefslogtreecommitdiff
path: root/src/stubs
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/stubs
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/stubs')
-rw-r--r--src/stubs/Makefile.am19
-rw-r--r--src/stubs/atom.c224
-rw-r--r--src/stubs/cauthgen.c15
-rw-r--r--src/stubs/csignal.c15
-rw-r--r--src/stubs/delfntcid.c14
-rw-r--r--src/stubs/errorf.c14
-rw-r--r--src/stubs/findoldfnt.c15
-rw-r--r--src/stubs/getcres.c15
-rw-r--r--src/stubs/getdefptsize.c15
-rw-r--r--src/stubs/getnewfntcid.c15
-rw-r--r--src/stubs/gettime.c15
-rw-r--r--src/stubs/initfshdl.c16
-rw-r--r--src/stubs/libxfontstubs.c198
-rw-r--r--src/stubs/regfpefunc.c32
-rw-r--r--src/stubs/rmfshdl.c16
-rw-r--r--src/stubs/servclient.c19
-rw-r--r--src/stubs/setfntauth.c15
-rw-r--r--src/stubs/stfntcfnt.c15
-rw-r--r--src/stubs/stubs.h79
-rw-r--r--src/stubs/stubsinit.c82
20 files changed, 424 insertions, 424 deletions
diff --git a/src/stubs/Makefile.am b/src/stubs/Makefile.am
index 7eb16d4..65950cc 100644
--- a/src/stubs/Makefile.am
+++ b/src/stubs/Makefile.am
@@ -6,20 +6,5 @@ AM_CFLAGS = $(XFONT_CFLAGS) $(OS_CFLAGS) $(CWARNFLAGS)
noinst_LTLIBRARIES = libstubs.la
libstubs_la_SOURCES = \
- cauthgen.c \
- csignal.c \
- delfntcid.c \
- errorf.c \
- findoldfnt.c \
- getcres.c \
- getdefptsize.c \
- getnewfntcid.c \
- gettime.c \
- initfshdl.c \
- regfpefunc.c \
- rmfshdl.c \
- servclient.c \
- setfntauth.c \
- stfntcfnt.c \
- stubsinit.c \
- stubs.h
+ atom.c \
+ libxfontstubs.c
diff --git a/src/stubs/atom.c b/src/stubs/atom.c
new file mode 100644
index 0000000..82c8ca3
--- /dev/null
+++ b/src/stubs/atom.c
@@ -0,0 +1,224 @@
+/*
+
+ Copyright 1990, 1994, 1998 The Open Group
+
+ Permission to use, copy, modify, distribute, and sell this software and its
+ documentation for any purpose is hereby granted without fee, provided that
+ the above copyright notice appear in all copies and that both that
+ copyright notice and this permission notice appear in supporting
+ documentation.
+
+ The above copyright notice and this permission notice shall be included in
+ all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+ Except as contained in this notice, the name of The Open Group shall not be
+ used in advertising or otherwise to promote the sale, use or other dealings
+ in this Software without prior written authorization from The Open Group.
+
+*/
+
+/*
+ * Author: Keith Packard, MIT X Consortium
+ */
+
+/* lame atom replacement routines for font applications */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include "libxfontint.h"
+#include <X11/fonts/fontmisc.h>
+
+typedef struct _AtomList {
+ char *name;
+ int len;
+ int hash;
+ Atom atom;
+} AtomListRec, *AtomListPtr;
+
+static AtomListPtr *hashTable;
+
+static int hashSize, hashUsed;
+static int hashMask;
+static int rehash;
+
+static AtomListPtr *reverseMap;
+static int reverseMapSize;
+static Atom lastAtom;
+
+static int
+Hash(const char *string, int len)
+{
+ int h;
+
+ h = 0;
+ while (len--)
+ h = (h << 3) ^ *string++;
+ if (h < 0)
+ return -h;
+ return h;
+}
+
+static int
+ResizeHashTable(void)
+{
+ int newHashSize;
+ int newHashMask;
+ AtomListPtr *newHashTable;
+ int i;
+ int h;
+ int newRehash;
+ int r;
+
+ if (hashSize == 0)
+ newHashSize = 1024;
+ else
+ newHashSize = hashSize * 2;
+ newHashTable = calloc(newHashSize, sizeof(AtomListPtr));
+ if (!newHashTable) {
+ fprintf(stderr, "ResizeHashTable(): Error: Couldn't allocate"
+ " newHashTable (%ld)\n",
+ newHashSize * (unsigned long) sizeof(AtomListPtr));
+ return FALSE;
+ }
+ newHashMask = newHashSize - 1;
+ newRehash = (newHashMask - 2);
+ for (i = 0; i < hashSize; i++) {
+ if (hashTable[i]) {
+ h = (hashTable[i]->hash) & newHashMask;
+ if (newHashTable[h]) {
+ r = hashTable[i]->hash % newRehash | 1;
+ do {
+ h += r;
+ if (h >= newHashSize)
+ h -= newHashSize;
+ } while (newHashTable[h]);
+ }
+ newHashTable[h] = hashTable[i];
+ }
+ }
+ free(hashTable);
+ hashTable = newHashTable;
+ hashSize = newHashSize;
+ hashMask = newHashMask;
+ rehash = newRehash;
+ return TRUE;
+}
+
+static int
+ResizeReverseMap(void)
+{
+ AtomListPtr *newMap;
+ int newMapSize;
+
+ if (reverseMapSize == 0)
+ newMapSize = 1000;
+ else
+ newMapSize = reverseMapSize * 2;
+ newMap = realloc(reverseMap, newMapSize * sizeof(AtomListPtr));
+ if (newMap == NULL) {
+ fprintf(stderr, "ResizeReverseMap(): Error: Couldn't reallocate"
+ " reverseMap (%ld)\n",
+ newMapSize * (unsigned long) sizeof(AtomListPtr));
+ return FALSE;
+ }
+ reverseMap = newMap;
+ reverseMapSize = newMapSize;
+ return TRUE;
+}
+
+static int
+NameEqual(const char *a, const char *b, int l)
+{
+ while (l--)
+ if (*a++ != *b++)
+ return FALSE;
+ return TRUE;
+}
+
+Atom
+__libxfont_internal__MakeAtom(const char *string, unsigned len, int makeit)
+{
+ AtomListPtr a;
+ int hash;
+ int h = 0;
+ int r;
+
+ hash = Hash(string, len);
+ if (hashTable) {
+ h = hash & hashMask;
+ if (hashTable[h]) {
+ if (hashTable[h]->hash == hash && hashTable[h]->len == len &&
+ NameEqual(hashTable[h]->name, string, len)) {
+ return hashTable[h]->atom;
+ }
+ r = (hash % rehash) | 1;
+ for (;;) {
+ h += r;
+ if (h >= hashSize)
+ h -= hashSize;
+ if (!hashTable[h])
+ break;
+ if (hashTable[h]->hash == hash && hashTable[h]->len == len &&
+ NameEqual(hashTable[h]->name, string, len)) {
+ return hashTable[h]->atom;
+ }
+ }
+ }
+ }
+ if (!makeit)
+ return None;
+ a = malloc(sizeof(AtomListRec) + len + 1);
+ if (a == NULL) {
+ fprintf(stderr, "MakeAtom(): Error: Couldn't allocate AtomListRec"
+ " (%ld)\n", (unsigned long) sizeof(AtomListRec) + len + 1);
+ return None;
+ }
+ a->name = (char *) (a + 1);
+ a->len = len;
+ strncpy(a->name, string, len);
+ a->name[len] = '\0';
+ a->atom = ++lastAtom;
+ a->hash = hash;
+ if (hashUsed >= hashSize / 2) {
+ ResizeHashTable();
+ h = hash & hashMask;
+ if (hashTable[h]) {
+ r = (hash % rehash) | 1;
+ do {
+ h += r;
+ if (h >= hashSize)
+ h -= hashSize;
+ } while (hashTable[h]);
+ }
+ }
+ hashTable[h] = a;
+ hashUsed++;
+ if (reverseMapSize <= a->atom) {
+ if (!ResizeReverseMap())
+ return None;
+ }
+ reverseMap[a->atom] = a;
+ return a->atom;
+}
+
+int
+__libxfont_internal__ValidAtom(Atom atom)
+{
+ return (atom != None) && (atom <= lastAtom);
+}
+
+const char *
+__libxfont_internal__NameForAtom(Atom atom)
+{
+ if (atom != None && atom <= lastAtom)
+ return reverseMap[atom]->name;
+ return NULL;
+}
diff --git a/src/stubs/cauthgen.c b/src/stubs/cauthgen.c
deleted file mode 100644
index 10086e4..0000000
--- a/src/stubs/cauthgen.c
+++ /dev/null
@@ -1,15 +0,0 @@
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include "stubs.h"
-
-#ifdef __SUNPRO_C
-#pragma weak client_auth_generation
-#endif
-
-weak int
-client_auth_generation(ClientPtr client)
-{
- OVERRIDE_SYMBOL(client_auth_generation, client);
- return 0;
-}
diff --git a/src/stubs/csignal.c b/src/stubs/csignal.c
deleted file mode 100644
index dd88b3d..0000000
--- a/src/stubs/csignal.c
+++ /dev/null
@@ -1,15 +0,0 @@
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include "stubs.h"
-
-#ifdef __SUNPRO_C
-#pragma weak ClientSignal
-#endif
-
-weak Bool
-ClientSignal(ClientPtr client)
-{
- OVERRIDE_SYMBOL(ClientSignal,client);
- return True;
-}
diff --git a/src/stubs/delfntcid.c b/src/stubs/delfntcid.c
deleted file mode 100644
index 8113b9f..0000000
--- a/src/stubs/delfntcid.c
+++ /dev/null
@@ -1,14 +0,0 @@
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include "stubs.h"
-
-#ifdef __SUNPRO_C
-#pragma weak DeleteFontClientID
-#endif
-
-weak void
-DeleteFontClientID(Font id)
-{
- OVERRIDE_SYMBOL(DeleteFontClientID, id);
-}
diff --git a/src/stubs/errorf.c b/src/stubs/errorf.c
deleted file mode 100644
index d2de6c6..0000000
--- a/src/stubs/errorf.c
+++ /dev/null
@@ -1,14 +0,0 @@
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include "stubs.h"
-
-#ifdef __SUNPRO_C
-#pragma weak ErrorF
-#endif
-
-weak void
-ErrorF(const char *f, ...)
-{
- OVERRIDE_VA_SYMBOL(VErrorF, f);
-}
diff --git a/src/stubs/findoldfnt.c b/src/stubs/findoldfnt.c
deleted file mode 100644
index c73279e..0000000
--- a/src/stubs/findoldfnt.c
+++ /dev/null
@@ -1,15 +0,0 @@
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include "stubs.h"
-
-#ifdef __SUNPRO_C
-#pragma weak find_old_font
-#endif
-
-weak FontPtr
-find_old_font(FSID id)
-{
- OVERRIDE_SYMBOL(find_old_font, id);
- return (FontPtr)NULL;
-}
diff --git a/src/stubs/getcres.c b/src/stubs/getcres.c
deleted file mode 100644
index 27a9180..0000000
--- a/src/stubs/getcres.c
+++ /dev/null
@@ -1,15 +0,0 @@
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include "stubs.h"
-
-#ifdef __SUNPRO_C
-#pragma weak GetClientResolutions
-#endif
-
-weak FontResolutionPtr
-GetClientResolutions(int *num)
-{
- OVERRIDE_SYMBOL(GetClientResolutions, num);
- return (FontResolutionPtr) 0;
-}
diff --git a/src/stubs/getdefptsize.c b/src/stubs/getdefptsize.c
deleted file mode 100644
index 50c1b18..0000000
--- a/src/stubs/getdefptsize.c
+++ /dev/null
@@ -1,15 +0,0 @@
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include "stubs.h"
-
-#ifdef __SUNPRO_C
-#pragma weak GetDefaultPointSize
-#endif
-
-weak int
-GetDefaultPointSize(void)
-{
- OVERRIDE_SYMBOL(GetDefaultPointSize);
- return 0;
-}
diff --git a/src/stubs/getnewfntcid.c b/src/stubs/getnewfntcid.c
deleted file mode 100644
index d31ccf1..0000000
--- a/src/stubs/getnewfntcid.c
+++ /dev/null
@@ -1,15 +0,0 @@
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include "stubs.h"
-
-#ifdef __SUNPRO_C
-#pragma weak GetNewFontClientID
-#endif
-
-weak Font
-GetNewFontClientID(void)
-{
- OVERRIDE_SYMBOL(GetNewFontClientID);
- return (Font)0;
-}
diff --git a/src/stubs/gettime.c b/src/stubs/gettime.c
deleted file mode 100644
index 1b20f62..0000000
--- a/src/stubs/gettime.c
+++ /dev/null
@@ -1,15 +0,0 @@
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include "stubs.h"
-
-#ifdef __SUNPRO_C
-#pragma weak GetTimeInMillis
-#endif
-
-weak unsigned long
-GetTimeInMillis (void)
-{
- OVERRIDE_SYMBOL(GetTimeInMillis);
- return 0;
-}
diff --git a/src/stubs/initfshdl.c b/src/stubs/initfshdl.c
deleted file mode 100644
index e1c0b24..0000000
--- a/src/stubs/initfshdl.c
+++ /dev/null
@@ -1,16 +0,0 @@
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include "stubs.h"
-
-#ifdef __SUNPRO_C
-#pragma weak init_fs_handlers
-#endif
-
-weak int
-init_fs_handlers(FontPathElementPtr fpe,
- BlockHandlerProcPtr block_handler)
-{
- OVERRIDE_SYMBOL(init_fs_handlers, fpe, block_handler);
- return Successful;
-}
diff --git a/src/stubs/libxfontstubs.c b/src/stubs/libxfontstubs.c
new file mode 100644
index 0000000..b083dd4
--- /dev/null
+++ b/src/stubs/libxfontstubs.c
@@ -0,0 +1,198 @@
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "libxfontint.h"
+
+static xfont2_client_funcs_rec const *_f;
+
+int
+client_auth_generation(ClientPtr client)
+{
+ if (_f)
+ return _f->client_auth_generation(client);
+ return 0;
+}
+
+Bool
+ClientSignal(ClientPtr client)
+{
+ if (_f)
+ return _f->client_signal(client);
+ return TRUE;
+}
+
+void
+DeleteFontClientID(Font id)
+{
+ if (_f)
+ _f->delete_font_client_id(id);
+}
+
+void
+ErrorF(const char *f, ...)
+{
+ if (_f) {
+ va_list ap;
+ va_start(ap, f);
+ _f->verrorf(f, ap);
+ va_end(ap);
+ }
+}
+
+FontPtr
+find_old_font(FSID id)
+{
+ if (_f)
+ return _f->find_old_font(id);
+ return (FontPtr)NULL;
+}
+
+FontResolutionPtr
+GetClientResolutions(int *num)
+{
+ if (_f)
+ return _f->get_client_resolutions(num);
+ return (FontResolutionPtr) 0;
+}
+
+int
+GetDefaultPointSize(void)
+{
+ if (_f)
+ return _f->get_default_point_size();
+ return 12;
+}
+
+Font
+GetNewFontClientID(void)
+{
+ if (_f)
+ return _f->get_new_font_client_id();
+ return (Font)0;
+}
+
+unsigned long
+GetTimeInMillis (void)
+{
+ if (_f)
+ return _f->get_time_in_millis();
+ return 0;
+}
+
+int
+init_fs_handlers2(FontPathElementPtr fpe,
+ FontBlockHandlerProcPtr block_handler)
+{
+ if (_f)
+ return _f->init_fs_handlers(fpe, block_handler);
+ return Successful;
+}
+
+int
+register_fpe_funcs(const xfont2_fpe_funcs_rec *funcs)
+{
+ if (_f)
+ return _f->register_fpe_funcs(funcs);
+ return 0;
+}
+
+void
+remove_fs_handlers2(FontPathElementPtr fpe,
+ FontBlockHandlerProcPtr blockHandler,
+ Bool all)
+{
+ if (_f)
+ _f->remove_fs_handlers(fpe, blockHandler, all);
+}
+
+void *
+__GetServerClient(void)
+{
+ if (_f)
+ return _f->get_server_client();
+ return NULL;
+}
+
+int
+set_font_authorizations(char **authorizations, int *authlen, ClientPtr client)
+{
+ if (_f)
+ return _f->set_font_authorizations(authorizations, authlen, client);
+ return 0;
+}
+
+int
+StoreFontClientFont(FontPtr pfont, Font id)
+{
+ if (_f)
+ return _f->store_font_client_font(pfont, id);
+ return 0;
+}
+
+Atom
+MakeAtom(const char *string, unsigned len, int makeit)
+{
+ if (_f && _f->make_atom)
+ return _f->make_atom(string, len, makeit);
+ return __libxfont_internal__MakeAtom(string, len, makeit);
+}
+
+int
+ValidAtom(Atom atom)
+{
+ if (_f && _f->valid_atom)
+ return _f->valid_atom(atom);
+ return __libxfont_internal__ValidAtom(atom);
+}
+
+const char *
+NameForAtom(Atom atom)
+{
+ if (_f && _f->name_for_atom)
+ return _f->name_for_atom(atom);
+ return __libxfont_internal__NameForAtom(atom);
+}
+
+unsigned long
+__GetServerGeneration (void)
+{
+ if (_f)
+ return _f->get_server_generation();
+ return 1;
+}
+
+
+int
+add_fs_fd(int fd, FontFdHandlerProcPtr handler, void *data)
+{
+ if (_f)
+ return _f->add_fs_fd(fd, handler, data);
+ return 0;
+}
+
+void
+remove_fs_fd(int fd)
+{
+ if (_f)
+ _f->remove_fs_fd(fd);
+}
+
+void
+adjust_fs_wait_for_delay(void *wt, unsigned long newdelay)
+{
+ if (_f)
+ _f->adjust_fs_wait_for_delay(wt, newdelay);
+}
+
+int
+xfont2_init(xfont2_client_funcs_rec const *client_funcs)
+{
+ _f = client_funcs;
+
+ ResetFontPrivateIndex();
+
+ register_fpe_functions();
+
+ return Successful;
+}
diff --git a/src/stubs/regfpefunc.c b/src/stubs/regfpefunc.c
deleted file mode 100644
index ae12a01..0000000
--- a/src/stubs/regfpefunc.c
+++ /dev/null
@@ -1,32 +0,0 @@
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include "stubs.h"
-
-#ifdef __SUNPRO_C
-#pragma weak RegisterFPEFunctions
-#endif
-
-weak int
-RegisterFPEFunctions(NameCheckFunc name_func,
- InitFpeFunc init_func,
- FreeFpeFunc free_func,
- ResetFpeFunc reset_func,
- OpenFontFunc open_func,
- CloseFontFunc close_func,
- ListFontsFunc list_func,
- StartLfwiFunc start_lfwi_func,
- NextLfwiFunc next_lfwi_func,
- WakeupFpeFunc wakeup_func,
- ClientDiedFunc client_died,
- LoadGlyphsFunc load_glyphs,
- StartLaFunc start_list_alias_func,
- NextLaFunc next_list_alias_func,
- SetPathFunc set_path_func)
-{
- OVERRIDE_SYMBOL(RegisterFPEFunctions, name_func, init_func, free_func,
- reset_func, open_func, close_func, list_func, start_lfwi_func,
- next_lfwi_func, wakeup_func, client_died, load_glyphs,
- start_list_alias_func, next_list_alias_func, set_path_func);
- return 0;
-}
diff --git a/src/stubs/rmfshdl.c b/src/stubs/rmfshdl.c
deleted file mode 100644
index 22a3091..0000000
--- a/src/stubs/rmfshdl.c
+++ /dev/null
@@ -1,16 +0,0 @@
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include "stubs.h"
-
-#ifdef __SUNPRO_C
-#pragma weak remove_fs_handlers
-#endif
-
-weak void
-remove_fs_handlers(FontPathElementPtr fpe,
- BlockHandlerProcPtr blockHandler,
- Bool all)
-{
- OVERRIDE_SYMBOL(remove_fs_handlers, fpe, blockHandler, all);
-}
diff --git a/src/stubs/servclient.c b/src/stubs/servclient.c
deleted file mode 100644
index f85e08e..0000000
--- a/src/stubs/servclient.c
+++ /dev/null
@@ -1,19 +0,0 @@
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include "stubs.h"
-
-#ifdef __SUNPRO_C
-#pragma weak serverClient
-#endif
-
-weak void *serverClient = 0;
-
-void *__GetServerClient(void);
-
-void *
-__GetServerClient(void)
-{
- OVERRIDE_DATA(serverClient);
- return serverClient;
-}
diff --git a/src/stubs/setfntauth.c b/src/stubs/setfntauth.c
deleted file mode 100644
index 371807e..0000000
--- a/src/stubs/setfntauth.c
+++ /dev/null
@@ -1,15 +0,0 @@
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include "stubs.h"
-
-#ifdef __SUNPRO_C
-#pragma weak set_font_authorizations
-#endif
-
-weak int
-set_font_authorizations(char **authorizations, int *authlen, ClientPtr client)
-{
- OVERRIDE_SYMBOL(set_font_authorizations, authorizations, authlen, client);
- return 0;
-}
diff --git a/src/stubs/stfntcfnt.c b/src/stubs/stfntcfnt.c
deleted file mode 100644
index d490988..0000000
--- a/src/stubs/stfntcfnt.c
+++ /dev/null
@@ -1,15 +0,0 @@
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include "stubs.h"
-
-#ifdef __SUNPRO_C
-#pragma weak StoreFontClientFont
-#endif
-
-weak int
-StoreFontClientFont(FontPtr pfont, Font id)
-{
- OVERRIDE_SYMBOL(StoreFontClientFont, pfont, id);
- return 0;
-}
diff --git a/src/stubs/stubs.h b/src/stubs/stubs.h
deleted file mode 100644
index 9e71806..0000000
--- a/src/stubs/stubs.h
+++ /dev/null
@@ -1,79 +0,0 @@
-#include <stdio.h>
-#include <X11/fonts/fntfilst.h>
-#include <X11/fonts/font.h>
-
-#ifndef True
-#define True (-1)
-#endif
-#ifndef False
-#define False (0)
-#endif
-
-/* this probably works for Mach-O too, but probably not for PE */
-#if defined(__ELF__) && defined(__GNUC__) && (__GNUC__ >= 3)
-#define weak __attribute__((weak))
-#else
-#define weak
-#ifndef __SUNPRO_C /* Sun compilers use #pragma weak in .c files instead */
-#define NO_WEAK_SYMBOLS
-#endif
-#endif
-
-#if defined(NO_WEAK_SYMBOLS) && defined(PIC)
-#include <stdarg.h>
-extern int _font_init_stubs(void);
-#define OVERRIDE_DATA(sym) \
- _font_init_stubs(); \
- if (__ptr_##sym && __ptr_##sym != &sym) \
- sym = *__ptr_##sym
-#define OVERRIDE_SYMBOL(sym,...) \
- _font_init_stubs(); \
- if (__##sym && __##sym != sym) \
- return (*__##sym)(__VA_ARGS__)
-#define OVERRIDE_VA_SYMBOL(sym,f) \
- va_list _args; \
- _font_init_stubs(); \
- va_start(_args, f); \
- if (__##sym) \
- (*__##sym)(f, _args); \
- va_end(_args)
-
-extern int (*__client_auth_generation)(ClientPtr);
-extern Bool (*__ClientSignal)(ClientPtr);
-extern void (*__DeleteFontClientID)(Font);
-extern void (*__VErrorF)(const char *, va_list);
-extern FontPtr (*__find_old_font)(FSID);
-extern FontResolutionPtr (*__GetClientResolutions)(int *);
-extern int (*__GetDefaultPointSize)(void);
-extern Font (*__GetNewFontClientID)(void);
-extern unsigned long (*__GetTimeInMillis)(void);
-extern int (*__init_fs_handlers)(FontPathElementPtr, BlockHandlerProcPtr);
-extern int (*__RegisterFPEFunctions)(NameCheckFunc, InitFpeFunc, FreeFpeFunc,
- ResetFpeFunc, OpenFontFunc, CloseFontFunc, ListFontsFunc,
- StartLfwiFunc, NextLfwiFunc, WakeupFpeFunc, ClientDiedFunc,
- LoadGlyphsFunc, StartLaFunc, NextLaFunc, SetPathFunc);
-extern void (*__remove_fs_handlers)(FontPathElementPtr, BlockHandlerProcPtr, Bool);
-extern void **__ptr_serverClient;
-extern int (*__set_font_authorizations)(char **, int *, ClientPtr);
-extern int (*__StoreFontClientFont)(FontPtr, Font);
-extern Atom (*__MakeAtom)(const char *, unsigned, int);
-extern int (*__ValidAtom)(Atom);
-extern char *(*__NameForAtom)(Atom);
-extern unsigned long *__ptr_serverGeneration;
-extern void (*__register_fpe_functions)(void);
-#else /* NO_WEAK_SYMBOLS && PIC */
-#define OVERRIDE_DATA(sym)
-#define OVERRIDE_SYMBOL(sym,...)
-#define OVERRIDE_VA_SYMBOL(sym,f)
-#endif
-
-extern FontPtr find_old_font ( FSID id );
-extern int set_font_authorizations ( char **authorizations,
- int *authlen,
- ClientPtr client );
-
-extern unsigned long GetTimeInMillis (void);
-
-extern void ErrorF(const char *format, ...);
-
-/* end of file */
diff --git a/src/stubs/stubsinit.c b/src/stubs/stubsinit.c
deleted file mode 100644
index fc52332..0000000
--- a/src/stubs/stubsinit.c
+++ /dev/null
@@ -1,82 +0,0 @@
-#include "stubs.h"
-
-#if defined(NO_WEAK_SYMBOLS) && defined(PIC)
-
-#ifdef WIN32
-#include <X11/Xwindows.h>
-#define DLOPEN_SELF() GetModuleHandle(NULL)
-#define DLSYM(h,f) GetProcAddress(h,f)
-#else
-#include <dlfcn.h>
-#define DLOPEN_SELF() dlopen(NULL, RTLD_LOCAL)
-#define DLSYM(h,f) dlsym(h, f)
-#endif
-
-int (*__client_auth_generation)(ClientPtr) = NULL;
-Bool (*__ClientSignal)(ClientPtr) = NULL;
-void (*__DeleteFontClientID)(Font) = NULL;
-void (*__VErrorF)(const char *, va_list) = NULL;
-FontPtr (*__find_old_font)(FSID) = NULL;
-FontResolutionPtr (*__GetClientResolutions)(int *) = NULL;
-int (*__GetDefaultPointSize)(void) = NULL;
-Font (*__GetNewFontClientID)(void) = NULL;
-unsigned long (*__GetTimeInMillis)(void) = NULL;
-int (*__init_fs_handlers)(FontPathElementPtr, BlockHandlerProcPtr) = NULL;
-int (*__RegisterFPEFunctions)(NameCheckFunc, InitFpeFunc, FreeFpeFunc,
- ResetFpeFunc, OpenFontFunc, CloseFontFunc, ListFontsFunc,
- StartLfwiFunc, NextLfwiFunc, WakeupFpeFunc, ClientDiedFunc,
- LoadGlyphsFunc, StartLaFunc, NextLaFunc, SetPathFunc) = NULL;
-void (*__remove_fs_handlers)(FontPathElementPtr, BlockHandlerProcPtr, Bool) = NULL;
-void **__ptr_serverClient = NULL;
-int (*__set_font_authorizations)(char **, int *, ClientPtr) = NULL;
-int (*__StoreFontClientFont)(FontPtr, Font) = NULL;
-Atom (*__MakeAtom)(const char *, unsigned, int) = NULL;
-int (*__ValidAtom)(Atom) = NULL;
-char *(*__NameForAtom)(Atom) = NULL;
-unsigned long *__ptr_serverGeneration = NULL;
-void (*__register_fpe_functions)(void) = NULL;
-
-#define INIT_SYMBOL(sym) \
- if (!__##sym) \
- __##sym = (typeof(__##sym)) DLSYM(handle, #sym)
-#define INIT_DATA(sym) \
- if (!__ptr_##sym) \
- __ptr_##sym = (typeof(__ptr_##sym)) DLSYM(handle, #sym)
-
-int
-_font_init_stubs (void)
-{
- static int inited = FALSE;
- static void *handle = NULL;
-
- if (inited)
- return inited;
- if (!handle)
- handle = DLOPEN_SELF();
-
- INIT_SYMBOL(client_auth_generation);
- INIT_SYMBOL(ClientSignal);
- INIT_SYMBOL(DeleteFontClientID);
- INIT_SYMBOL(VErrorF);
- INIT_SYMBOL(find_old_font);
- INIT_SYMBOL(GetClientResolutions);
- INIT_SYMBOL(GetDefaultPointSize);
- INIT_SYMBOL(GetNewFontClientID);
- INIT_SYMBOL(GetTimeInMillis);
- INIT_SYMBOL(init_fs_handlers);
- INIT_SYMBOL(RegisterFPEFunctions);
- INIT_SYMBOL(remove_fs_handlers);
- INIT_SYMBOL(set_font_authorizations);
- INIT_SYMBOL(StoreFontClientFont);
- INIT_SYMBOL(MakeAtom);
- INIT_SYMBOL(ValidAtom);
- INIT_SYMBOL(NameForAtom);
- INIT_SYMBOL(register_fpe_functions);
- INIT_DATA(serverClient);
- INIT_DATA(serverGeneration);
-
- inited = TRUE;
- return inited;
-}
-
-#endif /* NO_WEAK_SYMBOLS && PIC */