[PATCH:libX11] unifdef XKB_IN_SERVER

Ran Benita ran234 at gmail.com
Sat Mar 2 01:07:51 PST 2013


On Fri, Mar 01, 2013 at 11:41:07PM -0800, Alan Coopersmith wrote:
> Leftovers from XKB files that were previously shared between the client
> and server code, but aren't any more.

Hi Alan,

Would you be averse to doing the same for other XKB-related defines?
The server currently uses some files from libxkbfile:

X11/extensions/XKBconfig.h - not actually used, #include can be removed.

X11/extensions/XKM.h - contains only some #defines, which are used
mostly without any relation to the XKM format. The server needs this
one, but it doesn't have any ifdef's.

X11/extensions/XKMformat.h - contains the actual structs for the binary
XKM file format. Many files include this, but they only really want
XKM.h (which is included from XKMformat.h). The only file which actually
needs it is src/xkmout.c. This also doesn't have any ifdef's in it.

Also, we can remove all of the '#define XKBSRV_NEED_FILE' lines, because
the server no longer includes XKBsrv.h from kbproto in any way (instead
it uses a copy in include/xkbsrv.h).

With these changes to the server, some cleanups are possible:

In libxkbfile, can unifdef XKB_IN_SERVER.

We can also copy the two files XKM.h and XKMformat.h to the server (as
is done with almost all XKB defines), and remove the libxkbfile build
dependency entirely. Since the server already has copies of the C code,
any changes to the header already require changing both the server and
libxkbfile anyway.

And then possibly, unifdef XKBSRV_NEED_FILE_FUNCS from
X11/extensions/XKBsrv.h from kbproto. It was used in libX11, but your
patch removes those. And it is also used in libxkbfile, but after
unifdef'ing XKB_IN_SERVER it would no longer be used there as well.

And that would make the XKB situation a bit easier to understand;
currently it is very confusing. I can do patches, but I don't feel very
confident doing and testing such cross-module changes myself.

Thanks,
Ran

> Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
> ---
>  src/xkb/XKBAlloc.c  |   12 ------------
>  src/xkb/XKBGAlloc.c |   12 ------------
>  src/xkb/XKBMAlloc.c |   13 -------------
>  src/xkb/XKBMisc.c   |   13 -------------
>  4 files changed, 50 deletions(-)
> 
> diff --git a/src/xkb/XKBAlloc.c b/src/xkb/XKBAlloc.c
> index 05e9f73..034539b 100644
> --- a/src/xkb/XKBAlloc.c
> +++ b/src/xkb/XKBAlloc.c
> @@ -30,7 +30,6 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
>  #include <config.h>
>  #endif
>  
> -#ifndef XKB_IN_SERVER
>  
>  #include <stdio.h>
>  #include "Xlibint.h"
> @@ -39,17 +38,6 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
>  #include <X11/extensions/XKBproto.h>
>  #include "XKBlibint.h"
>  
> -#else
> -
> -#include <stdio.h>
> -#include <X11/X.h>
> -#include <X11/Xproto.h>
> -#include "misc.h"
> -#include "inputstr.h"
> -#include <X11/extensions/XKBsrv.h>
> -#include <X11/extensions/XKBgeom.h>
> -
> -#endif /* XKB_IN_SERVER */
>  
>  /***===================================================================***/
>  
> diff --git a/src/xkb/XKBGAlloc.c b/src/xkb/XKBGAlloc.c
> index 7679496..e55f5e8 100644
> --- a/src/xkb/XKBGAlloc.c
> +++ b/src/xkb/XKBGAlloc.c
> @@ -30,7 +30,6 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
>  #include <config.h>
>  #endif
>  
> -#ifndef XKB_IN_SERVER
>  
>  #include <stdio.h>
>  #include "Xlibint.h"
> @@ -38,17 +37,6 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
>  #include <X11/extensions/XKBgeom.h>
>  #include <X11/extensions/XKBproto.h>
>  
> -#else
> -
> -#include <stdio.h>
> -#include <X11/X.h>
> -#include <X11/Xproto.h>
> -#include "misc.h"
> -#include "inputstr.h"
> -#include <X11/extensions/XKBsrv.h>
> -#include <X11/extensions/XKBgeom.h>
> -
> -#endif /* XKB_IN_SERVER */
>  
>  #ifdef X_NOT_POSIX
>  #define Size_t unsigned int
> diff --git a/src/xkb/XKBMAlloc.c b/src/xkb/XKBMAlloc.c
> index a6b3921..fd75f0c 100644
> --- a/src/xkb/XKBMAlloc.c
> +++ b/src/xkb/XKBMAlloc.c
> @@ -30,7 +30,6 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
>  #include <config.h>
>  #endif
>  
> -#ifndef XKB_IN_SERVER
>  
>  #include <stdio.h>
>  #include "Xlibint.h"
> @@ -38,18 +37,6 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
>  #include <X11/keysym.h>
>  #include "XKBlibint.h"
>  
> -#else
> -
> -#include <stdio.h>
> -#include <X11/X.h>
> -#include <X11/Xproto.h>
> -#include "misc.h"
> -#include "inputstr.h"
> -#include <X11/keysym.h>
> -#define	XKBSRV_NEED_FILE_FUNCS
> -#include <X11/extensions/XKBsrv.h>
> -
> -#endif /* XKB_IN_SERVER */
>  
>  /***====================================================================***/
>  
> diff --git a/src/xkb/XKBMisc.c b/src/xkb/XKBMisc.c
> index 4aa1f73..cd90da7 100644
> --- a/src/xkb/XKBMisc.c
> +++ b/src/xkb/XKBMisc.c
> @@ -30,7 +30,6 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
>  #include <config.h>
>  #endif
>  
> -#ifndef XKB_IN_SERVER
>  
>  #include <stdio.h>
>  #include "Xlibint.h"
> @@ -38,18 +37,6 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
>  #include <X11/keysym.h>
>  #include "XKBlibint.h"
>  
> -#else
> -
> -#include <stdio.h>
> -#include <X11/X.h>
> -#include <X11/Xproto.h>
> -#include "misc.h"
> -#include "inputstr.h"
> -#include <X11/keysym.h>
> -#define	XKBSRV_NEED_FILE_FUNCS
> -#include <X11/extensions/XKBsrv.h>
> -
> -#endif /* XKB_IN_SERVER */
>  
>  /***====================================================================***/
>  
> -- 
> 1.7.9.2
> 
> _______________________________________________
> xorg-devel at lists.x.org: X.Org development
> Archives: http://lists.x.org/archives/xorg-devel
> Info: http://lists.x.org/mailman/listinfo/xorg-devel


More information about the xorg-devel mailing list