[PATCH libXfont] Eliminate calls back to X server or font server functions by name (v2)

Emil Velikov emil.l.velikov at gmail.com
Wed Sep 9 10:30:55 PDT 2015


Hi Keith,

On 2 September 2015 at 22:30, Keith Packard <keithp at keithp.com> wrote:
> 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/
>
> Signed-off-by: Keith Packard <keithp at keithp.com>
> ---
>  Makefile.am                   |   7 +-
>  configure.ac                  |   4 +-
>  include/X11/fonts/bufio.h     |   2 +-
>  include/X11/fonts/fontmisc.h  |   2 +-
>  include/X11/fonts/libxfont2.h |  81 ++++++++++++++
>  include/libxfontint.h         |  90 +++++++++++++++
>  src/FreeType/ft.h             |   2 -
>  src/FreeType/ftenc.c          |   1 +
>  src/FreeType/ftfuncs.c        |   1 +
>  src/FreeType/fttools.c        |   1 +
>  src/FreeType/xttcap.c         |   1 +
>  src/Makefile.am               |   8 +-
>  src/bitmap/bdfread.c          |   1 +
>  src/bitmap/bdfutils.c         |   1 +
>  src/bitmap/bitmap.c           |   1 +
>  src/bitmap/bitmapfunc.c       |   1 +
>  src/bitmap/bitmaputil.c       |   1 +
>  src/bitmap/bitscale.c         |   4 +-
>  src/bitmap/fontink.c          |   1 +
>  src/bitmap/pcfread.c          |   1 +
>  src/bitmap/pcfwrite.c         |   7 +-
>  src/bitmap/snfread.c          |   1 +
>  src/builtins/dir.c            |   1 +
>  src/builtins/file.c           |   1 +
>  src/builtins/fonts.c          |   1 +
>  src/builtins/fpe.c            |  36 +++---
>  src/builtins/render.c         |   1 +
>  src/fc/fsconvert.c            |   1 +
>  src/fc/fserve.c               |  43 ++++----
>  src/fc/fserve.h               |   9 --
>  src/fc/fsio.c                 |   1 +
>  src/fc/fstrans.c              |   2 +
>  src/fontfile/bitsource.c      |   1 +
>  src/fontfile/bufio.c          |   3 +-
>  src/fontfile/bunzip2.c        |   1 +
>  src/fontfile/catalogue.c      |  36 +++---
>  src/fontfile/decompress.c     |   1 +
>  src/fontfile/defaults.c       |   1 +
>  src/fontfile/dirfile.c        |   1 +
>  src/fontfile/fileio.c         |   1 +
>  src/fontfile/filewr.c         |   1 +
>  src/fontfile/fontdir.c        |   1 +
>  src/fontfile/fontencc.c       |   3 +-
>  src/fontfile/fontfile.c       |  36 +++---
>  src/fontfile/fontscale.c      |   1 +
>  src/fontfile/gunzip.c         |   1 +
>  src/fontfile/register.c       |   1 +
>  src/fontfile/renderers.c      |   3 +-
>  src/stubs/Makefile.am         |  19 +---
>  src/stubs/atom.c              | 224 +++++++++++++++++++++++++++++++++++++
>  src/stubs/cauthgen.c          |  15 ---
>  src/stubs/csignal.c           |  15 ---
>  src/stubs/delfntcid.c         |  14 ---
>  src/stubs/errorf.c            |  14 ---
>  src/stubs/findoldfnt.c        |  15 ---
>  src/stubs/getcres.c           |  15 ---
>  src/stubs/getdefptsize.c      |  15 ---
>  src/stubs/getnewfntcid.c      |  15 ---
>  src/stubs/gettime.c           |  15 ---
>  src/stubs/initfshdl.c         |  16 ---
>  src/stubs/libxfontstubs.c     | 169 ++++++++++++++++++++++++++++
>  src/stubs/regfpefunc.c        |  32 ------
>  src/stubs/rmfshdl.c           |  16 ---
>  src/stubs/servclient.c        |  19 ----
>  src/stubs/setfntauth.c        |  15 ---
>  src/stubs/stfntcfnt.c         |  15 ---
>  src/stubs/stubs.h             |  88 ---------------
>  src/stubs/stubsinit.c         |  82 --------------
>  src/util/Makefile.am          |   1 -
>  src/util/atom.c               | 250 ------------------------------------------
>  src/util/fontaccel.c          |   1 +
>  src/util/fontnames.c          |   1 +
>  src/util/fontutil.c           |   1 +
>  src/util/fontxlfd.c           |   1 +
>  src/util/format.c             |   1 +
>  src/util/miscutil.c           |  23 +---
>  src/util/patcache.c           |   1 +
>  src/util/private.c            |   1 +
>  src/util/utilbitmap.c         |   1 +
>  xfont.pc.in                   |  13 ---
>  xfont2.pc.in                  |  13 +++
>  81 files changed, 727 insertions(+), 816 deletions(-)
>  create mode 100644 include/X11/fonts/libxfont2.h
>  create mode 100644 include/libxfontint.h
>  create mode 100644 src/stubs/atom.c
>  delete mode 100644 src/stubs/cauthgen.c
>  delete mode 100644 src/stubs/csignal.c
>  delete mode 100644 src/stubs/delfntcid.c
>  delete mode 100644 src/stubs/errorf.c
>  delete mode 100644 src/stubs/findoldfnt.c
>  delete mode 100644 src/stubs/getcres.c
>  delete mode 100644 src/stubs/getdefptsize.c
>  delete mode 100644 src/stubs/getnewfntcid.c
>  delete mode 100644 src/stubs/gettime.c
>  delete mode 100644 src/stubs/initfshdl.c
>  create mode 100644 src/stubs/libxfontstubs.c
>  delete mode 100644 src/stubs/regfpefunc.c
>  delete mode 100644 src/stubs/rmfshdl.c
>  delete mode 100644 src/stubs/servclient.c
>  delete mode 100644 src/stubs/setfntauth.c
>  delete mode 100644 src/stubs/stfntcfnt.c
>  delete mode 100644 src/stubs/stubs.h
>  delete mode 100644 src/stubs/stubsinit.c
>  delete mode 100644 src/util/atom.c
>  delete mode 100644 xfont.pc.in
>  create mode 100644 xfont2.pc.in
>
> diff --git a/Makefile.am b/Makefile.am
> index 7ec3188..608d5de 100644
> --- a/Makefile.am
> +++ b/Makefile.am
> @@ -35,13 +35,18 @@ libXfontinclude_HEADERS = \
>         include/X11/fonts/fontutil.h \
>         include/X11/fonts/fontxlfd.h \
>         include/X11/fonts/pcf.h      \
> +       include/X11/fonts/libxfont2.h \
>         src/FreeType/ft.h            \
>         src/FreeType/ftfuncs.h
> +
In parallel to Matt's question - if we do opt for a separate library
(libXfont2), the headers will clash with libXfont's.

>From a very quick look, only fontstruct.h seems to be used. If truly
so, one can rework it (rename or fold into libxfont2.h, rename the
symbols ?) and drop the rest from libXfontinclude_HEADERS.

Additionally it'll be great to sanitise the list of exported symbols,
as things might go nasty as we end up with both libXfont.so
libXfont2.so opened at the same time.

As previously this just a suggestion, so feel free to take it or leave it.
Emil


More information about the xorg-devel mailing list