diff options
author | Matthieu Herrb <matthieu@cvs.openbsd.org> | 2010-12-05 15:36:12 +0000 |
---|---|---|
committer | Matthieu Herrb <matthieu@cvs.openbsd.org> | 2010-12-05 15:36:12 +0000 |
commit | a90ee792d96752ad1b71b9ada922fa6afe478c99 (patch) | |
tree | 6143b00f7646951d23dfe2a4fe2992ca40b77069 /xserver/xkb | |
parent | bc97d4ecc0aa9e1b823565b07282f848700bd11a (diff) |
Upgrade to xorg-server 1.9.2.
Tested by ajacoutot@, krw@, shadchin@ and jasper@ on various configurations
including multihead with both zaphod and xrandr.
Diffstat (limited to 'xserver/xkb')
-rw-r--r-- | xserver/xkb/Makefile.am | 4 | ||||
-rw-r--r-- | xserver/xkb/Makefile.in | 40 | ||||
-rw-r--r-- | xserver/xkb/XKBAlloc.c | 58 | ||||
-rw-r--r-- | xserver/xkb/XKBGAlloc.c | 74 | ||||
-rw-r--r-- | xserver/xkb/XKBMAlloc.c | 179 | ||||
-rw-r--r-- | xserver/xkb/XKBMisc.c | 10 | ||||
-rw-r--r-- | xserver/xkb/ddxDevBtn.c | 69 | ||||
-rw-r--r-- | xserver/xkb/ddxFakeMtn.c | 67 | ||||
-rw-r--r-- | xserver/xkb/ddxList.c | 15 | ||||
-rw-r--r-- | xserver/xkb/ddxLoad.c | 21 | ||||
-rw-r--r-- | xserver/xkb/maprules.c | 78 | ||||
-rw-r--r-- | xserver/xkb/xkb.c | 223 | ||||
-rw-r--r-- | xserver/xkb/xkbAccessX.c | 33 | ||||
-rw-r--r-- | xserver/xkb/xkbActions.c | 167 | ||||
-rw-r--r-- | xserver/xkb/xkbEvents.c | 8 | ||||
-rw-r--r-- | xserver/xkb/xkbInit.c | 79 | ||||
-rw-r--r-- | xserver/xkb/xkbLEDs.c | 50 | ||||
-rw-r--r-- | xserver/xkb/xkbUtils.c | 406 | ||||
-rw-r--r-- | xserver/xkb/xkbfmisc.c | 2 | ||||
-rw-r--r-- | xserver/xkb/xkbout.c | 9 | ||||
-rw-r--r-- | xserver/xkb/xkmread.c | 12 |
21 files changed, 750 insertions, 854 deletions
diff --git a/xserver/xkb/Makefile.am b/xserver/xkb/Makefile.am index e54ce59f0..fb3ccbf6f 100644 --- a/xserver/xkb/Makefile.am +++ b/xserver/xkb/Makefile.am @@ -5,11 +5,9 @@ AM_CFLAGS = $(DIX_CFLAGS) DDX_SRCS = \ ddxBeep.c \ ddxCtrls.c \ - ddxFakeMtn.c \ ddxLEDs.c \ ddxLoad.c \ - ddxList.c \ - ddxDevBtn.c + ddxList.c DIX_SRCS = \ xkb.c \ diff --git a/xserver/xkb/Makefile.in b/xserver/xkb/Makefile.in index aa5559d62..6ef9af55c 100644 --- a/xserver/xkb/Makefile.in +++ b/xserver/xkb/Makefile.in @@ -57,8 +57,8 @@ CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \ CONFIG_CLEAN_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) libxkb_la_LIBADD = -am__objects_1 = ddxBeep.lo ddxCtrls.lo ddxFakeMtn.lo ddxLEDs.lo \ - ddxLoad.lo ddxList.lo ddxDevBtn.lo +am__objects_1 = ddxBeep.lo ddxCtrls.lo ddxLEDs.lo ddxLoad.lo \ + ddxList.lo am__objects_2 = xkb.lo xkbUtils.lo xkbEvents.lo xkbAccessX.lo \ xkbSwap.lo xkbLEDs.lo xkbInit.lo xkbActions.lo xkbPrKeyEv.lo am__objects_3 = maprules.lo xkmread.lo xkbtext.lo xkbfmisc.lo \ @@ -129,10 +129,6 @@ BUILDDOCS_TRUE = @BUILDDOCS_TRUE@ BUILD_DATE = @BUILD_DATE@ BUILD_KDRIVEFBDEVLIB_FALSE = @BUILD_KDRIVEFBDEVLIB_FALSE@ BUILD_KDRIVEFBDEVLIB_TRUE = @BUILD_KDRIVEFBDEVLIB_TRUE@ -BUILD_LINUXDOC_FALSE = @BUILD_LINUXDOC_FALSE@ -BUILD_LINUXDOC_TRUE = @BUILD_LINUXDOC_TRUE@ -BUILD_PDFDOC_FALSE = @BUILD_PDFDOC_FALSE@ -BUILD_PDFDOC_TRUE = @BUILD_PDFDOC_TRUE@ BUILD_TIME = @BUILD_TIME@ CC = @CC@ CCAS = @CCAS@ @@ -220,6 +216,8 @@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ +ENABLE_DEVEL_DOCS_FALSE = @ENABLE_DEVEL_DOCS_FALSE@ +ENABLE_DEVEL_DOCS_TRUE = @ENABLE_DEVEL_DOCS_TRUE@ EXEEXT = @EXEEXT@ F77 = @F77@ FBDEVHW_FALSE = @FBDEVHW_FALSE@ @@ -234,6 +232,7 @@ FONTOTFDIR = @FONTOTFDIR@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ +FOP = @FOP@ FREEBSD_KLDLOAD_FALSE = @FREEBSD_KLDLOAD_FALSE@ FREEBSD_KLDLOAD_TRUE = @FREEBSD_KLDLOAD_TRUE@ GLIB_CFLAGS = @GLIB_CFLAGS@ @@ -251,10 +250,14 @@ HAVE_DBUS_FALSE = @HAVE_DBUS_FALSE@ HAVE_DBUS_TRUE = @HAVE_DBUS_TRUE@ HAVE_DOXYGEN_FALSE = @HAVE_DOXYGEN_FALSE@ HAVE_DOXYGEN_TRUE = @HAVE_DOXYGEN_TRUE@ -HAVE_PS2PDF_FALSE = @HAVE_PS2PDF_FALSE@ -HAVE_PS2PDF_TRUE = @HAVE_PS2PDF_TRUE@ +HAVE_FOP_FALSE = @HAVE_FOP_FALSE@ +HAVE_FOP_TRUE = @HAVE_FOP_TRUE@ HAVE_STYLESHEETS_FALSE = @HAVE_STYLESHEETS_FALSE@ HAVE_STYLESHEETS_TRUE = @HAVE_STYLESHEETS_TRUE@ +HAVE_XMLTO_FALSE = @HAVE_XMLTO_FALSE@ +HAVE_XMLTO_TEXT_FALSE = @HAVE_XMLTO_TEXT_FALSE@ +HAVE_XMLTO_TEXT_TRUE = @HAVE_XMLTO_TEXT_TRUE@ +HAVE_XMLTO_TRUE = @HAVE_XMLTO_TRUE@ HP300_VIDEO_FALSE = @HP300_VIDEO_FALSE@ HP300_VIDEO_TRUE = @HP300_VIDEO_TRUE@ HPPA_VIDEO_FALSE = @HPPA_VIDEO_FALSE@ @@ -310,10 +313,11 @@ LIBDRM_CFLAGS = @LIBDRM_CFLAGS@ LIBDRM_LIBS = @LIBDRM_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ +LIBSHA1_CFLAGS = @LIBSHA1_CFLAGS@ +LIBSHA1_LIBS = @LIBSHA1_LIBS@ LIBTOOL = @LIBTOOL@ LIB_MAN_DIR = @LIB_MAN_DIR@ LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@ -LINUXDOC = @LINUXDOC@ LINUX_ALPHA_FALSE = @LINUX_ALPHA_FALSE@ LINUX_ALPHA_TRUE = @LINUX_ALPHA_TRUE@ LINUX_IA64_FALSE = @LINUX_IA64_FALSE@ @@ -331,17 +335,11 @@ MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ MAIN_LIB = @MAIN_LIB@ MAKEINFO = @MAKEINFO@ -MAKE_HTML = @MAKE_HTML@ -MAKE_PDF = @MAKE_PDF@ -MAKE_PS = @MAKE_PS@ -MAKE_TEXT = @MAKE_TEXT@ MAN_SUBSTS = @MAN_SUBSTS@ MISC_MAN_DIR = @MISC_MAN_DIR@ MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@ MITSHM_FALSE = @MITSHM_FALSE@ MITSHM_TRUE = @MITSHM_TRUE@ -MULTIBUFFER_FALSE = @MULTIBUFFER_FALSE@ -MULTIBUFFER_TRUE = @MULTIBUFFER_TRUE@ NEED_STRLCAT_FALSE = @NEED_STRLCAT_FALSE@ NEED_STRLCAT_TRUE = @NEED_STRLCAT_TRUE@ NEED_VSNPRINTF_FALSE = @NEED_VSNPRINTF_FALSE@ @@ -368,20 +366,23 @@ PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@ PCIACCESS_LIBS = @PCIACCESS_LIBS@ PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@ PERL = @PERL@ +PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ +PIXMAN_LIBS = @PIXMAN_LIBS@ PKG_CONFIG = @PKG_CONFIG@ PPC_VIDEO_FALSE = @PPC_VIDEO_FALSE@ PPC_VIDEO_TRUE = @PPC_VIDEO_TRUE@ PROJECTROOT = @PROJECTROOT@ -PS2PDF = @PS2PDF@ RANLIB = @RANLIB@ RAWCPP = @RAWCPP@ RAWCPPFLAGS = @RAWCPPFLAGS@ RECORD_FALSE = @RECORD_FALSE@ RECORD_TRUE = @RECORD_TRUE@ +RELEASE_DATE = @RELEASE_DATE@ RES_FALSE = @RES_FALSE@ RES_TRUE = @RES_TRUE@ SCREENSAVER_FALSE = @SCREENSAVER_FALSE@ SCREENSAVER_TRUE = @SCREENSAVER_TRUE@ +SDK_REQUIRED_MODULES = @SDK_REQUIRED_MODULES@ SECURE_RPC_FALSE = @SECURE_RPC_FALSE@ SECURE_RPC_TRUE = @SECURE_RPC_TRUE@ SED = @SED@ @@ -473,6 +474,7 @@ XKB_COMPILED_DIR = @XKB_COMPILED_DIR@ XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@ XLIB_CFLAGS = @XLIB_CFLAGS@ XLIB_LIBS = @XLIB_LIBS@ +XMLTO = @XMLTO@ XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@ XNESTMODULES_LIBS = @XNESTMODULES_LIBS@ XNEST_FALSE = @XNEST_FALSE@ @@ -623,11 +625,9 @@ AM_CFLAGS = $(DIX_CFLAGS) DDX_SRCS = \ ddxBeep.c \ ddxCtrls.c \ - ddxFakeMtn.c \ ddxLEDs.c \ ddxLoad.c \ - ddxList.c \ - ddxDevBtn.c + ddxList.c DIX_SRCS = \ xkb.c \ @@ -719,8 +719,6 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/XKBMisc.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ddxBeep.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ddxCtrls.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ddxDevBtn.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ddxFakeMtn.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ddxKillSrv.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ddxLEDs.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ddxList.Plo@am__quote@ diff --git a/xserver/xkb/XKBAlloc.c b/xserver/xkb/XKBAlloc.c index d40aa3345..c52e091da 100644 --- a/xserver/xkb/XKBAlloc.c +++ b/xserver/xkb/XKBAlloc.c @@ -57,10 +57,10 @@ XkbSymInterpretRec *prev_interpret; if (compat->sym_interpret==NULL) compat->num_si= 0; prev_interpret = compat->sym_interpret; - compat->sym_interpret= xrealloc(compat->sym_interpret, + compat->sym_interpret= realloc(compat->sym_interpret, nSI * sizeof(XkbSymInterpretRec)); if (compat->sym_interpret==NULL) { - xfree(prev_interpret); + free(prev_interpret); compat->size_si= compat->num_si= 0; return BadAlloc; } @@ -70,19 +70,19 @@ XkbSymInterpretRec *prev_interpret; } return Success; } - compat= xcalloc(1, sizeof(XkbCompatMapRec)); + compat= calloc(1, sizeof(XkbCompatMapRec)); if (compat==NULL) return BadAlloc; if (nSI>0) { - compat->sym_interpret= xcalloc(nSI, sizeof(XkbSymInterpretRec)); + compat->sym_interpret= calloc(nSI, sizeof(XkbSymInterpretRec)); if (!compat->sym_interpret) { - xfree(compat); + free(compat); return BadAlloc; } } compat->size_si= nSI; compat->num_si= 0; - bzero((char *)&compat->groups[0],XkbNumKbdGroups*sizeof(XkbModsRec)); + memset((char *)&compat->groups[0], 0, XkbNumKbdGroups*sizeof(XkbModsRec)); xkb->compat= compat; return Success; } @@ -99,15 +99,15 @@ register XkbCompatMapPtr compat; if (freeMap) which= XkbAllCompatMask; if (which&XkbGroupCompatMask) - bzero((char *)&compat->groups[0],XkbNumKbdGroups*sizeof(XkbModsRec)); + memset((char *)&compat->groups[0], 0, XkbNumKbdGroups*sizeof(XkbModsRec)); if (which&XkbSymInterpMask) { if ((compat->sym_interpret)&&(compat->size_si>0)) - xfree(compat->sym_interpret); + free(compat->sym_interpret); compat->size_si= compat->num_si= 0; compat->sym_interpret= NULL; } if (freeMap) { - xfree(compat); + free(compat); xkb->compat= NULL; } return; @@ -123,7 +123,7 @@ XkbNamesPtr names; if (xkb==NULL) return BadMatch; if (xkb->names==NULL) { - xkb->names = xcalloc(1, sizeof(XkbNamesRec)); + xkb->names = calloc(1, sizeof(XkbNamesRec)); if (xkb->names==NULL) return BadAlloc; } @@ -135,7 +135,7 @@ XkbNamesPtr names; type= xkb->map->types; for (i=0;i<xkb->map->num_types;i++,type++) { if (type->level_names==NULL) { - type->level_names= xcalloc(type->num_levels, sizeof(Atom)); + type->level_names= calloc(type->num_levels, sizeof(Atom)); if (type->level_names==NULL) return BadAlloc; } @@ -146,24 +146,24 @@ XkbNamesPtr names; (!XkbIsLegalKeycode(xkb->max_key_code))|| (xkb->max_key_code<xkb->min_key_code)) return BadValue; - names->keys= xcalloc((xkb->max_key_code+1), sizeof(XkbKeyNameRec)); + names->keys= calloc((xkb->max_key_code+1), sizeof(XkbKeyNameRec)); if (names->keys==NULL) return BadAlloc; } if ((which&XkbKeyAliasesMask)&&(nTotalAliases>0)) { if (names->key_aliases==NULL) { - names->key_aliases= xcalloc(nTotalAliases, sizeof(XkbKeyAliasRec)); + names->key_aliases= calloc(nTotalAliases, sizeof(XkbKeyAliasRec)); } else if (nTotalAliases>names->num_key_aliases) { XkbKeyAliasRec *prev_aliases = names->key_aliases; - names->key_aliases= xrealloc(names->key_aliases, + names->key_aliases= realloc(names->key_aliases, nTotalAliases * sizeof(XkbKeyAliasRec)); if (names->key_aliases!=NULL) { memset(&names->key_aliases[names->num_key_aliases], 0, (nTotalAliases - names->num_key_aliases) * sizeof(XkbKeyAliasRec)); } else { - xfree(prev_aliases); + free(prev_aliases); } } if (names->key_aliases==NULL) { @@ -174,18 +174,18 @@ XkbNamesPtr names; } if ((which&XkbRGNamesMask)&&(nTotalRG>0)) { if (names->radio_groups==NULL) { - names->radio_groups= xcalloc(nTotalRG, sizeof(Atom)); + names->radio_groups= calloc(nTotalRG, sizeof(Atom)); } else if (nTotalRG>names->num_rg) { Atom *prev_radio_groups = names->radio_groups; - names->radio_groups= xrealloc(names->radio_groups, + names->radio_groups= realloc(names->radio_groups, nTotalRG * sizeof(Atom)); if (names->radio_groups!=NULL) { memset(&names->radio_groups[names->num_rg], 0, (nTotalRG - names->num_rg) * sizeof(Atom)); } else { - xfree(prev_radio_groups); + free(prev_radio_groups); } } if (names->radio_groups==NULL) @@ -213,29 +213,29 @@ XkbNamesPtr names; type= map->types; for (i=0;i<map->num_types;i++,type++) { if (type->level_names!=NULL) { - xfree(type->level_names); + free(type->level_names); type->level_names= NULL; } } } } if ((which&XkbKeyNamesMask)&&(names->keys!=NULL)) { - xfree(names->keys); + free(names->keys); names->keys= NULL; names->num_keys= 0; } if ((which&XkbKeyAliasesMask)&&(names->key_aliases)){ - xfree(names->key_aliases); + free(names->key_aliases); names->key_aliases=NULL; names->num_key_aliases=0; } if ((which&XkbRGNamesMask)&&(names->radio_groups)) { - xfree(names->radio_groups); + free(names->radio_groups); names->radio_groups= NULL; names->num_rg= 0; } if (freeMap) { - xfree(names); + free(names); xkb->names= NULL; } return; @@ -251,7 +251,7 @@ XkbAllocControls(XkbDescPtr xkb,unsigned which) return BadMatch; if (xkb->ctrls==NULL) { - xkb->ctrls= xcalloc(1, sizeof(XkbControlsRec)); + xkb->ctrls= calloc(1, sizeof(XkbControlsRec)); if (!xkb->ctrls) return BadAlloc; } @@ -263,7 +263,7 @@ static void XkbFreeControls(XkbDescPtr xkb,unsigned which,Bool freeMap) { if (freeMap && (xkb!=NULL) && (xkb->ctrls!=NULL)) { - xfree(xkb->ctrls); + free(xkb->ctrls); xkb->ctrls= NULL; } return; @@ -277,7 +277,7 @@ XkbAllocIndicatorMaps(XkbDescPtr xkb) if (xkb==NULL) return BadMatch; if (xkb->indicators==NULL) { - xkb->indicators= xcalloc(1, sizeof(XkbIndicatorRec)); + xkb->indicators= calloc(1, sizeof(XkbIndicatorRec)); if (!xkb->indicators) return BadAlloc; } @@ -288,7 +288,7 @@ static void XkbFreeIndicatorMaps(XkbDescPtr xkb) { if ((xkb!=NULL)&&(xkb->indicators!=NULL)) { - xfree(xkb->indicators); + free(xkb->indicators); xkb->indicators= NULL; } return; @@ -301,7 +301,7 @@ XkbAllocKeyboard(void) { XkbDescRec *xkb; - xkb = xcalloc(1, sizeof(XkbDescRec)); + xkb = calloc(1, sizeof(XkbDescRec)); if (xkb) xkb->device_spec= XkbUseCoreKbd; return xkb; @@ -332,6 +332,6 @@ XkbFreeKeyboard(XkbDescPtr xkb,unsigned which,Bool freeAll) if (which&XkbControlsMask) XkbFreeControls(xkb,XkbAllControlsMask,TRUE); if (freeAll) - xfree(xkb); + free(xkb); return; } diff --git a/xserver/xkb/XKBGAlloc.c b/xserver/xkb/XKBGAlloc.c index b01005dd0..d1adea34e 100644 --- a/xserver/xkb/XKBGAlloc.c +++ b/xserver/xkb/XKBGAlloc.c @@ -51,7 +51,7 @@ _XkbFreeGeomLeafElems( Bool freeAll, if ((freeAll)||(*elems==NULL)) { *num_inout= *sz_inout= 0; if (*elems!=NULL) { - xfree(*elems); + free(*elems); *elems= NULL; } return; @@ -114,10 +114,8 @@ register char *ptr; } if (freeAll) { (*num_inout)= (*sz_inout)= 0; - if (*elems) { - xfree(*elems); - *elems= NULL; - } + free(*elems); + *elems = NULL; } else if (first+count>=(*num_inout)) *num_inout= first; @@ -137,14 +135,10 @@ _XkbClearProperty(char *prop_in) { XkbPropertyPtr prop= (XkbPropertyPtr)prop_in; - if (prop->name) { - xfree(prop->name); - prop->name= NULL; - } - if (prop->value) { - xfree(prop->value); - prop->value= NULL; - } + free(prop->name); + prop->name = NULL; + free(prop->value); + prop->value = NULL; return; } @@ -183,8 +177,7 @@ _XkbClearColor(char *color_in) { XkbColorPtr color= (XkbColorPtr)color_in; - if (color->spec) - xfree(color->spec); + free(color->spec); return; } @@ -381,11 +374,11 @@ XkbDoodadPtr doodad= (XkbDoodadPtr)doodad_in; case XkbTextDoodad: { if (doodad->text.text!=NULL) { - xfree(doodad->text.text); + free(doodad->text.text); doodad->text.text= NULL; } if (doodad->text.font!=NULL) { - xfree(doodad->text.font); + free(doodad->text.font); doodad->text.font= NULL; } } @@ -393,7 +386,7 @@ XkbDoodadPtr doodad= (XkbDoodadPtr)doodad_in; case XkbLogoDoodad: { if (doodad->logo.logo_name!=NULL) { - xfree(doodad->logo.logo_name); + free(doodad->logo.logo_name); doodad->logo.logo_name= NULL; } } @@ -413,7 +406,7 @@ register XkbDoodadPtr doodad; _XkbClearDoodad((char *)doodad); } if (freeAll) - xfree(doodads); + free(doodads); } return; } @@ -442,10 +435,10 @@ XkbFreeGeometry(XkbGeometryPtr geom,unsigned which,Bool freeMap) XkbFreeGeomKeyAliases(geom,0,geom->num_key_aliases,TRUE); if (freeMap) { if (geom->label_font!=NULL) { - xfree(geom->label_font); + free(geom->label_font); geom->label_font= NULL; } - xfree(geom); + free(geom); } return; } @@ -469,8 +462,8 @@ _XkbGeomAlloc( void ** old, *total= (*num)+num_new; if ((*old)!=NULL) - (*old)= xrealloc((*old),(*total)*sz_elem); - else (*old)= xcalloc((*total),sz_elem); + (*old)= realloc((*old),(*total)*sz_elem); + else (*old)= calloc((*total),sz_elem); if ((*old)==NULL) { *total= *num= 0; return BadAlloc; @@ -478,7 +471,7 @@ _XkbGeomAlloc( void ** old, if (*num>0) { char *tmp= (char *)(*old); - bzero(&tmp[sz_elem*(*num)],(num_new*sz_elem)); + memset(&tmp[sz_elem*(*num)], 0, (num_new*sz_elem)); } return Success; } @@ -615,7 +608,7 @@ XkbGeometryPtr geom; Status rtrn; if (xkb->geom==NULL) { - xkb->geom= xcalloc(1, sizeof(XkbGeometryRec)); + xkb->geom= calloc(1, sizeof(XkbGeometryRec)); if (!xkb->geom) return BadAlloc; } @@ -663,9 +656,8 @@ register XkbPropertyPtr prop; return NULL; for (i=0,prop=geom->properties;i<geom->num_properties;i++,prop++) { if ((prop->name)&&(strcmp(name,prop->name)==0)) { - if (prop->value) - xfree(prop->value); - prop->value= xalloc(strlen(value)+1); + free(prop->value); + prop->value= malloc(strlen(value)+1); if (prop->value) strcpy(prop->value,value); return prop; @@ -676,13 +668,13 @@ register XkbPropertyPtr prop; return NULL; } prop= &geom->properties[geom->num_properties]; - prop->name= xalloc(strlen(name)+1); + prop->name= malloc(strlen(name)+1); if (!name) return NULL; strcpy(prop->name,name); - prop->value= xalloc(strlen(value)+1); + prop->value= malloc(strlen(value)+1); if (!value) { - xfree(prop->name); + free(prop->name); prop->name= NULL; return NULL; } @@ -701,7 +693,7 @@ register XkbKeyAliasPtr alias; return NULL; for (i=0,alias=geom->key_aliases;i<geom->num_key_aliases;i++,alias++) { if (strncmp(alias->alias,aliasStr,XkbKeyNameLength)==0) { - bzero(alias->real,XkbKeyNameLength); + memset(alias->real, 0, XkbKeyNameLength); strncpy(alias->real,realStr,XkbKeyNameLength); return alias; } @@ -711,7 +703,7 @@ register XkbKeyAliasPtr alias; return NULL; } alias= &geom->key_aliases[geom->num_key_aliases]; - bzero(alias,sizeof(XkbKeyAliasRec)); + memset(alias, 0, sizeof(XkbKeyAliasRec)); strncpy(alias->alias,aliasStr,XkbKeyNameLength); strncpy(alias->real,realStr,XkbKeyNameLength); geom->num_key_aliases++; @@ -738,7 +730,7 @@ register XkbColorPtr color; } color= &geom->colors[geom->num_colors]; color->pixel= pixel; - color->spec= xalloc(strlen(spec)+1); + color->spec= malloc(strlen(spec)+1); if (!color->spec) return NULL; strcpy(color->spec,spec); @@ -758,7 +750,7 @@ XkbOutlinePtr outline; return NULL; } outline= &shape->outlines[shape->num_outlines]; - bzero(outline,sizeof(XkbOutlineRec)); + memset(outline, 0, sizeof(XkbOutlineRec)); if ((sz_points>0)&&(_XkbAllocPoints(outline,sz_points)!=Success)) return NULL; shape->num_outlines++; @@ -783,7 +775,7 @@ register int i; (_XkbAllocShapes(geom,1)!=Success)) return NULL; shape= &geom->shapes[geom->num_shapes]; - bzero(shape,sizeof(XkbShapeRec)); + memset(shape, 0, sizeof(XkbShapeRec)); if ((sz_outlines>0)&&(_XkbAllocOutlines(shape,sz_outlines)!=Success)) return NULL; shape->name= name; @@ -801,7 +793,7 @@ XkbKeyPtr key; if ((row->num_keys>=row->sz_keys)&&(_XkbAllocKeys(row,1)!=Success)) return NULL; key= &row->keys[row->num_keys++]; - bzero(key,sizeof(XkbKeyRec)); + memset(key, 0, sizeof(XkbKeyRec)); return key; } @@ -816,7 +808,7 @@ XkbRowPtr row; (_XkbAllocRows(section,1)!=Success)) return NULL; row= §ion->rows[section->num_rows]; - bzero(row,sizeof(XkbRowRec)); + memset(row, 0, sizeof(XkbRowRec)); if ((sz_keys>0)&&(_XkbAllocKeys(row,sz_keys)!=Success)) return NULL; section->num_rows++; @@ -852,7 +844,7 @@ XkbSectionPtr section; return NULL; if ((sz_doodads>0)&&(_XkbAllocDoodads(section,sz_doodads)!=Success)) { if (section->rows) { - xfree(section->rows); + free(section->rows); section->rows= NULL; section->sz_rows= section->num_rows= 0; } @@ -896,7 +888,7 @@ register int i,nDoodads; return NULL; doodad= &geom->doodads[geom->num_doodads++]; } - bzero(doodad,sizeof(XkbDoodadRec)); + memset(doodad, 0, sizeof(XkbDoodadRec)); doodad->any.name= name; return doodad; } @@ -960,7 +952,7 @@ XkbOverlayRowPtr row; (_XkbAllocOverlayRows(overlay,1)!=Success)) return NULL; row= &overlay->rows[overlay->num_rows]; - bzero(row,sizeof(XkbOverlayRowRec)); + memset(row, 0, sizeof(XkbOverlayRowRec)); if ((sz_keys>0)&&(_XkbAllocOverlayKeys(row,sz_keys)!=Success)) return NULL; row->row_under= row_under; diff --git a/xserver/xkb/XKBMAlloc.c b/xserver/xkb/XKBMAlloc.c index fd12e2b6c..6b186c1ad 100644 --- a/xserver/xkb/XKBMAlloc.c +++ b/xserver/xkb/XKBMAlloc.c @@ -59,7 +59,7 @@ XkbClientMapPtr map; } if (xkb->map==NULL) { - map= xcalloc(1, sizeof(XkbClientMapRec)); + map= calloc(1, sizeof(XkbClientMapRec)); if (map==NULL) return BadAlloc; xkb->map= map; @@ -68,7 +68,7 @@ XkbClientMapPtr map; if ((which&XkbKeyTypesMask)&&(nTotalTypes>0)) { if (map->types==NULL) { - map->types= xcalloc(nTotalTypes, sizeof(XkbKeyTypeRec)); + map->types= calloc(nTotalTypes, sizeof(XkbKeyTypeRec)); if (map->types==NULL) return BadAlloc; map->num_types= 0; @@ -77,14 +77,14 @@ XkbClientMapPtr map; else if (map->size_types<nTotalTypes) { XkbKeyTypeRec *prev_types = map->types; - map->types= xrealloc(map->types,nTotalTypes * sizeof(XkbKeyTypeRec)); + map->types= realloc(map->types,nTotalTypes * sizeof(XkbKeyTypeRec)); if (map->types==NULL) { - xfree(prev_types); + free(prev_types); map->num_types= map->size_types= 0; return BadAlloc; } map->size_types= nTotalTypes; - bzero(&map->types[map->num_types], + memset(&map->types[map->num_types], 0, ((map->size_types-map->num_types)*sizeof(XkbKeyTypeRec))); } } @@ -92,7 +92,7 @@ XkbClientMapPtr map; int nKeys= XkbNumKeys(xkb); if (map->syms==NULL) { map->size_syms= (nKeys*15)/10; - map->syms= xcalloc(map->size_syms, sizeof(KeySym)); + map->syms= calloc(map->size_syms, sizeof(KeySym)); if (!map->syms) { map->size_syms= 0; return BadAlloc; @@ -102,7 +102,7 @@ XkbClientMapPtr map; } if (map->key_sym_map==NULL) { i= xkb->max_key_code+1; - map->key_sym_map= xcalloc(i, sizeof(XkbSymMapRec)); + map->key_sym_map= calloc(i, sizeof(XkbSymMapRec)); if (map->key_sym_map==NULL) return BadAlloc; } @@ -114,7 +114,7 @@ XkbClientMapPtr map; return BadMatch; if (map->modmap==NULL) { i= xkb->max_key_code+1; - map->modmap= xcalloc(i, sizeof(unsigned char)); + map->modmap= calloc(i, sizeof(unsigned char)); if (map->modmap==NULL) return BadAlloc; } @@ -131,7 +131,7 @@ XkbServerMapPtr map; if (xkb==NULL) return BadMatch; if (xkb->server==NULL) { - map= xcalloc(1, sizeof(XkbServerMapRec)); + map= calloc(1, sizeof(XkbServerMapRec)); if (map==NULL) return BadAlloc; for (i=0;i<XkbNumVirtualMods;i++) { @@ -147,7 +147,7 @@ XkbServerMapPtr map; return BadMatch; if (map->explicit==NULL) { i= xkb->max_key_code+1; - map->explicit= xcalloc(i, sizeof(unsigned char)); + map->explicit= calloc(i, sizeof(unsigned char)); if (map->explicit==NULL) return BadAlloc; } @@ -160,7 +160,7 @@ XkbServerMapPtr map; if (nNewActions<1) nNewActions= 1; if (map->acts==NULL) { - map->acts= xcalloc((nNewActions+1), sizeof(XkbAction)); + map->acts= calloc((nNewActions+1), sizeof(XkbAction)); if (map->acts==NULL) return BadAlloc; map->num_acts= 1; @@ -170,19 +170,19 @@ XkbServerMapPtr map; unsigned need; XkbAction *prev_acts = map->acts; need= map->num_acts+nNewActions; - map->acts= xrealloc(map->acts,need * sizeof(XkbAction)); + map->acts= realloc(map->acts,need * sizeof(XkbAction)); if (map->acts==NULL) { - xfree(prev_acts); + free(prev_acts); map->num_acts= map->size_acts= 0; return BadAlloc; } map->size_acts= need; - bzero(&map->acts[map->num_acts], + memset(&map->acts[map->num_acts], 0, ((map->size_acts-map->num_acts)*sizeof(XkbAction))); } if (map->key_acts==NULL) { i= xkb->max_key_code+1; - map->key_acts= xcalloc(i, sizeof(unsigned short)); + map->key_acts= calloc(i, sizeof(unsigned short)); if (map->key_acts==NULL) return BadAlloc; } @@ -194,7 +194,7 @@ XkbServerMapPtr map; return BadMatch; if (map->behaviors==NULL) { i= xkb->max_key_code+1; - map->behaviors= xcalloc(i, sizeof(XkbBehavior)); + map->behaviors= calloc(i, sizeof(XkbBehavior)); if (map->behaviors==NULL) return BadAlloc; } @@ -206,7 +206,7 @@ XkbServerMapPtr map; return BadMatch; if (map->vmodmap==NULL) { i= xkb->max_key_code+1; - map->vmodmap= xcalloc(i, sizeof(unsigned short)); + map->vmodmap= calloc(i, sizeof(unsigned short)); if (map->vmodmap==NULL) return BadAlloc; } @@ -221,34 +221,28 @@ XkbCopyKeyType(XkbKeyTypePtr from,XkbKeyTypePtr into) { if ((!from)||(!into)) return BadMatch; - if (into->map) { - xfree(into->map); - into->map= NULL; - } - if (into->preserve) { - xfree(into->preserve); - into->preserve= NULL; - } - if (into->level_names) { - xfree(into->level_names); - into->level_names= NULL; - } + free(into->map); + into->map = NULL; + free(into->preserve); + into->preserve = NULL; + free(into->level_names); + into->level_names = NULL; *into= *from; if ((from->map)&&(into->map_count>0)) { - into->map= xcalloc(into->map_count, sizeof(XkbKTMapEntryRec)); + into->map= calloc(into->map_count, sizeof(XkbKTMapEntryRec)); if (!into->map) return BadAlloc; memcpy(into->map,from->map,into->map_count*sizeof(XkbKTMapEntryRec)); } if ((from->preserve)&&(into->map_count>0)) { - into->preserve= xcalloc(into->map_count, sizeof(XkbModsRec)); + into->preserve= calloc(into->map_count, sizeof(XkbModsRec)); if (!into->preserve) return BadAlloc; memcpy(into->preserve,from->preserve, into->map_count*sizeof(XkbModsRec)); } if ((from->level_names)&&(into->num_levels>0)) { - into->level_names= xcalloc(into->num_levels, sizeof(Atom)); + into->level_names= calloc(into->num_levels, sizeof(Atom)); if (!into->level_names) return BadAlloc; memcpy(into->level_names,from->level_names, @@ -299,10 +293,10 @@ KeyCode matchingKeys[XkbMaxKeyCount],nMatchingKeys; type= &xkb->map->types[type_ndx]; if (map_count==0) { if (type->map!=NULL) - xfree(type->map); + free(type->map); type->map= NULL; if (type->preserve!=NULL) - xfree(type->preserve); + free(type->preserve); type->preserve= NULL; type->map_count= 0; } @@ -310,27 +304,25 @@ KeyCode matchingKeys[XkbMaxKeyCount],nMatchingKeys; XkbKTMapEntryRec *prev_map = type->map; if ((map_count>type->map_count)||(type->map==NULL)) - type->map = xrealloc(type->map,map_count * sizeof(XkbKTMapEntryRec)); + type->map = realloc(type->map,map_count * sizeof(XkbKTMapEntryRec)); if (!type->map) { - if (prev_map) - xfree(prev_map); + free(prev_map); return BadAlloc; } if (want_preserve) { XkbModsRec *prev_preserve = type->preserve; if ((map_count>type->map_count)||(type->preserve==NULL)) { - type->preserve = xrealloc(type->preserve, + type->preserve = realloc(type->preserve, map_count * sizeof(XkbModsRec)); } if (!type->preserve) { - if (prev_preserve) - xfree(prev_preserve); + free(prev_preserve); return BadAlloc; } } else if (type->preserve!=NULL) { - xfree(type->preserve); + free(type->preserve); type->preserve= NULL; } type->map_count= map_count; @@ -339,11 +331,10 @@ KeyCode matchingKeys[XkbMaxKeyCount],nMatchingKeys; if ((new_num_lvls>type->num_levels)||(type->level_names==NULL)) { Atom * prev_level_names = type->level_names; - type->level_names = xrealloc(type->level_names, + type->level_names = realloc(type->level_names, new_num_lvls * sizeof(Atom)); if (!type->level_names) { - if (prev_level_names) - xfree(prev_level_names); + free(prev_level_names); return BadAlloc; } } @@ -368,7 +359,7 @@ KeyCode matchingKeys[XkbMaxKeyCount],nMatchingKeys; * The possibilities marked with '+' require us to examine the key types * associated with each group for the key. */ - bzero(matchingKeys,XkbMaxKeyCount*sizeof(KeyCode)); + memset(matchingKeys, 0, XkbMaxKeyCount*sizeof(KeyCode)); nMatchingKeys= 0; if (new_num_lvls>type->num_levels) { int nTotal; @@ -397,7 +388,7 @@ KeyCode matchingKeys[XkbMaxKeyCount],nMatchingKeys; if (nResize>0) { int nextMatch; xkb->map->size_syms= (nTotal*15)/10; - newSyms = xcalloc(xkb->map->size_syms, sizeof(KeySym)); + newSyms = calloc(xkb->map->size_syms, sizeof(KeySym)); if (newSyms==NULL) return BadAlloc; nextMatch= 0; @@ -423,7 +414,7 @@ KeyCode matchingKeys[XkbMaxKeyCount],nMatchingKeys; } } type->num_levels= new_num_lvls; - xfree(xkb->map->syms); + free(xkb->map->syms); xkb->map->syms= newSyms; xkb->map->num_syms= nSyms; return Success; @@ -461,7 +452,7 @@ KeyCode matchingKeys[XkbMaxKeyCount],nMatchingKeys; for (g=XkbKeyNumGroups(xkb,key)-1;g>=0;g--) { if (XkbKeyKeyTypeIndex(xkb,key,g)==type_ndx) { if (nClear>0) - bzero(&pSyms[g*width+firstClear],nClear*sizeof(KeySym)); + memset(&pSyms[g*width+firstClear], 0, nClear*sizeof(KeySym)); } } } @@ -491,15 +482,15 @@ KeySym *newSyms; nOldSyms*sizeof(KeySym)); } if ((needed-nOldSyms)>0) { - bzero(&xkb->map->syms[xkb->map->num_syms+XkbKeyNumSyms(xkb,key)], - (needed-nOldSyms)*sizeof(KeySym)); + memset(&xkb->map->syms[xkb->map->num_syms+XkbKeyNumSyms(xkb, key)], + 0, (needed-nOldSyms)*sizeof(KeySym)); } xkb->map->key_sym_map[key].offset = xkb->map->num_syms; xkb->map->num_syms+= needed; return &xkb->map->syms[xkb->map->key_sym_map[key].offset]; } xkb->map->size_syms+= (needed>32?needed:32); - newSyms = xcalloc(xkb->map->size_syms, sizeof(KeySym)); + newSyms = calloc(xkb->map->size_syms, sizeof(KeySym)); if (newSyms==NULL) return NULL; newSyms[0]= NoSymbol; @@ -515,11 +506,11 @@ KeySym *newSyms; if (nCopy!=0) memcpy(&newSyms[nSyms],XkbKeySymsPtr(xkb,i),nCopy*sizeof(KeySym)); if (nKeySyms>nCopy) - bzero(&newSyms[nSyms+nCopy],(nKeySyms-nCopy)*sizeof(KeySym)); + memset(&newSyms[nSyms+nCopy], 0, (nKeySyms-nCopy)*sizeof(KeySym)); xkb->map->key_sym_map[i].offset = nSyms; nSyms+= nKeySyms; } - xfree(xkb->map->syms); + free(xkb->map->syms); xkb->map->syms = newSyms; xkb->map->num_syms = nSyms; return &xkb->map->syms[xkb->map->key_sym_map[key].offset]; @@ -568,7 +559,7 @@ int tmp; tmp= xkb->min_key_code-minKC; if (xkb->map) { if (xkb->map->key_sym_map) { - bzero((char *)&xkb->map->key_sym_map[minKC], + memset((char *)&xkb->map->key_sym_map[minKC], 0, tmp*sizeof(XkbSymMapRec)); if (changes) { changes->map.changed= _ExtendRange(changes->map.changed, @@ -578,7 +569,7 @@ int tmp; } } if (xkb->map->modmap) { - bzero((char *)&xkb->map->modmap[minKC],tmp); + memset((char *)&xkb->map->modmap[minKC], 0, tmp); if (changes) { changes->map.changed= _ExtendRange(changes->map.changed, XkbModifierMapMask,minKC, @@ -589,7 +580,7 @@ int tmp; } if (xkb->server) { if (xkb->server->behaviors) { - bzero((char *)&xkb->server->behaviors[minKC], + memset((char *)&xkb->server->behaviors[minKC], 0, tmp*sizeof(XkbBehavior)); if (changes) { changes->map.changed= _ExtendRange(changes->map.changed, @@ -599,7 +590,7 @@ int tmp; } } if (xkb->server->key_acts) { - bzero((char *)&xkb->server->key_acts[minKC], + memset((char *)&xkb->server->key_acts[minKC], 0, tmp*sizeof(unsigned short)); if (changes) { changes->map.changed= _ExtendRange(changes->map.changed, @@ -609,7 +600,7 @@ int tmp; } } if (xkb->server->vmodmap) { - bzero((char *)&xkb->server->vmodmap[minKC], + memset((char *)&xkb->server->vmodmap[minKC], 0, tmp*sizeof(unsigned short)); if (changes) { changes->map.changed= _ExtendRange(changes->map.changed, @@ -620,7 +611,7 @@ int tmp; } } if ((xkb->names)&&(xkb->names->keys)) { - bzero((char *)&xkb->names->keys[minKC],tmp*sizeof(XkbKeyNameRec)); + memset((char *)&xkb->names->keys[minKC], 0, tmp*sizeof(XkbKeyNameRec)); if (changes) { changes->names.changed= _ExtendRange(changes->names.changed, XkbKeyNamesMask,minKC, @@ -638,13 +629,13 @@ int tmp; if (xkb->map->key_sym_map) { XkbSymMapRec *prev_key_sym_map = xkb->map->key_sym_map; - xkb->map->key_sym_map = xrealloc(xkb->map->key_sym_map, + xkb->map->key_sym_map = realloc(xkb->map->key_sym_map, (maxKC+1) * sizeof(XkbSymMapRec)); if (!xkb->map->key_sym_map) { - xfree(prev_key_sym_map); + free(prev_key_sym_map); return BadAlloc; } - bzero((char *)&xkb->map->key_sym_map[xkb->max_key_code], + memset((char *)&xkb->map->key_sym_map[xkb->max_key_code], 0, tmp*sizeof(XkbSymMapRec)); if (changes) { changes->map.changed= _ExtendRange(changes->map.changed, @@ -656,13 +647,13 @@ int tmp; if (xkb->map->modmap) { unsigned char *prev_modmap = xkb->map->modmap; - xkb->map->modmap = xrealloc(xkb->map->modmap, + xkb->map->modmap = realloc(xkb->map->modmap, (maxKC+1) * sizeof(unsigned char)); if (!xkb->map->modmap) { - xfree(prev_modmap); + free(prev_modmap); return BadAlloc; } - bzero((char *)&xkb->map->modmap[xkb->max_key_code],tmp); + memset((char *)&xkb->map->modmap[xkb->max_key_code], 0, tmp); if (changes) { changes->map.changed= _ExtendRange(changes->map.changed, XkbModifierMapMask,maxKC, @@ -675,13 +666,13 @@ int tmp; if (xkb->server->behaviors) { XkbBehavior *prev_behaviors = xkb->server->behaviors; - xkb->server->behaviors = xrealloc(xkb->server->behaviors, + xkb->server->behaviors = realloc(xkb->server->behaviors, (maxKC+1) * sizeof(XkbBehavior)); if (!xkb->server->behaviors) { - xfree(prev_behaviors); + free(prev_behaviors); return BadAlloc; } - bzero((char *)&xkb->server->behaviors[xkb->max_key_code], + memset((char *)&xkb->server->behaviors[xkb->max_key_code], 0, tmp*sizeof(XkbBehavior)); if (changes) { changes->map.changed= _ExtendRange(changes->map.changed, @@ -693,13 +684,13 @@ int tmp; if (xkb->server->key_acts) { unsigned short *prev_key_acts = xkb->server->key_acts; - xkb->server->key_acts= xrealloc(xkb->server->key_acts, + xkb->server->key_acts= realloc(xkb->server->key_acts, (maxKC+1) * sizeof(unsigned short)); if (!xkb->server->key_acts) { - xfree(prev_key_acts); + free(prev_key_acts); return BadAlloc; } - bzero((char *)&xkb->server->key_acts[xkb->max_key_code], + memset((char *)&xkb->server->key_acts[xkb->max_key_code], 0, tmp*sizeof(unsigned short)); if (changes) { changes->map.changed= _ExtendRange(changes->map.changed, @@ -711,13 +702,13 @@ int tmp; if (xkb->server->vmodmap) { unsigned short *prev_vmodmap = xkb->server->vmodmap; - xkb->server->vmodmap= xrealloc(xkb->server->vmodmap, + xkb->server->vmodmap= realloc(xkb->server->vmodmap, (maxKC+1) * sizeof(unsigned short)); if (!xkb->server->vmodmap) { - xfree(prev_vmodmap); + free(prev_vmodmap); return BadAlloc; } - bzero((char *)&xkb->server->vmodmap[xkb->max_key_code], + memset((char *)&xkb->server->vmodmap[xkb->max_key_code], 0, tmp*sizeof(unsigned short)); if (changes) { changes->map.changed= _ExtendRange(changes->map.changed, @@ -730,13 +721,13 @@ int tmp; if ((xkb->names)&&(xkb->names->keys)) { XkbKeyNameRec *prev_keys = xkb->names->keys; - xkb->names->keys = xrealloc(xkb->names->keys, + xkb->names->keys = realloc(xkb->names->keys, (maxKC+1) * sizeof(XkbKeyNameRec)); if (!xkb->names->keys) { - xfree(prev_keys); + free(prev_keys); return BadAlloc; } - bzero((char *)&xkb->names->keys[xkb->max_key_code], + memset((char *)&xkb->names->keys[xkb->max_key_code], 0, tmp*sizeof(XkbKeyNameRec)); if (changes) { changes->names.changed= _ExtendRange(changes->names.changed, @@ -768,7 +759,7 @@ XkbAction *newActs; return &xkb->server->acts[xkb->server->key_acts[key]]; } xkb->server->size_acts= xkb->server->num_acts+needed+8; - newActs = xcalloc(xkb->server->size_acts, sizeof(XkbAction)); + newActs = calloc(xkb->server->size_acts, sizeof(XkbAction)); if (newActs==NULL) return NULL; newActs[0].type = XkbSA_NoAction; @@ -790,11 +781,11 @@ XkbAction *newActs; memcpy(&newActs[nActs],XkbKeyActionsPtr(xkb,i), nCopy*sizeof(XkbAction)); if (nCopy<nKeyActs) - bzero(&newActs[nActs+nCopy],(nKeyActs-nCopy)*sizeof(XkbAction)); + memset(&newActs[nActs+nCopy], 0, (nKeyActs-nCopy)*sizeof(XkbAction)); xkb->server->key_acts[i]= nActs; nActs+= nKeyActs; } - xfree(xkb->server->acts); + free(xkb->server->acts); xkb->server->acts = newActs; xkb->server->num_acts= nActs; return &xkb->server->acts[xkb->server->key_acts[key]]; @@ -817,42 +808,42 @@ XkbClientMapPtr map; XkbKeyTypePtr type; for (i=0,type=map->types;i<map->num_types;i++,type++) { if (type->map!=NULL) { - xfree(type->map); + free(type->map); type->map= NULL; } if (type->preserve!=NULL) { - xfree(type->preserve); + free(type->preserve); type->preserve= NULL; } type->map_count= 0; if (type->level_names!=NULL) { - xfree(type->level_names); + free(type->level_names); type->level_names= NULL; } } } - xfree(map->types); + free(map->types); map->num_types= map->size_types= 0; map->types= NULL; } } if (what&XkbKeySymsMask) { if (map->key_sym_map!=NULL) { - xfree(map->key_sym_map); + free(map->key_sym_map); map->key_sym_map= NULL; } if (map->syms!=NULL) { - xfree(map->syms); + free(map->syms); map->size_syms= map->num_syms= 0; map->syms= NULL; } } if ((what&XkbModifierMapMask)&&(map->modmap!=NULL)) { - xfree(map->modmap); + free(map->modmap); map->modmap= NULL; } if (freeMap) { - xfree(xkb->map); + free(xkb->map); xkb->map= NULL; } return; @@ -869,31 +860,31 @@ XkbServerMapPtr map; what= XkbAllServerInfoMask; map= xkb->server; if ((what&XkbExplicitComponentsMask)&&(map->explicit!=NULL)) { - xfree(map->explicit); + free(map->explicit); map->explicit= NULL; } if (what&XkbKeyActionsMask) { if (map->key_acts!=NULL) { - xfree(map->key_acts); + free(map->key_acts); map->key_acts= NULL; } if (map->acts!=NULL) { - xfree(map->acts); + free(map->acts); map->num_acts= map->size_acts= 0; map->acts= NULL; } } if ((what&XkbKeyBehaviorsMask)&&(map->behaviors!=NULL)) { - xfree(map->behaviors); + free(map->behaviors); map->behaviors= NULL; } if ((what&XkbVirtualModMapMask)&&(map->vmodmap!=NULL)) { - xfree(map->vmodmap); + free(map->vmodmap); map->vmodmap= NULL; } if (freeMap) { - xfree(xkb->server); + free(xkb->server); xkb->server= NULL; } return; diff --git a/xserver/xkb/XKBMisc.c b/xserver/xkb/XKBMisc.c index 2bb4a2452..efe291103 100644 --- a/xserver/xkb/XKBMisc.c +++ b/xserver/xkb/XKBMisc.c @@ -388,7 +388,7 @@ unsigned changed,tmp; nSyms= XkbKeyNumSyms(xkb,key); syms= XkbKeySymsPtr(xkb,key); if (nSyms>IBUF_SIZE) { - interps= xcalloc(nSyms, sizeof(XkbSymInterpretPtr)); + interps= calloc(nSyms, sizeof(XkbSymInterpretPtr)); if (interps==NULL) { interps= ibuf; nSyms= IBUF_SIZE; @@ -422,7 +422,7 @@ unsigned changed,tmp; pActs= XkbResizeKeyActions(xkb,key,nSyms); if (!pActs) { if (nSyms > IBUF_SIZE) - xfree(interps); + free(interps); return FALSE; } new_vmodmask= 0; @@ -507,7 +507,7 @@ unsigned changed,tmp; mc->changed|= changed; } if (interps!=ibuf) - xfree(interps); + free(interps); return TRUE; } @@ -580,7 +580,7 @@ int width,nOldGroups,oldWidth,newTypes[XkbNumKbdGroups]; pSyms= XkbResizeKeySyms(xkb,key,width*nGroups); if (pSyms==NULL) return BadAlloc; - bzero(pSyms,width*nGroups*sizeof(KeySym)); + memset(pSyms, 0, width*nGroups*sizeof(KeySym)); for (i=0;(i<nGroups)&&(i<nOldGroups);i++) { pOldType= XkbKeyKeyType(xkb,key,i); pNewType= &xkb->map->types[newTypes[i]]; @@ -596,7 +596,7 @@ int width,nOldGroups,oldWidth,newTypes[XkbNumKbdGroups]; pActs= XkbResizeKeyActions(xkb,key,width*nGroups); if (pActs==NULL) return BadAlloc; - bzero(pActs,width*nGroups*sizeof(XkbAction)); + memset(pActs, 0, width*nGroups*sizeof(XkbAction)); for (i=0;(i<nGroups)&&(i<nOldGroups);i++) { pOldType= XkbKeyKeyType(xkb,key,i); pNewType= &xkb->map->types[newTypes[i]]; diff --git a/xserver/xkb/ddxDevBtn.c b/xserver/xkb/ddxDevBtn.c deleted file mode 100644 index b8a125514..000000000 --- a/xserver/xkb/ddxDevBtn.c +++ /dev/null @@ -1,69 +0,0 @@ -/************************************************************ -Copyright (c) 1995 by Silicon Graphics Computer Systems, Inc. - -Permission to use, copy, modify, and distribute this -software and its documentation for any purpose and without -fee is hereby granted, provided that the above copyright -notice appear in all copies and that both that copyright -notice and this permission notice appear in supporting -documentation, and that the name of Silicon Graphics not be -used in advertising or publicity pertaining to distribution -of the software without specific prior written permission. -Silicon Graphics makes no representation about the suitability -of this software for any purpose. It is provided "as is" -without any express or implied warranty. - -SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS -SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON -GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL -DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, -DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE -OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH -THE USE OR PERFORMANCE OF THIS SOFTWARE. - -********************************************************/ - -#ifdef HAVE_DIX_CONFIG_H -#include <dix-config.h> -#endif - -#include "inputstr.h" -#include <xkbsrv.h> -#include "mi.h" - -void -XkbDDXFakeDeviceButton(DeviceIntPtr dev,Bool press,int button) -{ - EventListPtr events; - int nevents, i; - DeviceIntPtr ptr; - - /* If dev is a slave device, and the SD is attached, do nothing. If we'd - * post through the attached master pointer we'd get duplicate events. - * - * if dev is a master keyboard, post through the XTEST device - * - * if dev is a floating slave, post through the device itself. - */ - - if (IsMaster(dev)) - ptr = GetXTestDevice(GetMaster(dev, MASTER_POINTER)); - else if (!dev->u.master) - ptr = dev; - else - return; - - events = InitEventList(GetMaximumEventsNum()); - OsBlockSignals(); - nevents = GetPointerEvents(events, ptr, - press ? ButtonPress : ButtonRelease, button, - 0 /* flags */, 0 /* first */, - 0 /* num_val */, NULL); - OsReleaseSignals(); - - for (i = 0; i < nevents; i++) - mieqProcessDeviceEvent(ptr, (InternalEvent*)events[i].event, NULL); - - FreeEventList(events, GetMaximumEventsNum()); -} diff --git a/xserver/xkb/ddxFakeMtn.c b/xserver/xkb/ddxFakeMtn.c deleted file mode 100644 index c50cf57d8..000000000 --- a/xserver/xkb/ddxFakeMtn.c +++ /dev/null @@ -1,67 +0,0 @@ -/************************************************************ -Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc. - -Permission to use, copy, modify, and distribute this -software and its documentation for any purpose and without -fee is hereby granted, provided that the above copyright -notice appear in all copies and that both that copyright -notice and this permission notice appear in supporting -documentation, and that the name of Silicon Graphics not be -used in advertising or publicity pertaining to distribution -of the software without specific prior written permission. -Silicon Graphics makes no representation about the suitability -of this software for any purpose. It is provided "as is" -without any express or implied warranty. - -SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS -SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON -GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL -DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, -DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE -OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH -THE USE OR PERFORMANCE OF THIS SOFTWARE. - -********************************************************/ - -#ifdef HAVE_DIX_CONFIG_H -#include <dix-config.h> -#endif - -#include "inputstr.h" -#include <xkbsrv.h> -#include "mi.h" - -void -XkbDDXFakePointerMotion(DeviceIntPtr dev, unsigned flags,int x,int y) -{ - EventListPtr events; - int nevents, i; - DeviceIntPtr ptr; - int gpe_flags = 0; - int coord[2]; - - if (!dev->u.master) - ptr = dev; - else - ptr = GetXTestDevice(GetMaster(dev, MASTER_POINTER)); - - if (flags & XkbSA_MoveAbsoluteX || flags & XkbSA_MoveAbsoluteY) - gpe_flags = POINTER_ABSOLUTE; - else - gpe_flags = POINTER_RELATIVE; - - events = InitEventList(GetMaximumEventsNum()); - OsBlockSignals(); - coord[0] = x; - coord[1] = y; - nevents = GetPointerEvents(events, ptr, - MotionNotify, 0, - gpe_flags, 0, 2, coord); - OsReleaseSignals(); - - for (i = 0; i < nevents; i++) - mieqProcessDeviceEvent(ptr, (InternalEvent*)events[i].event, NULL); - - FreeEventList(events, GetMaximumEventsNum()); -} diff --git a/xserver/xkb/ddxList.c b/xserver/xkb/ddxList.c index e212ea3b5..39bd7397a 100644 --- a/xserver/xkb/ddxList.c +++ b/xserver/xkb/ddxList.c @@ -97,7 +97,7 @@ char * tmp; if ((list->szPool-list->nPool)<wlen) { if (wlen>1024) list->szPool+= XkbPaddedSize(wlen*2); else list->szPool+= 1024; - list->pool= xrealloc(list->pool, list->szPool * sizeof(char)); + list->pool= realloc(list->pool, list->szPool * sizeof(char)); if (!list->pool) return BadAlloc; } @@ -161,6 +161,7 @@ char tmpname[PATH_MAX]; } if (!in) { haveDir= FALSE; + free(buf); buf = Xprintf( "'%s/xkbcomp' '-R%s/%s' -w %ld -l -vlfhpR '%s'" W32_tmparg, XkbBinDirectory,XkbBaseDirectory,componentDirs[what],(long) @@ -176,6 +177,7 @@ char tmpname[PATH_MAX]; } if (!in) { haveDir= FALSE; + free(buf); buf = Xprintf( "xkbcomp -R%s -w %ld -l -vlfhpR '%s'" W32_tmparg, componentDirs[what],(long) @@ -201,18 +203,15 @@ char tmpname[PATH_MAX]; if (!in) { if (buf != NULL) - xfree (buf); + free(buf); #ifdef WIN32 unlink(tmpname); #endif return BadImplementation; } list->nFound[what]= 0; - if (buf) { - xfree(buf); - buf = NULL; - } - buf = xalloc(PATH_MAX * sizeof(char)); + free(buf); + buf = malloc(PATH_MAX * sizeof(char)); if (!buf) return BadAlloc; while ((status==Success)&&((tmp=fgets(buf,PATH_MAX,in))!=NULL)) { @@ -268,7 +267,7 @@ char tmpname[PATH_MAX]; unlink(tmpname); #endif if (buf != NULL) - xfree (buf); + free(buf); return status; } diff --git a/xserver/xkb/ddxLoad.c b/xserver/xkb/ddxLoad.c index 44ecd8f77..c5218c00d 100644 --- a/xserver/xkb/ddxLoad.c +++ b/xserver/xkb/ddxLoad.c @@ -103,7 +103,7 @@ Win32System(const char *cmdline) STARTUPINFO si; PROCESS_INFORMATION pi; DWORD dwExitCode; - char *cmd = xstrdup(cmdline); + char *cmd = strdup(cmdline); ZeroMemory( &si, sizeof(si) ); si.cb = sizeof(si); @@ -131,7 +131,7 @@ Win32System(const char *cmdline) LocalFree(buffer); } - xfree(cmd); + free(cmd); return -1; } /* Wait until child process exits. */ @@ -142,7 +142,7 @@ Win32System(const char *cmdline) /* Close process and thread handles. */ CloseHandle( pi.hProcess ); CloseHandle( pi.hThread ); - xfree(cmd); + free(cmd); return dwExitCode; } @@ -186,7 +186,7 @@ XkbDDXCompileKeymapByNames( XkbDescPtr xkb, char *buf = NULL, keymap[PATH_MAX], xkm_output_dir[PATH_MAX]; const char *emptystring = ""; - const char *xkbbasedirflag = emptystring; + char *xkbbasedirflag = NULL; const char *xkbbindir = emptystring; const char *xkbbindirsep = emptystring; @@ -230,12 +230,15 @@ XkbDDXCompileKeymapByNames( XkbDescPtr xkb, xkbbindir, xkbbindirsep, ( (xkbDebugFlags < 2) ? 1 : ((xkbDebugFlags > 10) ? 10 : (int)xkbDebugFlags) ), - xkbbasedirflag, xkmfile, + xkbbasedirflag ? xkbbasedirflag : "", xkmfile, PRE_ERROR_MSG, ERROR_PREFIX, POST_ERROR_MSG1, xkm_output_dir, keymap); - if (xkbbasedirflag != emptystring) { - xfree(xkbbasedirflag); + free(xkbbasedirflag); + + if (!buf) { + LogMessage(X_ERROR, "XKB: Could not invoke xkbcomp: not enough memory\n"); + return FALSE; } #ifndef WIN32 @@ -265,7 +268,7 @@ XkbDDXCompileKeymapByNames( XkbDescPtr xkb, nameRtrn[nameRtrnLen-1]= '\0'; } if (buf != NULL) - xfree (buf); + free(buf); return TRUE; } else @@ -285,7 +288,7 @@ XkbDDXCompileKeymapByNames( XkbDescPtr xkb, if (nameRtrn) nameRtrn[0]= '\0'; if (buf != NULL) - xfree (buf); + free(buf); return FALSE; } diff --git a/xserver/xkb/maprules.c b/xserver/xkb/maprules.c index 3bec6d044..ce16e9ce1 100644 --- a/xserver/xkb/maprules.c +++ b/xserver/xkb/maprules.c @@ -78,7 +78,7 @@ static void FreeInputLine(InputLine *line) { if (line->line!=line->buf) - xfree(line->line); + free(line->line); line->line_num= 1; line->num_line= 0; line->sz_line= DFLT_LINE_SIZE; @@ -91,11 +91,11 @@ InputLineAddChar(InputLine *line,int ch) { if (line->num_line>=line->sz_line) { if (line->line==line->buf) { - line->line= xalloc(line->sz_line*2); + line->line= malloc(line->sz_line*2); memcpy(line->line,line->buf,line->sz_line); } else { - line->line= xrealloc((char *)line->line,line->sz_line*2); + line->line= realloc((char *)line->line,line->sz_line*2); } line->sz_line*= 2; } @@ -270,7 +270,7 @@ Bool found; l_ndx_present = v_ndx_present = present= 0; str= &line->line[1]; len = remap->number; - bzero((char *)remap,sizeof(RemapSpec)); + memset((char *)remap, 0, sizeof(RemapSpec)); remap->number = len; while ((tok=_XStrtok(str," ",strtok_buf))!=NULL) { found= FALSE; @@ -412,7 +412,7 @@ Bool append = FALSE; DebugF("Illegal line of data ignored\n"); return FALSE; } - bzero((char *)&tmp,sizeof(FileSpec)); + memset((char *)&tmp, 0, sizeof(FileSpec)); str= line->line; for (nread= 0;(tok=_XStrtok(str," ",strtok_buf))!=NULL;nread++) { str= NULL; @@ -474,7 +474,7 @@ int len; if ((!str1)||(!str2)) return str1; len= strlen(str1)+strlen(str2)+1; - str1= xrealloc(str1,len * sizeof(char)); + str1= realloc(str1,len * sizeof(char)); if (str1) strcat(str1,str2); return str1; @@ -495,7 +495,7 @@ static Bool MakeMultiDefs(XkbRF_MultiDefsPtr mdefs, XkbRF_VarDefsPtr defs) { - bzero((char *)mdefs,sizeof(XkbRF_MultiDefsRec)); + memset((char *)mdefs, 0, sizeof(XkbRF_MultiDefsRec)); mdefs->model = defs->model; mdefs->options = _XkbDupString(defs->options); if (mdefs->options) squeeze_spaces(mdefs->options); @@ -553,9 +553,9 @@ MakeMultiDefs(XkbRF_MultiDefsPtr mdefs, XkbRF_VarDefsPtr defs) static void FreeMultiDefs(XkbRF_MultiDefsPtr defs) { - if (defs->options) xfree(defs->options); - if (defs->layout[1]) xfree(defs->layout[1]); - if (defs->variant[1]) xfree(defs->variant[1]); + free(defs->options); + free(defs->layout[1]); + free(defs->variant[1]); } static void @@ -769,7 +769,7 @@ int len, ndx; } str= index(&str[0],'%'); } - name= xalloc(len+1); + name= malloc(len+1); str= orig; outstr= name; while (*str!='\0') { @@ -819,7 +819,7 @@ int len, ndx; } *outstr++= '\0'; if (orig!=name) - xfree(orig); + free(orig); return name; } @@ -834,7 +834,7 @@ XkbRF_GetComponents( XkbRF_RulesPtr rules, MakeMultiDefs(&mdefs, defs); - bzero((char *)names,sizeof(XkbComponentNamesRec)); + memset((char *)names, 0, sizeof(XkbComponentNamesRec)); XkbRF_ClearPartialMatches(rules); XkbRF_CheckApplyRules(rules, &mdefs, names, XkbRF_Normal); XkbRF_ApplyPartialMatches(rules, names); @@ -864,11 +864,11 @@ XkbRF_AddRule(XkbRF_RulesPtr rules) if (rules->sz_rules<1) { rules->sz_rules= 16; rules->num_rules= 0; - rules->rules= xcalloc(rules->sz_rules, sizeof(XkbRF_RuleRec)); + rules->rules= calloc(rules->sz_rules, sizeof(XkbRF_RuleRec)); } else if (rules->num_rules>=rules->sz_rules) { rules->sz_rules*= 2; - rules->rules= xrealloc(rules->rules, + rules->rules= realloc(rules->rules, rules->sz_rules * sizeof(XkbRF_RuleRec)); } if (!rules->rules) { @@ -876,7 +876,7 @@ XkbRF_AddRule(XkbRF_RulesPtr rules) DebugF("Allocation failure in XkbRF_AddRule\n"); return NULL; } - bzero((char *)&rules->rules[rules->num_rules],sizeof(XkbRF_RuleRec)); + memset((char *)&rules->rules[rules->num_rules], 0, sizeof(XkbRF_RuleRec)); return &rules->rules[rules->num_rules++]; } @@ -886,11 +886,11 @@ XkbRF_AddGroup(XkbRF_RulesPtr rules) if (rules->sz_groups<1) { rules->sz_groups= 16; rules->num_groups= 0; - rules->groups= xcalloc(rules->sz_groups, sizeof(XkbRF_GroupRec)); + rules->groups= calloc(rules->sz_groups, sizeof(XkbRF_GroupRec)); } else if (rules->num_groups >= rules->sz_groups) { rules->sz_groups *= 2; - rules->groups= xrealloc(rules->groups, + rules->groups= realloc(rules->groups, rules->sz_groups * sizeof(XkbRF_GroupRec)); } if (!rules->groups) { @@ -898,7 +898,7 @@ XkbRF_AddGroup(XkbRF_RulesPtr rules) return NULL; } - bzero((char *)&rules->groups[rules->num_groups],sizeof(XkbRF_GroupRec)); + memset((char *)&rules->groups[rules->num_groups], 0, sizeof(XkbRF_GroupRec)); return &rules->groups[rules->num_groups++]; } @@ -912,20 +912,20 @@ XkbRF_GroupRec tgroup,*group; if (!(rules && file)) return FALSE; - bzero((char *)&remap,sizeof(RemapSpec)); - bzero((char *)&tgroup,sizeof(XkbRF_GroupRec)); + memset((char *)&remap, 0, sizeof(RemapSpec)); + memset((char *)&tgroup, 0, sizeof(XkbRF_GroupRec)); InitInputLine(&line); while (GetInputLine(file,&line,TRUE)) { if (CheckLine(&line,&remap,&trule,&tgroup)) { if (tgroup.number) { if ((group= XkbRF_AddGroup(rules))!=NULL) { *group= tgroup; - bzero((char *)&tgroup,sizeof(XkbRF_GroupRec)); + memset((char *)&tgroup, 0, sizeof(XkbRF_GroupRec)); } } else { if ((rule= XkbRF_AddRule(rules))!=NULL) { *rule= trule; - bzero((char *)&trule,sizeof(XkbRF_RuleRec)); + memset((char *)&trule, 0, sizeof(XkbRF_RuleRec)); } } } @@ -972,7 +972,7 @@ Bool ok; XkbRF_RulesPtr XkbRF_Create(void) { - return xcalloc(1, sizeof( XkbRF_RulesRec)); + return calloc(1, sizeof( XkbRF_RulesRec)); } /***====================================================================***/ @@ -988,32 +988,32 @@ XkbRF_GroupPtr group; return; if (rules->rules) { for (i=0,rule=rules->rules;i<rules->num_rules;i++,rule++) { - if (rule->model) xfree(rule->model); - if (rule->layout) xfree(rule->layout); - if (rule->variant) xfree(rule->variant); - if (rule->option) xfree(rule->option); - if (rule->keycodes) xfree(rule->keycodes); - if (rule->symbols) xfree(rule->symbols); - if (rule->types) xfree(rule->types); - if (rule->compat) xfree(rule->compat); - if (rule->geometry) xfree(rule->geometry); - bzero((char *)rule,sizeof(XkbRF_RuleRec)); + free(rule->model); + free(rule->layout); + free(rule->variant); + free(rule->option); + free(rule->keycodes); + free(rule->symbols); + free(rule->types); + free(rule->compat); + free(rule->geometry); + memset((char *)rule, 0, sizeof(XkbRF_RuleRec)); } - xfree(rules->rules); + free(rules->rules); rules->num_rules= rules->sz_rules= 0; rules->rules= NULL; } if (rules->groups) { for (i=0, group=rules->groups;i<rules->num_groups;i++,group++) { - if (group->name) xfree(group->name); - if (group->words) xfree(group->words); + free(group->name); + free(group->words); } - xfree(rules->groups); + free(rules->groups); rules->num_groups= 0; rules->groups= NULL; } if (freeRules) - xfree(rules); + free(rules); return; } diff --git a/xserver/xkb/xkb.c b/xserver/xkb/xkb.c index 29052bf13..4105c1c6b 100644 --- a/xserver/xkb/xkb.c +++ b/xserver/xkb/xkb.c @@ -194,7 +194,7 @@ ProcXkbUseExtension(ClientPtr client) swaps(&rep.serverMinor, n); } WriteToClient(client,SIZEOF(xkbUseExtensionReply), (char *)&rep); - return client->noClientException; + return Success; } /***====================================================================***/ @@ -219,12 +219,13 @@ ProcXkbSelectEvents(ClientPtr client) client->mapNotifyMask|= (stuff->affectMap&stuff->map); } if ((stuff->affectWhich&(~XkbMapNotifyMask))==0) - return client->noClientException; + return Success; masks = XkbFindClientResource((DevicePtr)dev,client); if (!masks){ XID id = FakeClientID(client->index); - AddResource(id,RT_XKBCLIENT,dev); + if (!AddResource(id,RT_XKBCLIENT,dev)) + return BadAlloc; masks= XkbAddClientResource((DevicePtr)dev,client,id); } if (masks) { @@ -343,7 +344,7 @@ ProcXkbSelectEvents(ClientPtr client) ErrorF("[xkb] Extra data (%d bytes) after SelectEvents\n",dataLeft); return BadLength; } - return client->noClientException; + return Success; } return BadAlloc; } @@ -523,7 +524,7 @@ ProcXkbBell(ClientPtr client) DeviceIntPtr other; for (other = inputInfo.devices; other; other = other->next) { - if ((other != dev) && other->key && !IsMaster(other) && (other->u.master == dev)) + if ((other != dev) && other->key && !IsMaster(other) && GetMaster(other, MASTER_KEYBOARD) == dev) { rc = XaceHook(XACE_DEVICE_ACCESS, client, other, DixBellAccess); if (rc == Success) @@ -557,7 +558,7 @@ ProcXkbGetState(ClientPtr client) CHK_KBD_DEVICE(dev, stuff->deviceSpec, client, DixGetAttrAccess); xkb= &dev->key->xkbInfo->state; - bzero(&rep,sizeof(xkbGetStateReply)); + memset(&rep, 0, sizeof(xkbGetStateReply)); rep.type= X_Reply; rep.sequenceNumber= client->sequence; rep.length = 0; @@ -578,7 +579,7 @@ ProcXkbGetState(ClientPtr client) swaps(&rep.ptrBtnState,n); } WriteToClient(client, SIZEOF(xkbGetStateReply), (char *)&rep); - return client->noClientException; + return Success; } /***====================================================================***/ @@ -606,7 +607,7 @@ ProcXkbLatchLockState(ClientPtr client) status = Success; for (tmpd = inputInfo.devices; tmpd; tmpd = tmpd->next) { - if ((tmpd == dev) || (!IsMaster(tmpd) && tmpd->u.master == dev)) { + if ((tmpd == dev) || (!IsMaster(tmpd) && GetMaster(tmpd, MASTER_KEYBOARD) == dev)) { if (!tmpd->key || !tmpd->key->xkbInfo) continue; @@ -646,7 +647,7 @@ ProcXkbLatchLockState(ClientPtr client) } } - return client->noClientException; + return Success; } /***====================================================================***/ @@ -722,7 +723,7 @@ ProcXkbGetControls(ClientPtr client) swaps(&rep.axOptions, n); } WriteToClient(client, SIZEOF(xkbGetControlsReply), (char *)&rep); - return(client->noClientException); + return Success; } int @@ -748,7 +749,7 @@ ProcXkbSetControls(ClientPtr client) for (tmpd = inputInfo.devices; tmpd; tmpd = tmpd->next) { if (!tmpd->key || !tmpd->key->xkbInfo) continue; - if ((tmpd == dev) || (!IsMaster(tmpd) && tmpd->u.master == dev)) { + if ((tmpd == dev) || (!IsMaster(tmpd) && GetMaster(tmpd, MASTER_KEYBOARD) == dev)) { xkbi = tmpd->key->xkbInfo; ctrl = xkbi->desc->ctrls; new = *ctrl; @@ -942,7 +943,7 @@ ProcXkbSetControls(ClientPtr client) } } - return client->noClientException; + return Success; } /***====================================================================***/ @@ -1365,7 +1366,7 @@ unsigned i,len; char *desc,*start; len= (rep->length*4)-(SIZEOF(xkbGetMapReply)-SIZEOF(xGenericReply)); - start= desc= xcalloc(1, len); + start= desc= calloc(1, len); if (!start) return BadAlloc; if ( rep->nTypes>0 ) @@ -1405,8 +1406,8 @@ char *desc,*start; } WriteToClient(client, (i=SIZEOF(xkbGetMapReply)), (char *)rep); WriteToClient(client, len, start); - xfree((char *)start); - return client->noClientException; + free((char *)start); + return Success; } int @@ -1429,7 +1430,7 @@ ProcXkbGetMap(ClientPtr client) CHK_MASK_LEGAL(0x03,stuff->partial,XkbAllMapComponentsMask); xkb= dev->key->xkbInfo->desc; - bzero(&rep,sizeof(xkbGetMapReply)); + memset(&rep, 0, sizeof(xkbGetMapReply)); rep.type= X_Reply; rep.sequenceNumber= client->sequence; rep.length = (SIZEOF(xkbGetMapReply)-SIZEOF(xGenericReply))>>2; @@ -2172,7 +2173,7 @@ unsigned first,last; first= req->firstKeyBehavior; last= req->firstKeyBehavior+req->nKeyBehaviors-1; - bzero(&server->behaviors[first],req->nKeyBehaviors*sizeof(XkbBehavior)); + memset(&server->behaviors[first], 0, req->nKeyBehaviors*sizeof(XkbBehavior)); for (i=0;i<req->totalKeyBehaviors;i++) { if ((server->behaviors[wire->key].type&XkbKB_Permanent)==0) { server->behaviors[wire->key].type= wire->type; @@ -2186,11 +2187,11 @@ unsigned first,last; if (maxRG>(int)xkbi->nRadioGroups) { int sz = maxRG*sizeof(XkbRadioGroupRec); if (xkbi->radioGroups) - xkbi->radioGroups= xrealloc(xkbi->radioGroups,sz); - else xkbi->radioGroups= xcalloc(1, sz); + xkbi->radioGroups= realloc(xkbi->radioGroups,sz); + else xkbi->radioGroups= calloc(1, sz); if (xkbi->radioGroups) { if (xkbi->nRadioGroups) - bzero(&xkbi->radioGroups[xkbi->nRadioGroups], + memset(&xkbi->radioGroups[xkbi->nRadioGroups], 0, (maxRG-xkbi->nRadioGroups)*sizeof(XkbRadioGroupRec)); xkbi->nRadioGroups= maxRG; } @@ -2245,7 +2246,7 @@ CARD8 * start; start= wire; first= req->firstKeyExplicit; last= req->firstKeyExplicit+req->nKeyExplicit-1; - bzero(&xkb->explicit[first],req->nKeyExplicit); + memset(&xkb->explicit[first], 0, req->nKeyExplicit); for (i=0;i<req->totalKeyExplicit;i++,wire+= 2) { xkb->explicit[wire[0]]= wire[1]; } @@ -2279,7 +2280,7 @@ CARD8 * start; start= wire; first= req->firstModMapKey; last= req->firstModMapKey+req->nModMapKeys-1; - bzero(&xkb->modmap[first],req->nModMapKeys); + memset(&xkb->modmap[first], 0, req->nModMapKeys); for (i=0;i<req->totalModMapKeys;i++,wire+= 2) { xkb->modmap[wire[0]]= wire[1]; } @@ -2311,7 +2312,7 @@ XkbServerMapPtr srv = xkbi->desc->server; first= req->firstVModMapKey; last= req->firstVModMapKey+req->nVModMapKeys-1; - bzero(&srv->vmodmap[first],req->nVModMapKeys*sizeof(unsigned short)); + memset(&srv->vmodmap[first], 0, req->nVModMapKeys*sizeof(unsigned short)); for (i=0;i<req->totalVModMapKeys;i++,wire++) { srv->vmodmap[wire->key]= wire->vmods; } @@ -2438,7 +2439,7 @@ _XkbSetMap(ClientPtr client, DeviceIntPtr dev, xkbSetMapReq *req, char *values) xkb = xkbi->desc; XkbSetCauseXkbReq(&cause,X_kbSetMap,client); - bzero(&change, sizeof(change)); + memset(&change, 0, sizeof(change)); sentNKN = FALSE; if ((xkb->min_key_code!=req->minKeyCode)|| (xkb->max_key_code!=req->maxKeyCode)) { @@ -2558,7 +2559,7 @@ ProcXkbSetMap(ClientPtr client) DeviceIntPtr other; for (other = inputInfo.devices; other; other = other->next) { - if ((other != dev) && other->key && !IsMaster(other) && (other->u.master == dev)) + if ((other != dev) && other->key && !IsMaster(other) && GetMaster(other, MASTER_KEYBOARD) == dev) { rc = XaceHook(XACE_DEVICE_ACCESS, client, other, DixManageAccess); if (rc == Success) @@ -2581,7 +2582,7 @@ ProcXkbSetMap(ClientPtr client) DeviceIntPtr other; for (other = inputInfo.devices; other; other = other->next) { - if ((other != dev) && other->key && !IsMaster(other) && (other->u.master == dev)) + if ((other != dev) && other->key && !IsMaster(other) && GetMaster(other, MASTER_KEYBOARD) == dev) { rc = XaceHook(XACE_DEVICE_ACCESS, client, other, DixManageAccess); if (rc == Success) @@ -2594,7 +2595,7 @@ ProcXkbSetMap(ClientPtr client) } } - return client->noClientException; + return Success; } /***====================================================================***/ @@ -2629,7 +2630,7 @@ int size; size= rep->length*4; if (size>0) { - data = xalloc(size); + data = malloc(size); if (data) { register unsigned i,bit; xkbModsWireDesc * grp; @@ -2680,9 +2681,9 @@ int size; WriteToClient(client, SIZEOF(xkbGetCompatMapReply), (char *)rep); if (data) { WriteToClient(client, size, data); - xfree((char *)data); + free((char *)data); } - return client->noClientException; + return Success; } int @@ -2777,7 +2778,7 @@ _XkbSetCompatMap(ClientPtr client, DeviceIntPtr dev, XkbSymInterpretPtr sym; if ((unsigned)(req->firstSI+req->nSI)>compat->num_si) { compat->num_si= req->firstSI+req->nSI; - compat->sym_interpret= xrealloc(compat->sym_interpret, + compat->sym_interpret= realloc(compat->sym_interpret, compat->num_si * sizeof(XkbSymInterpretRec)); if (!compat->sym_interpret) { compat->num_si= 0; @@ -2851,7 +2852,7 @@ _XkbSetCompatMap(ClientPtr client, DeviceIntPtr dev, XkbEventCauseRec cause; XkbSetCauseXkbReq(&cause,X_kbSetCompatMap,client); - bzero(&change,sizeof(XkbChangesRec)); + memset(&change, 0, sizeof(XkbChangesRec)); XkbUpdateActions(dev,xkb->min_key_code,XkbNumKeys(xkb),&change,&check, &cause); if (check) @@ -2887,7 +2888,7 @@ ProcXkbSetCompatMap(ClientPtr client) DeviceIntPtr other; for (other = inputInfo.devices; other; other = other->next) { - if ((other != dev) && other->key && !IsMaster(other) && (other->u.master == dev)) + if ((other != dev) && other->key && !IsMaster(other) && GetMaster(other, MASTER_KEYBOARD) == dev) { rc = XaceHook(XACE_DEVICE_ACCESS, client, other, DixManageAccess); if (rc == Success) @@ -2910,7 +2911,7 @@ ProcXkbSetCompatMap(ClientPtr client) DeviceIntPtr other; for (other = inputInfo.devices; other; other = other->next) { - if ((other != dev) && other->key && !IsMaster(other) && (other->u.master == dev)) + if ((other != dev) && other->key && !IsMaster(other) && GetMaster(other, MASTER_KEYBOARD) == dev) { rc = XaceHook(XACE_DEVICE_ACCESS, client, other, DixManageAccess); if (rc == Success) @@ -2923,7 +2924,7 @@ ProcXkbSetCompatMap(ClientPtr client) } } - return client->noClientException; + return Success; } /***====================================================================***/ @@ -2960,7 +2961,7 @@ ProcXkbGetIndicatorState(ClientPtr client) swapl(&rep.state,i); } WriteToClient(client, SIZEOF(xkbGetIndicatorStateReply), (char *)&rep); - return client->noClientException; + return Success; } /***====================================================================***/ @@ -2995,7 +2996,7 @@ register unsigned bit; length = rep->length*4; if (length>0) { CARD8 *to; - to= map= xalloc(length); + to= map= malloc(length); if (map) { xkbIndicatorMapWireDesc *wire = (xkbIndicatorMapWireDesc *)to; for (i=0,bit=1;i<XkbNumIndicators;i++,bit<<=1) { @@ -3019,6 +3020,7 @@ register unsigned bit; to = (CARD8 *)wire; if ((to-map)!=length) { client->errorValue = _XkbErrCode2(0xff,length); + free(map); return BadLength; } } @@ -3034,9 +3036,9 @@ register unsigned bit; WriteToClient(client, SIZEOF(xkbGetIndicatorMapReply), (char *)rep); if (map) { WriteToClient(client, length, (char *)map); - xfree((char *)map); + free((char *)map); } - return client->noClientException; + return Success; } int @@ -3130,7 +3132,7 @@ ProcXkbSetIndicatorMap(ClientPtr client) CHK_KBD_DEVICE(dev, stuff->deviceSpec, client, DixSetAttrAccess); if (stuff->which==0) - return client->noClientException; + return Success; for (nIndicators=i=0,bit=1;i<XkbNumIndicators;i++,bit<<=1) { if (stuff->which&bit) @@ -3165,7 +3167,7 @@ ProcXkbSetIndicatorMap(ClientPtr client) DeviceIntPtr other; for (other = inputInfo.devices; other; other = other->next) { - if ((other != dev) && other->key && !IsMaster(other) && (other->u.master == dev)) + if ((other != dev) && other->key && !IsMaster(other) && GetMaster(other, MASTER_KEYBOARD) == dev) { rc = XaceHook(XACE_DEVICE_ACCESS, client, other, DixSetAttrAccess); if (rc == Success) @@ -3257,7 +3259,7 @@ ProcXkbGetNamedIndicator(ClientPtr client) } WriteToClient(client,SIZEOF(xkbGetNamedIndicatorReply), (char *)&rep); - return client->noClientException; + return Success; } @@ -3384,8 +3386,8 @@ _XkbSetNamedIndicator(ClientPtr client, DeviceIntPtr dev, statec |= ((sli->effectiveState ^ sli->explicitState) & (1 << led)); } - bzero((char *)&ed,sizeof(xkbExtensionDeviceNotify)); - bzero((char *)&changes,sizeof(XkbChangesRec)); + memset((char *)&ed, 0, sizeof(xkbExtensionDeviceNotify)); + memset((char *)&changes, 0, sizeof(XkbChangesRec)); XkbSetCauseXkbReq(&cause,X_kbSetNamedIndicator,client); if (namec) XkbApplyLedNameChanges(dev,sli,namec,&ed,&changes,&cause); @@ -3434,7 +3436,7 @@ ProcXkbSetNamedIndicator(ClientPtr client) DeviceIntPtr other; for (other = inputInfo.devices; other; other = other->next) { - if ((other != dev) && !IsMaster(other) && (other->u.master == dev) && + if ((other != dev) && !IsMaster(other) && GetMaster(other, MASTER_KEYBOARD) == dev && (other->kbdfeed || other->leds) && (XaceHook(XACE_DEVICE_ACCESS, client, other, DixSetAttrAccess) == Success)) { @@ -3458,7 +3460,7 @@ ProcXkbSetNamedIndicator(ClientPtr client) DeviceIntPtr other; for (other = inputInfo.devices; other; other = other->next) { - if ((other != dev) && !IsMaster(other) && (other->u.master == dev) && + if ((other != dev) && !IsMaster(other) && GetMaster(other, MASTER_KEYBOARD) == dev && (other->kbdfeed || other->leds) && (XaceHook(XACE_DEVICE_ACCESS, client, other, DixSetAttrAccess) == Success)) { @@ -3467,7 +3469,7 @@ ProcXkbSetNamedIndicator(ClientPtr client) } } - return client->noClientException; + return Success; } /***====================================================================***/ @@ -3632,7 +3634,7 @@ register int n; swapl(&rep->indicators,n); } - start = desc = xalloc(length); + start = desc = malloc(length); if ( !start ) return BadAlloc; if (xkb->names) { @@ -3756,8 +3758,8 @@ register int n; } WriteToClient(client, SIZEOF(xkbGetNamesReply), (char *)rep); WriteToClient(client, length, start); - xfree((char *)start); - return client->noClientException; + free((char *)start); + return Success; } int @@ -4038,7 +4040,7 @@ _XkbSetNames(ClientPtr client, DeviceIntPtr dev, xkbSetNamesReq *stuff) return BadAlloc; } - bzero(&nn,sizeof(xkbNamesNotify)); + memset(&nn, 0, sizeof(xkbNamesNotify)); nn.changed= stuff->which; tmp = (CARD32 *)&stuff[1]; if (stuff->which&XkbKeycodesNameMask) @@ -4118,7 +4120,7 @@ _XkbSetNames(ClientPtr client, DeviceIntPtr dev, xkbSetNamesReq *stuff) tmp+= stuff->nKeyAliases*2; } else if (names->key_aliases!=NULL) { - xfree(names->key_aliases); + free(names->key_aliases); names->key_aliases= NULL; names->num_key_aliases= 0; } @@ -4137,7 +4139,7 @@ _XkbSetNames(ClientPtr client, DeviceIntPtr dev, xkbSetNamesReq *stuff) tmp+= stuff->nRadioGroups; } else if (names->radio_groups) { - xfree(names->radio_groups); + free(names->radio_groups); names->radio_groups= NULL; names->num_rg= 0; } @@ -4160,7 +4162,7 @@ _XkbSetNames(ClientPtr client, DeviceIntPtr dev, xkbSetNamesReq *stuff) if (names->indicators[i]!=None) sli->namesPresent|= bit; } - bzero(&edev,sizeof(xkbExtensionDeviceNotify)); + memset(&edev, 0, sizeof(xkbExtensionDeviceNotify)); edev.reason= XkbXI_IndicatorNamesMask; edev.ledClass= KbdFeedbackClass; edev.ledID= dev->kbdfeed->ctrl.id; @@ -4249,7 +4251,7 @@ ProcXkbSetNames(ClientPtr client) DeviceIntPtr other; for (other = inputInfo.devices; other; other = other->next) { - if ((other != dev) && other->key && !IsMaster(other) && (other->u.master == dev)) + if ((other != dev) && other->key && !IsMaster(other) && GetMaster(other, MASTER_KEYBOARD) == dev) { rc = XaceHook(XACE_DEVICE_ACCESS, client, other, DixManageAccess); @@ -4274,7 +4276,7 @@ ProcXkbSetNames(ClientPtr client) DeviceIntPtr other; for (other = inputInfo.devices; other; other = other->next) { - if ((other != dev) && other->key && !IsMaster(other) && (other->u.master == dev)) + if ((other != dev) && other->key && !IsMaster(other) && GetMaster(other, MASTER_KEYBOARD) == dev) { rc = XaceHook(XACE_DEVICE_ACCESS, client, other, DixManageAccess); @@ -4286,7 +4288,7 @@ ProcXkbSetNames(ClientPtr client) /* everything is okay -- update names */ - return client->noClientException; + return Success; } /***====================================================================***/ @@ -4478,7 +4480,7 @@ xkbDoodadWireDesc * doodadWire; for (i=0;i<num_doodads;i++,doodad++) { doodadWire= (xkbDoodadWireDesc *)wire; wire= (char *)&doodadWire[1]; - bzero(doodadWire,SIZEOF(xkbDoodadWireDesc)); + memset(doodadWire, 0, SIZEOF(xkbDoodadWireDesc)); doodadWire->any.name= doodad->any.name; doodadWire->any.type= doodad->any.type; doodadWire->any.priority= doodad->any.priority; @@ -4740,7 +4742,7 @@ XkbSendGeometry( ClientPtr client, if (geom!=NULL) { len= rep->length*4; - start= desc= xalloc(len); + start= desc= malloc(len); if (!start) return BadAlloc; desc= XkbWriteCountedString(desc,geom->label_font,client->swapped); @@ -4784,10 +4786,10 @@ XkbSendGeometry( ClientPtr client, if (len>0) WriteToClient(client, len, start); if (start!=NULL) - xfree((char *)start); + free((char *)start); if (freeGeom) XkbFreeGeometry(geom,XkbGeomAllMask,TRUE); - return client->noClientException; + return Success; } int @@ -4834,7 +4836,7 @@ CARD16 len,*plen; swaps(plen,n); } len= *plen; - str= xalloc(len+1); + str= malloc(len+1); if (str) { memcpy(str,&wire[2],len); str[len]= '\0'; @@ -5182,16 +5184,16 @@ char * wire; return BadAlloc; val= _GetCountedString(&wire,client->swapped); if (!val) { - xfree(name); + free(name); return BadAlloc; } if (XkbAddGeomProperty(geom,name,val)==NULL) { - xfree(name); - xfree(val); + free(name); + free(val); return BadAlloc; } - xfree(name); - xfree(val); + free(name); + free(val); } if (req->nColors<2) { @@ -5218,10 +5220,10 @@ char * wire; if (!name) return BadAlloc; if (!XkbAddGeomColor(geom,name,geom->num_colors)) { - xfree(name); + free(name); return BadAlloc; } - xfree(name); + free(name); } if (req->nColors!=geom->num_colors) { client->errorValue= _XkbErrCode3(0x05,req->nColors,geom->num_colors); @@ -5290,7 +5292,7 @@ _XkbSetGeometry(ClientPtr client, DeviceIntPtr dev, xkbSetGeometryReq *stuff) XkbFreeGeometry(old,XkbGeomAllMask,TRUE); if (new_name) { xkbNamesNotify nn; - bzero(&nn,sizeof(xkbNamesNotify)); + memset(&nn, 0, sizeof(xkbNamesNotify)); nn.changed= XkbGeometryNameMask; XkbSendNamesNotify(dev,&nn); } @@ -5328,7 +5330,7 @@ ProcXkbSetGeometry(ClientPtr client) DeviceIntPtr other; for (other = inputInfo.devices; other; other = other->next) { - if ((other != dev) && other->key && !IsMaster(other) && (other->u.master == dev)) + if ((other != dev) && other->key && !IsMaster(other) && GetMaster(other, MASTER_KEYBOARD) == dev) { rc = XaceHook(XACE_DEVICE_ACCESS, client, other, DixManageAccess); if (rc == Success) @@ -5377,7 +5379,8 @@ ProcXkbPerClientFlags(ClientPtr client) } else if (want && (!interest)) { XID id = FakeClientID(client->index); - AddResource(id,RT_XKBCLIENT,dev); + if (!AddResource(id,RT_XKBCLIENT,dev)) + return BadAlloc; interest= XkbAddClientResource((DevicePtr)dev,client,id); if (!interest) return BadAlloc; @@ -5414,7 +5417,7 @@ ProcXkbPerClientFlags(ClientPtr client) swapl(&rep.autoCtrlValues,n); } WriteToClient(client,SIZEOF(xkbPerClientFlagsReply), (char *)&rep); - return client->noClientException; + return Success; } /***====================================================================***/ @@ -5449,7 +5452,7 @@ unsigned char *wire,*str,*tmp,*legal; wire= *pWire; len= (*(unsigned char *)wire++); if (len>0) { - str= xcalloc(1, len+1); + str= calloc(1, len+1); if (str) { tmp= str; for (i=0;i<len;i++) { @@ -5460,7 +5463,7 @@ unsigned char *wire,*str,*tmp,*legal; if (tmp!=str) *tmp++= '\0'; else { - xfree(str); + free(str); str= NULL; } } @@ -5497,7 +5500,7 @@ ProcXkbListComponents(ClientPtr client) status= Success; str= (unsigned char *)&stuff[1]; - bzero(&list,sizeof(XkbSrvListInfoRec)); + memset(&list, 0, sizeof(XkbSrvListInfoRec)); list.maxRtrn= stuff->maxNames; list.pattern[_XkbListKeycodes]= GetComponentSpec(&str,FALSE,&status); list.pattern[_XkbListTypes]= GetComponentSpec(&str,FALSE,&status); @@ -5510,13 +5513,11 @@ ProcXkbListComponents(ClientPtr client) if ((XkbPaddedSize(len)/4)!=stuff->length) return BadLength; if ((status=XkbDDXList(dev,&list,client))!=Success) { - if (list.pool) { - xfree(list.pool); - list.pool= NULL; - } + free(list.pool); + list.pool = NULL; return status; } - bzero(&rep,sizeof(xkbListComponentsReply)); + memset(&rep, 0, sizeof(xkbListComponentsReply)); rep.type= X_Reply; rep.deviceID = dev->id; rep.sequenceNumber = client->sequence; @@ -5545,10 +5546,10 @@ ProcXkbListComponents(ClientPtr client) WriteToClient(client,SIZEOF(xkbListComponentsReply),(char *)&rep); if (list.nPool && list.pool) { WriteToClient(client,XkbPaddedSize(list.nPool), (char *)list.pool); - xfree(list.pool); + free(list.pool); list.pool= NULL; } - return client->noClientException; + return Success; } /***====================================================================***/ @@ -5622,7 +5623,7 @@ ProcXkbGetKbdByName(ClientPtr client) geom_changed= FALSE; } - bzero(mapFile,PATH_MAX); + memset(mapFile, 0, PATH_MAX); rep.type= X_Reply; rep.deviceID = dev->id; rep.sequenceNumber = client->sequence; @@ -5657,7 +5658,7 @@ ProcXkbGetKbdByName(ClientPtr client) if (stuff->load || ((rep.reported&XkbGBN_SymbolsMask) && (new->compat))) { XkbChangesRec changes; - bzero(&changes,sizeof(changes)); + memset(&changes, 0, sizeof(changes)); XkbUpdateDescActions(new, new->min_key_code,XkbNumKeys(new), &changes); @@ -5842,7 +5843,7 @@ ProcXkbGetKbdByName(ClientPtr client) xkb->ctrls->num_groups= nTG; for (tmpd = inputInfo.devices; tmpd; tmpd = tmpd->next) { - if ((tmpd == dev) || (!IsMaster(tmpd) && tmpd->u.master == dev)) { + if ((tmpd == dev) || (!IsMaster(tmpd) && GetMaster(tmpd, MASTER_KEYBOARD) == dev)) { if (tmpd != dev) XkbCopyDeviceKeymap(tmpd, dev); @@ -5886,12 +5887,17 @@ ProcXkbGetKbdByName(ClientPtr client) XkbFreeKeyboard(new,XkbAllComponentsMask,TRUE); new= NULL; } - if (names.keycodes) { xfree(names.keycodes); names.keycodes= NULL; } - if (names.types) { xfree(names.types); names.types= NULL; } - if (names.compat) { xfree(names.compat); names.compat= NULL; } - if (names.symbols) { xfree(names.symbols); names.symbols= NULL; } - if (names.geometry) { xfree(names.geometry); names.geometry= NULL; } - return client->noClientException; + free(names.keycodes); + names.keycodes = NULL; + free(names.types); + names.types = NULL; + free(names.compat); + names.compat = NULL; + free(names.symbols); + names.symbols = NULL; + free(names.geometry); + names.geometry = NULL; + return Success; } /***====================================================================***/ @@ -6121,7 +6127,7 @@ char * str; wanted&= ~XkbXI_IndicatorsMask; nameLen= XkbSizeCountedString(dev->name); - bzero((char *)&rep,SIZEOF(xkbGetDeviceInfoReply)); + memset((char *)&rep, 0, SIZEOF(xkbGetDeviceInfoReply)); rep.type = X_Reply; rep.deviceID= dev->id; rep.sequenceNumber = client->sequence; @@ -6205,12 +6211,12 @@ char * str; } WriteToClient(client,SIZEOF(xkbGetDeviceInfoReply), (char *)&rep); - str= xalloc(nameLen); + str= malloc(nameLen); if (!str) return BadAlloc; XkbWriteCountedString(str,dev->name,client->swapped); WriteToClient(client,nameLen,str); - xfree(str); + free(str); length-= nameLen; if (rep.nBtnsRtrn>0) { @@ -6231,7 +6237,7 @@ char * str; ErrorF("[xkb] Wrote %d fewer bytes than expected\n",length); return BadLength; } - return client->noClientException; + return Success; } static char * @@ -6329,8 +6335,8 @@ xkbExtensionDeviceNotify ed; XkbChangesRec changes; DeviceIntPtr kbd; - bzero((char *)&ed,sizeof(xkbExtensionDeviceNotify)); - bzero((char *)&changes,sizeof(XkbChangesRec)); + memset((char *)&ed, 0, sizeof(xkbExtensionDeviceNotify)); + memset((char *)&changes, 0, sizeof(XkbChangesRec)); XkbSetCauseXkbReq(&cause,X_kbSetDeviceInfo,client); ledWire= (xkbDeviceLedsWireDesc *)wire; for (i=0;i<num;i++) { @@ -6351,11 +6357,11 @@ DeviceIntPtr kbd; atomWire= (CARD32 *)&ledWire[1]; if (changed&XkbXI_IndicatorNamesMask) { namec= sli->namesPresent|ledWire->namesPresent; - bzero((char *)sli->names,XkbNumIndicators*sizeof(Atom)); + memset((char *)sli->names, 0, XkbNumIndicators*sizeof(Atom)); } if (ledWire->namesPresent) { sli->namesPresent= ledWire->namesPresent; - bzero((char *)sli->names,XkbNumIndicators*sizeof(Atom)); + memset((char *)sli->names, 0, XkbNumIndicators*sizeof(Atom)); for (n=0,bit=1;n<XkbNumIndicators;n++,bit<<=1) { if (ledWire->namesPresent&bit) { sli->names[n]= (Atom)*atomWire; @@ -6369,7 +6375,7 @@ DeviceIntPtr kbd; if (changed&XkbXI_IndicatorMapsMask) { mapc= sli->mapsPresent|ledWire->mapsPresent; sli->mapsPresent= ledWire->mapsPresent; - bzero((char*)sli->maps,XkbNumIndicators*sizeof(XkbIndicatorMapRec)); + memset((char*)sli->maps, 0, XkbNumIndicators*sizeof(XkbIndicatorMapRec)); } if (ledWire->mapsPresent) { for (n=0,bit=1;n<XkbNumIndicators;n++,bit<<=1) { @@ -6448,7 +6454,7 @@ _XkbSetDeviceInfoCheck(ClientPtr client, DeviceIntPtr dev, char *wire; xkbExtensionDeviceNotify ed; - bzero((char *)&ed,SIZEOF(xkbExtensionDeviceNotify)); + memset((char *)&ed, 0, SIZEOF(xkbExtensionDeviceNotify)); ed.deviceID= dev->id; wire= (char *)&stuff[1]; if (stuff->change&XkbXI_ButtonActionsMask) { @@ -6459,7 +6465,7 @@ _XkbSetDeviceInfoCheck(ClientPtr client, DeviceIntPtr dev, nBtns= dev->button->numButtons; acts= dev->button->xkb_acts; if (acts==NULL) { - acts= xcalloc(nBtns, sizeof(XkbAction)); + acts= calloc(nBtns, sizeof(XkbAction)); if (!acts) return BadAlloc; dev->button->xkb_acts= acts; @@ -6516,7 +6522,7 @@ ProcXkbSetDeviceInfo(ClientPtr client) DeviceIntPtr other; for (other = inputInfo.devices; other; other = other->next) { - if (((other != dev) && !IsMaster(other) && (other->u.master == dev)) && + if (((other != dev) && !IsMaster(other) && GetMaster(other, MASTER_KEYBOARD) == dev) && ((stuff->deviceSpec == XkbUseCoreKbd && other->key) || (stuff->deviceSpec == XkbUseCorePtr && other->button))) { @@ -6541,7 +6547,7 @@ ProcXkbSetDeviceInfo(ClientPtr client) DeviceIntPtr other; for (other = inputInfo.devices; other; other = other->next) { - if (((other != dev) && !IsMaster(other) && (other->u.master == dev)) && + if (((other != dev) && !IsMaster(other) && GetMaster(other, MASTER_KEYBOARD) == dev) && ((stuff->deviceSpec == XkbUseCoreKbd && other->key) || (stuff->deviceSpec == XkbUseCorePtr && other->button))) { @@ -6556,7 +6562,7 @@ ProcXkbSetDeviceInfo(ClientPtr client) } } - return client->noClientException; + return Success; } /***====================================================================***/ @@ -6619,7 +6625,7 @@ int rc; swapl(&rep.supportedCtrls, n); } WriteToClient(client,SIZEOF(xkbSetDebuggingFlagsReply), (char *)&rep); - return client->noClientException; + return Success; } /***====================================================================***/ @@ -6707,6 +6713,9 @@ XkbExtensionInit(void) if (!RT_XKBCLIENT) return; + if (!XkbInitPrivates()) + return; + if ((extEntry = AddExtension(XkbName, XkbNumberEvents, XkbNumberErrors, ProcXkbDispatch, SProcXkbDispatch, NULL, StandardMinorOpcode))) { diff --git a/xserver/xkb/xkbAccessX.c b/xserver/xkb/xkbAccessX.c index be1dceea3..10c38ca47 100644 --- a/xserver/xkb/xkbAccessX.c +++ b/xserver/xkb/xkbAccessX.c @@ -394,7 +394,7 @@ XkbSrvLedInfoPtr sli; unsigned timeElapsed = (now-xkbi->lastPtrEventTime); if (timeToWait > timeElapsed) - return (timeToWait - timeElapsed); + return timeToWait - timeElapsed; } old= *ctrls; xkbi->shiftKeyCount= 0; @@ -707,27 +707,24 @@ DeviceEvent *event = &ev->device_event; changed |= XkbPointerButtonMask; } else if (event->type == ET_ButtonRelease) { - if (xkbi) + if (xkbi) { xkbi->lockedPtrButtons&= ~(1 << (event->detail.key & 0x7)); + + if (IsMaster(dev)) + { + DeviceIntPtr source; + int rc; + rc = dixLookupDevice(&source, event->sourceid, serverClient, DixWriteAccess); + if (rc != Success) + ErrorF("[xkb] bad sourceid '%d' on button release event.\n", event->sourceid); + else if (!IsXTestDevice(source, GetMaster(dev, MASTER_POINTER))) + XkbFakeDeviceButton(dev, FALSE, event->detail.key); + } + } + changed |= XkbPointerButtonMask; } - /* Guesswork. mostly. - * xkb actuall goes through some effort to transparently wrap the - * processInputProcs (see XkbSetExtension). But we all love fun, so the - * previous XKB implementation just hardcoded the CPPE call here instead - * of unwrapping like anybody with any sense of decency would do. - * I got no clue what the correct thing to do is, but my guess is that - * it's not hardcoding. I may be wrong. whatever it is, don't come whining - * to me. I just work here. - * - * Anyway. here's the old call, if you don't like the wrapping, revert it. - * - * CoreProcessPointerEvent(xE,mouse,count); - * - * see. it's still steaming. told you. (whot) - */ - UNWRAP_PROCESS_INPUT_PROC(mouse, xkbPrivPtr, backupproc); mouse->public.processInputProc(ev, mouse); COND_WRAP_PROCESS_INPUT_PROC(mouse, xkbPrivPtr, diff --git a/xserver/xkb/xkbActions.c b/xserver/xkb/xkbActions.c index 4c7bce2e4..229af77e6 100644 --- a/xserver/xkb/xkbActions.c +++ b/xserver/xkb/xkbActions.c @@ -40,10 +40,14 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include <xkbsrv.h> #include "xkb.h" #include <ctype.h> +#include "mi.h" +#include "mipointer.h" #define EXTENSION_EVENT_BASE 64 -static int xkbDevicePrivateKeyIndex; -DevPrivateKey xkbDevicePrivateKey = &xkbDevicePrivateKeyIndex; +DevPrivateKeyRec xkbDevicePrivateKeyRec; + +void XkbFakeDeviceButton(DeviceIntPtr dev,Bool press,int button); +static void XkbFakePointerMotion(DeviceIntPtr dev, unsigned flags,int x,int y); void xkbUnwrapProc(DeviceIntPtr device, DeviceHandleProc proc, @@ -60,13 +64,18 @@ xkbUnwrapProc(DeviceIntPtr device, DeviceHandleProc proc, backupproc,xkbUnwrapProc); } +Bool +XkbInitPrivates(void) +{ + return dixRegisterPrivateKey(&xkbDevicePrivateKeyRec, PRIVATE_DEVICE, 0); +} void XkbSetExtension(DeviceIntPtr device, ProcessInputProc proc) { xkbDeviceInfoPtr xkbPrivPtr; - xkbPrivPtr = (xkbDeviceInfoPtr) xcalloc(1, sizeof(xkbDeviceInfoRec)); + xkbPrivPtr = (xkbDeviceInfoPtr) calloc(1, sizeof(xkbDeviceInfoRec)); if (!xkbPrivPtr) return; xkbPrivPtr->unwrapProc = NULL; @@ -479,7 +488,7 @@ int dx,dy; dx= xkbi->mouseKeysDX; dy= xkbi->mouseKeysDY; } - XkbDDXFakePointerMotion(xkbi->device, xkbi->mouseKeysFlags,dx,dy); + XkbFakePointerMotion(xkbi->device, xkbi->mouseKeysFlags,dx,dy); return xkbi->desc->ctrls->mk_interval; } @@ -492,9 +501,6 @@ _XkbFilterPointerMove( XkbSrvInfoPtr xkbi, int x,y; Bool accel; - if (xkbi->device == inputInfo.keyboard) - return 0; - if (filter->keycode==0) { /* initial press */ filter->keycode = keycode; filter->active = 1; @@ -507,7 +513,7 @@ Bool accel; accel= ((pAction->ptr.flags&XkbSA_NoAcceleration)==0); x= XkbPtrActionX(&pAction->ptr); y= XkbPtrActionY(&pAction->ptr); - XkbDDXFakePointerMotion(xkbi->device, pAction->ptr.flags,x,y); + XkbFakePointerMotion(xkbi->device, pAction->ptr.flags,x,y); AccessXCancelRepeatKey(xkbi,keycode); xkbi->mouseKeysAccel= accel&& (xkbi->desc->ctrls->enabled_ctrls&XkbMouseKeysAccelMask); @@ -554,7 +560,7 @@ _XkbFilterPointerBtn( XkbSrvInfoPtr xkbi, ((pAction->btn.flags&XkbSA_LockNoLock)==0)) { xkbi->lockedPtrButtons|= (1<<button); AccessXCancelRepeatKey(xkbi,keycode); - XkbDDXFakeDeviceButton(xkbi->device, 1, button); + XkbFakeDeviceButton(xkbi->device, 1, button); filter->upAction.type= XkbSA_NoAction; } break; @@ -565,12 +571,12 @@ _XkbFilterPointerBtn( XkbSrvInfoPtr xkbi, if (pAction->btn.count>0) { nClicks= pAction->btn.count; for (i=0;i<nClicks;i++) { - XkbDDXFakeDeviceButton(xkbi->device, 1, button); - XkbDDXFakeDeviceButton(xkbi->device, 0, button); + XkbFakeDeviceButton(xkbi->device, 1, button); + XkbFakeDeviceButton(xkbi->device, 0, button); } filter->upAction.type= XkbSA_NoAction; } - else XkbDDXFakeDeviceButton(xkbi->device, 1, button); + else XkbFakeDeviceButton(xkbi->device, 1, button); } break; case XkbSA_SetPtrDflt: @@ -625,8 +631,18 @@ _XkbFilterPointerBtn( XkbSrvInfoPtr xkbi, break; } xkbi->lockedPtrButtons&= ~(1<<button); + + if (IsMaster(xkbi->device)) + { + XkbMergeLockedPtrBtns(xkbi->device); + /* One SD still has lock set, don't post event */ + if ((xkbi->lockedPtrButtons & (1 << button)) != 0) + break; + } + + /* fallthrough */ case XkbSA_PtrBtn: - XkbDDXFakeDeviceButton(xkbi->device, 0, button); + XkbFakeDeviceButton(xkbi->device, 0, button); break; } filter->active = 0; @@ -790,6 +806,7 @@ ProcessInputProc backupproc; /* never actually used uninitialised, but gcc isn't smart enough * to work that out. */ memset(&old, 0, sizeof(old)); + memset(&ev, 0, sizeof(ev)); if ((filter->keycode!=0)&&(filter->keycode!=keycode)) return 1; @@ -964,7 +981,7 @@ int button; if ((pAction->devbtn.flags&XkbSA_LockNoLock)|| BitIsOn(dev->button->down, button)) return 0; - XkbDDXFakeDeviceButton(dev,TRUE,button); + XkbFakeDeviceButton(dev,TRUE,button); filter->upAction.type= XkbSA_NoAction; break; case XkbSA_DeviceBtn: @@ -972,12 +989,12 @@ int button; int nClicks,i; nClicks= pAction->btn.count; for (i=0;i<nClicks;i++) { - XkbDDXFakeDeviceButton(dev,TRUE,button); - XkbDDXFakeDeviceButton(dev,FALSE,button); + XkbFakeDeviceButton(dev,TRUE,button); + XkbFakeDeviceButton(dev,FALSE,button); } filter->upAction.type= XkbSA_NoAction; } - else XkbDDXFakeDeviceButton(dev,TRUE,button); + else XkbFakeDeviceButton(dev,TRUE,button); break; } } @@ -996,10 +1013,10 @@ int button; if ((filter->upAction.devbtn.flags&XkbSA_LockNoUnlock)|| !BitIsOn(dev->button->down, button)) return 0; - XkbDDXFakeDeviceButton(dev,FALSE,button); + XkbFakeDeviceButton(dev,FALSE,button); break; case XkbSA_DeviceBtn: - XkbDDXFakeDeviceButton(dev,FALSE,button); + XkbFakeDeviceButton(dev,FALSE,button); break; } filter->active = 0; @@ -1016,7 +1033,7 @@ register int i; if (xkbi->szFilters==0) { xkbi->szFilters = 4; - xkbi->filters = xcalloc(xkbi->szFilters, sizeof(XkbFilterRec)); + xkbi->filters = calloc(xkbi->szFilters, sizeof(XkbFilterRec)); /* 6/21/93 (ef) -- XXX! deal with allocation failure */ } for (i=0;i<xkbi->szFilters;i++) { @@ -1026,10 +1043,10 @@ register int i; } } xkbi->szFilters*=2; - xkbi->filters= xrealloc(xkbi->filters, + xkbi->filters= realloc(xkbi->filters, xkbi->szFilters * sizeof(XkbFilterRec)); /* 6/21/93 (ef) -- XXX! deal with allocation failure */ - bzero(&xkbi->filters[xkbi->szFilters/2], + memset(&xkbi->filters[xkbi->szFilters/2], 0, (xkbi->szFilters/2)*sizeof(XkbFilterRec)); return &xkbi->filters[xkbi->szFilters/2]; } @@ -1316,3 +1333,109 @@ xkbStateNotify sn; return; } +/* + * The event is injected into the event processing, not the EQ. Thus, + * ensure that we restore the master after the event sequence to the + * original set of classes. Otherwise, the master remains on the XTEST + * classes and drops events that don't fit into the XTEST layout (e.g. + * events with more than 2 valuators). + * + * FIXME: EQ injection in the processing stage is not designed for, so this + * is a rather awkward hack. The event list returned by GetPointerEvents() + * and friends is always prefixed with a DCE if the last _posted_ device was + * different. For normal events, this sequence then resets the master during + * the processing stage. Since we inject the PointerKey events in the + * processing stage though, we need to manually reset to restore the + * previous order, because the events already in the EQ must be sent for the + * right device. + * So we post-fix the event list we get from GPE with a DCE back to the + * previous slave device. + * + * First one on drinking island wins! + */ +static void +InjectPointerKeyEvents(DeviceIntPtr dev, int type, int button, int flags, int num_valuators, int *valuators) +{ + ScreenPtr pScreen; + EventListPtr events; + int nevents, i; + DeviceIntPtr ptr, mpointer, lastSlave = NULL; + Bool saveWait; + + if (IsMaster(dev)) { + mpointer = GetMaster(dev, MASTER_POINTER); + lastSlave = mpointer->u.lastSlave; + ptr = GetXTestDevice(mpointer); + } else if (!dev->u.master) + ptr = dev; + else + return; + + + events = InitEventList(GetMaximumEventsNum() + 1); + OsBlockSignals(); + pScreen = miPointerGetScreen(ptr); + saveWait = miPointerSetWaitForUpdate(pScreen, FALSE); + nevents = GetPointerEvents(events, ptr, type, button, flags, 0, + num_valuators, valuators); + if (IsMaster(dev) && (lastSlave && lastSlave != ptr)) + UpdateFromMaster(&events[nevents], lastSlave, DEVCHANGE_POINTER_EVENT, &nevents); + miPointerSetWaitForUpdate(pScreen, saveWait); + OsReleaseSignals(); + + for (i = 0; i < nevents; i++) + mieqProcessDeviceEvent(ptr, (InternalEvent*)events[i].event, NULL); + + FreeEventList(events, GetMaximumEventsNum()); + +} + +static void +XkbFakePointerMotion(DeviceIntPtr dev, unsigned flags,int x,int y) +{ + int gpe_flags = 0; + int motion[2]; + + /* ignore attached SDs */ + if (!IsMaster(dev) && GetMaster(dev, MASTER_POINTER) != NULL) + return; + + if (flags & XkbSA_MoveAbsoluteX || flags & XkbSA_MoveAbsoluteY) + gpe_flags = POINTER_ABSOLUTE; + else + gpe_flags = POINTER_RELATIVE; + + motion[0] = x; + motion[1] = y; + InjectPointerKeyEvents(dev, MotionNotify, 0, gpe_flags, 2, motion); +} + +void +XkbFakeDeviceButton(DeviceIntPtr dev,Bool press,int button) +{ + DeviceIntPtr ptr; + int down; + + /* If dev is a slave device, and the SD is attached, do nothing. If we'd + * post through the attached master pointer we'd get duplicate events. + * + * if dev is a master keyboard, post through the XTEST device + * + * if dev is a floating slave, post through the device itself. + */ + + if (IsMaster(dev)) { + DeviceIntPtr mpointer = GetMaster(dev, MASTER_POINTER); + ptr = GetXTestDevice(mpointer); + } else if (!dev->u.master) + ptr = dev; + else + return; + + down = button_is_down(ptr, button, BUTTON_PROCESSED); + if (press == down) + return; + + InjectPointerKeyEvents(dev, press ? ButtonPress : ButtonRelease, + button, 0, 0, NULL); +} diff --git a/xserver/xkb/xkbEvents.c b/xserver/xkb/xkbEvents.c index 33741e9c6..8028502b9 100644 --- a/xserver/xkb/xkbEvents.c +++ b/xserver/xkb/xkbEvents.c @@ -102,7 +102,6 @@ XkbSendLegacyMapNotify(DeviceIntPtr kbd, CARD16 xkb_event, CARD16 changed, if (!XIShouldNotify(clients[i], kbd)) continue; - core_mn.u.u.sequenceNumber = clients[i]->sequence; if (keymap_changed) { core_mn.u.mappingNotify.request = MappingKeyboard; @@ -1041,8 +1040,7 @@ XkbInterestPtr interest; return ((interest->resource==id)?interest:NULL); interest = interest->next; } - interest = xalloc(sizeof(XkbInterestRec)); - bzero(interest,sizeof(XkbInterestRec)); + interest = calloc(1, sizeof(XkbInterestRec)); if (interest) { interest->dev = dev; interest->client = client; @@ -1086,7 +1084,7 @@ ClientPtr client = NULL; autoCtrls= interest->autoCtrls; autoValues= interest->autoCtrlValues; client= interest->client; - xfree(interest); + free(interest); found= TRUE; } while ((!found)&&(interest->next)) { @@ -1096,7 +1094,7 @@ ClientPtr client = NULL; autoCtrls= victim->autoCtrls; autoValues= victim->autoCtrlValues; client= victim->client; - xfree(victim); + free(victim); found= TRUE; } interest = interest->next; diff --git a/xserver/xkb/xkbInit.c b/xserver/xkb/xkbInit.c index 4a3219e2a..fbf8f14b8 100644 --- a/xserver/xkb/xkbInit.c +++ b/xserver/xkb/xkbInit.c @@ -43,6 +43,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include "inputstr.h" #include "opaque.h" #include "property.h" +#include "scrnintstr.h" #define XKBSRV_NEED_FILE_FUNCS #include <xkbsrv.h> #include "xkbgeom.h" @@ -140,14 +141,14 @@ XkbFreeRMLVOSet(XkbRMLVOSet *rmlvo, Bool freeRMLVO) if (!rmlvo) return; - xfree(rmlvo->rules); - xfree(rmlvo->model); - xfree(rmlvo->layout); - xfree(rmlvo->variant); - xfree(rmlvo->options); + free(rmlvo->rules); + free(rmlvo->model); + free(rmlvo->layout); + free(rmlvo->variant); + free(rmlvo->options); if (freeRMLVO) - xfree(rmlvo); + free(rmlvo); else memset(rmlvo, 0, sizeof(XkbRMLVOSet)); } @@ -174,7 +175,7 @@ char * pval; ErrorF("[xkb] Atom error: %s not created\n",_XKB_RF_NAMES_PROP_ATOM); return TRUE; } - pval= (char*) xalloc(len); + pval= (char*) malloc(len); if (!pval) { ErrorF("[xkb] Allocation error: %s proprerty not created\n", _XKB_RF_NAMES_PROP_ATOM); @@ -210,29 +211,24 @@ char * pval; ErrorF("[xkb] Internal Error! bad size (%d!=%d) for _XKB_RULES_NAMES\n", out,len); } - dixChangeWindowProperty(serverClient, WindowTable[0], name, XA_STRING, 8, + dixChangeWindowProperty(serverClient, screenInfo.screens[0]->root, name, XA_STRING, 8, PropModeReplace, len, pval, TRUE); - xfree(pval); + free(pval); return TRUE; } static void XkbSetRulesUsed(XkbRMLVOSet *rmlvo) { - if (XkbRulesUsed) - xfree(XkbRulesUsed); + free(XkbRulesUsed); XkbRulesUsed= (rmlvo->rules?_XkbDupString(rmlvo->rules):NULL); - if (XkbModelUsed) - xfree(XkbModelUsed); + free(XkbModelUsed); XkbModelUsed= (rmlvo->model?_XkbDupString(rmlvo->model):NULL); - if (XkbLayoutUsed) - xfree(XkbLayoutUsed); + free(XkbLayoutUsed); XkbLayoutUsed= (rmlvo->layout?_XkbDupString(rmlvo->layout):NULL); - if (XkbVariantUsed) - xfree(XkbVariantUsed); + free(XkbVariantUsed); XkbVariantUsed= (rmlvo->variant?_XkbDupString(rmlvo->variant):NULL); - if (XkbOptionsUsed) - xfree(XkbOptionsUsed); + free(XkbOptionsUsed); XkbOptionsUsed= (rmlvo->options?_XkbDupString(rmlvo->options):NULL); if (XkbWantRulesProp) QueueWorkProc(XkbWriteRulesProp,NULL,NULL); @@ -243,28 +239,23 @@ void XkbSetRulesDflts(XkbRMLVOSet *rmlvo) { if (rmlvo->rules) { - if (XkbRulesDflt) - xfree(XkbRulesDflt); + free(XkbRulesDflt); XkbRulesDflt= _XkbDupString(rmlvo->rules); } if (rmlvo->model) { - if (XkbModelDflt) - xfree(XkbModelDflt); + free(XkbModelDflt); XkbModelDflt= _XkbDupString(rmlvo->model); } if (rmlvo->layout) { - if (XkbLayoutDflt) - xfree(XkbLayoutDflt); + free(XkbLayoutDflt); XkbLayoutDflt= _XkbDupString(rmlvo->layout); } if (rmlvo->variant) { - if (XkbVariantDflt) - xfree(XkbVariantDflt); + free(XkbVariantDflt); XkbVariantDflt= _XkbDupString(rmlvo->variant); } if (rmlvo->options) { - if (XkbOptionsDflt) - xfree(XkbOptionsDflt); + free(XkbOptionsDflt); XkbOptionsDflt= _XkbDupString(rmlvo->options); } return; @@ -273,15 +264,15 @@ XkbSetRulesDflts(XkbRMLVOSet *rmlvo) void XkbDeleteRulesDflts(void) { - xfree(XkbRulesDflt); + free(XkbRulesDflt); XkbRulesDflt = NULL; - xfree(XkbModelDflt); + free(XkbModelDflt); XkbModelDflt = NULL; - xfree(XkbLayoutDflt); + free(XkbLayoutDflt); XkbLayoutDflt = NULL; - xfree(XkbVariantDflt); + free(XkbVariantDflt); XkbVariantDflt = NULL; - xfree(XkbOptionsDflt); + free(XkbOptionsDflt); XkbOptionsDflt = NULL; XkbFreeKeyboard(xkb_cached_map, XkbAllComponentsMask, TRUE); @@ -515,20 +506,20 @@ InitKeyboardDeviceStruct(DeviceIntPtr dev, XkbRMLVOSet *rmlvo, memset(&changes, 0, sizeof(changes)); XkbSetCauseUnknown(&cause); - dev->key = xcalloc(1, sizeof(*dev->key)); + dev->key = calloc(1, sizeof(*dev->key)); if (!dev->key) { ErrorF("XKB: Failed to allocate key class\n"); return FALSE; } dev->key->sourceid = dev->id; - dev->kbdfeed = xcalloc(1, sizeof(*dev->kbdfeed)); + dev->kbdfeed = calloc(1, sizeof(*dev->kbdfeed)); if (!dev->kbdfeed) { ErrorF("XKB: Failed to allocate key feedback class\n"); goto unwind_key; } - xkbi = xcalloc(1, sizeof(*xkbi)); + xkbi = calloc(1, sizeof(*xkbi)); if (!xkbi) { ErrorF("XKB: Failed to allocate XKB info\n"); goto unwind_kbdfeed; @@ -620,13 +611,13 @@ InitKeyboardDeviceStruct(DeviceIntPtr dev, XkbRMLVOSet *rmlvo, unwind_desc: XkbFreeKeyboard(xkb, 0, TRUE); unwind_info: - xfree(xkbi); + free(xkbi); dev->key->xkbInfo = NULL; unwind_kbdfeed: - xfree(dev->kbdfeed); + free(dev->kbdfeed); dev->kbdfeed = NULL; unwind_key: - xfree(dev->key); + free(dev->key); dev->key = NULL; return FALSE; } @@ -644,10 +635,8 @@ unwind_key: void XkbFreeInfo(XkbSrvInfoPtr xkbi) { - if (xkbi->radioGroups) { - xfree(xkbi->radioGroups); - xkbi->radioGroups= NULL; - } + free(xkbi->radioGroups); + xkbi->radioGroups = NULL; if (xkbi->mouseKeyTimer) { TimerFree(xkbi->mouseKeyTimer); xkbi->mouseKeyTimer= NULL; @@ -677,7 +666,7 @@ XkbFreeInfo(XkbSrvInfoPtr xkbi) XkbFreeKeyboard(xkbi->desc,XkbAllComponentsMask,TRUE); xkbi->desc= NULL; } - xfree(xkbi); + free(xkbi); return; } diff --git a/xserver/xkb/xkbLEDs.c b/xserver/xkb/xkbLEDs.c index 8c28513ec..f617537cf 100644 --- a/xserver/xkb/xkbLEDs.c +++ b/xserver/xkb/xkbLEDs.c @@ -166,7 +166,7 @@ XkbStatePtr state; } } } - return (stateChange || ctrlChange); + return stateChange || ctrlChange; } /* @@ -263,7 +263,7 @@ unsigned oldState; if (ed==NULL) { ed= &my_ed; - bzero((char *)ed,sizeof(xkbExtensionDeviceNotify)); + memset((char *)ed, 0, sizeof(xkbExtensionDeviceNotify)); } else if ((ed->reason&XkbXI_IndicatorsMask)&& ((ed->ledClass!=sli->class)||(ed->ledID!=sli->id))) { @@ -273,7 +273,7 @@ unsigned oldState; if ((kbd==dev)&&(sli->flags&XkbSLI_IsDefault)) { if (changes==NULL) { changes= &my_changes; - bzero((char *)changes,sizeof(XkbChangesRec)); + memset((char *)changes, 0, sizeof(XkbChangesRec)); } changes->indicators.state_changes|= affected; } @@ -362,8 +362,8 @@ XkbChangesRec changes; xkbExtensionDeviceNotify ed; unsigned side_affected; - bzero((char *)&changes,sizeof(XkbChangesRec)); - bzero((char *)&ed,sizeof(xkbExtensionDeviceNotify)); + memset((char *)&changes, 0, sizeof(XkbChangesRec)); + memset((char *)&ed, 0, sizeof(xkbExtensionDeviceNotify)); sli= XkbFindSrvLedInfo(dev,XkbDfltXIClass,XkbDfltXIId,0); sli->explicitState&= ~affect; sli->explicitState|= (affect&values); @@ -524,7 +524,7 @@ Bool checkNames; sli= NULL; checkAccel= checkNames= FALSE; if ((kf!=NULL)&&(kf->xkb_sli==NULL)) { - kf->xkb_sli= sli= xcalloc(1, sizeof(XkbSrvLedInfoRec)); + kf->xkb_sli= sli= calloc(1, sizeof(XkbSrvLedInfoRec)); if (sli==NULL) return NULL; /* ALLOCATION ERROR */ if (dev->key && dev->key->xkbInfo) @@ -567,7 +567,7 @@ Bool checkNames; } } else if ((lf!=NULL)&&(lf->xkb_sli==NULL)) { - lf->xkb_sli= sli= xcalloc(1, sizeof(XkbSrvLedInfoRec)); + lf->xkb_sli= sli= calloc(1, sizeof(XkbSrvLedInfoRec)); if (sli==NULL) return NULL; /* ALLOCATION ERROR */ if (dev->key && dev->key->xkbInfo) @@ -585,9 +585,9 @@ Bool checkNames; sli->names= NULL; } if ((sli->names==NULL)&&(needed_parts&XkbXI_IndicatorNamesMask)) - sli->names= xcalloc(XkbNumIndicators, sizeof(Atom)); + sli->names= calloc(XkbNumIndicators, sizeof(Atom)); if ((sli->maps==NULL)&&(needed_parts&XkbXI_IndicatorMapsMask)) - sli->maps= xcalloc(XkbNumIndicators, sizeof(XkbIndicatorMapRec)); + sli->maps= calloc(XkbNumIndicators, sizeof(XkbIndicatorMapRec)); if (checkNames) { register unsigned i,bit; sli->namesPresent= 0; @@ -605,12 +605,12 @@ void XkbFreeSrvLedInfo(XkbSrvLedInfoPtr sli) { if ((sli->flags&XkbSLI_IsDefault)==0) { - if (sli->maps) xfree(sli->maps); - if (sli->names) xfree(sli->names); + free(sli->maps); + free(sli->names); } sli->maps= NULL; sli->names= NULL; - xfree(sli); + free(sli); return; } @@ -633,7 +633,7 @@ XkbCopySrvLedInfo( DeviceIntPtr from, if (!src) goto finish; - sli_new = xcalloc(1, sizeof( XkbSrvLedInfoRec)); + sli_new = calloc(1, sizeof( XkbSrvLedInfoRec)); if (!sli_new) goto finish; @@ -644,8 +644,8 @@ XkbCopySrvLedInfo( DeviceIntPtr from, sli_new->fb.lf = lf; if (!(sli_new->flags & XkbSLI_IsDefault)) { - sli_new->names= xcalloc(XkbNumIndicators, sizeof(Atom)); - sli_new->maps= xcalloc(XkbNumIndicators, sizeof(XkbIndicatorMapRec)); + sli_new->names= calloc(XkbNumIndicators, sizeof(Atom)); + sli_new->maps= calloc(XkbNumIndicators, sizeof(XkbIndicatorMapRec)); } /* else sli_new->names/maps is pointing to dev->key->xkbInfo->desc->names->indicators; dev->key->xkbInfo->desc->names->indicators; */ @@ -715,9 +715,9 @@ XkbSrvLedInfoPtr sli; } } if ((sli->names==NULL)&&(needed_parts&XkbXI_IndicatorNamesMask)) - sli->names= xcalloc(XkbNumIndicators, sizeof(Atom)); + sli->names= calloc(XkbNumIndicators, sizeof(Atom)); if ((sli->maps==NULL)&&(needed_parts&XkbXI_IndicatorMapsMask)) - sli->maps= xcalloc(XkbNumIndicators, sizeof(XkbIndicatorMapRec)); + sli->maps= calloc(XkbNumIndicators, sizeof(XkbIndicatorMapRec)); return sli; } @@ -735,7 +735,7 @@ XkbFlushLedEvents( DeviceIntPtr dev, if (changes->indicators.state_changes) XkbDDXUpdateDeviceIndicators(dev,sli,sli->effectiveState); XkbSendNotification(kbd,changes,cause); - bzero((char *)changes,sizeof(XkbChangesRec)); + memset((char *)changes, 0, sizeof(XkbChangesRec)); if (XkbAX_NeedFeedback(kbd->key->xkbInfo->desc->ctrls, XkbAX_IndicatorFBMask)) { if (sli->effectiveState) @@ -751,7 +751,7 @@ XkbFlushLedEvents( DeviceIntPtr dev, XkbDDXUpdateDeviceIndicators(dev,sli,sli->effectiveState); XkbSendExtensionDeviceNotify(dev,cause->client,ed); } - bzero((char *)ed,sizeof(XkbExtensionDeviceNotify)); + memset((char *)ed, 0, sizeof(XkbExtensionDeviceNotify)); } return; } @@ -778,7 +778,7 @@ xkbExtensionDeviceNotify my_ed; if (ed==NULL) { ed= &my_ed; - bzero((char *)ed,sizeof(xkbExtensionDeviceNotify)); + memset((char *)ed, 0, sizeof(xkbExtensionDeviceNotify)); } else if ((ed->reason&XkbXI_IndicatorsMask)&& ((ed->ledClass!=sli->class)||(ed->ledID!=sli->id))) { @@ -788,7 +788,7 @@ xkbExtensionDeviceNotify my_ed; if ((kbd==dev)&&(sli->flags&XkbSLI_IsDefault)) { if (changes==NULL) { changes= &my_changes; - bzero((char *)changes,sizeof(XkbChangesRec)); + memset((char *)changes, 0, sizeof(XkbChangesRec)); } changes->names.changed|= XkbIndicatorNamesMask; changes->names.changed_indicators|= changed_names; @@ -855,7 +855,7 @@ xkbExtensionDeviceNotify my_ed; if (ed==NULL) { ed= &my_ed; - bzero((char *)ed,sizeof(xkbExtensionDeviceNotify)); + memset((char *)ed, 0, sizeof(xkbExtensionDeviceNotify)); } else if ((ed->reason&XkbXI_IndicatorsMask)&& ((ed->ledClass!=sli->class)||(ed->ledID!=sli->id))) { @@ -865,7 +865,7 @@ xkbExtensionDeviceNotify my_ed; if ((kbd==dev)&&(sli->flags&XkbSLI_IsDefault)) { if (changes==NULL) { changes= &my_changes; - bzero((char *)changes,sizeof(XkbChangesRec)); + memset((char *)changes, 0, sizeof(XkbChangesRec)); } changes->indicators.map_changes|= changed_maps; } @@ -917,7 +917,7 @@ Bool kb_changed; if (changes==NULL) { changes= &my_changes; - bzero((char *)changes,sizeof(XkbChangesRec)); + memset((char *)changes, 0, sizeof(XkbChangesRec)); } kb_changed= FALSE; @@ -943,7 +943,7 @@ Bool kb_changed; if (ed==NULL) { ed= &my_ed; - bzero((char *)ed,sizeof(xkbExtensionDeviceNotify)); + memset((char *)ed, 0, sizeof(xkbExtensionDeviceNotify)); } else if (affected&&(ed->reason&XkbXI_IndicatorsMask)&& ((ed->ledClass!=sli->class)||(ed->ledID!=sli->id))) { diff --git a/xserver/xkb/xkbUtils.c b/xserver/xkb/xkbUtils.c index b1e0e552c..14dc784b8 100644 --- a/xserver/xkb/xkbUtils.c +++ b/xserver/xkb/xkbUtils.c @@ -282,7 +282,7 @@ register unsigned key; register unsigned bit,i; unsigned present; - bzero(newVMods,XkbNumVirtualMods); + memset(newVMods, 0, XkbNumVirtualMods); present= 0; for (key=xkb->min_key_code;key<=xkb->max_key_code;key++) { if (xkb->server->vmodmap[key]==0) @@ -410,7 +410,7 @@ int maxNumberOfGroups; if (maxSymsPerKey <= 0) return NULL; - syms = xcalloc(1, sizeof(*syms)); + syms = calloc(1, sizeof(*syms)); if (!syms) return NULL; @@ -427,9 +427,9 @@ int maxNumberOfGroups; syms->maxKeyCode = xkb->max_key_code; tmp = syms->mapWidth * (xkb->max_key_code - xkb->min_key_code + 1); - syms->map = xcalloc(tmp, sizeof(*syms->map)); + syms->map = calloc(tmp, sizeof(*syms->map)); if (!syms->map) { - xfree(syms); + free(syms); return NULL; } @@ -588,7 +588,7 @@ XkbSrvInfoPtr xkbi = dev->key->xkbInfo; xkbMapNotify mn; xkbi->desc->server->explicit[key]|= XkbExplicitAutoRepeatMask; - bzero(&mn,sizeof(mn)); + memset(&mn, 0, sizeof(mn)); mn.changed= XkbExplicitComponentsMask; mn.firstKeyExplicit= key; mn.nKeyExplicit= 1; @@ -911,7 +911,7 @@ _XkbCopyClientMap(XkbDescPtr src, XkbDescPtr dst) /* client map */ if (src->map) { if (!dst->map) { - tmp = xcalloc(1, sizeof(XkbClientMapRec)); + tmp = calloc(1, sizeof(XkbClientMapRec)); if (!tmp) return FALSE; dst->map = tmp; @@ -919,11 +919,8 @@ _XkbCopyClientMap(XkbDescPtr src, XkbDescPtr dst) if (src->map->syms) { if (src->map->size_syms != dst->map->size_syms) { - if (dst->map->syms) - tmp = xrealloc(dst->map->syms, - src->map->size_syms * sizeof(KeySym)); - else - tmp = xalloc(src->map->size_syms * sizeof(KeySym)); + tmp = realloc(dst->map->syms, + src->map->size_syms * sizeof(KeySym)); if (!tmp) return FALSE; dst->map->syms = tmp; @@ -933,23 +930,16 @@ _XkbCopyClientMap(XkbDescPtr src, XkbDescPtr dst) src->map->size_syms * sizeof(KeySym)); } else { - if (dst->map->syms) { - xfree(dst->map->syms); - dst->map->syms = NULL; - } + free(dst->map->syms); + dst->map->syms = NULL; } dst->map->num_syms = src->map->num_syms; dst->map->size_syms = src->map->size_syms; if (src->map->key_sym_map) { if (src->max_key_code != dst->max_key_code) { - if (dst->map->key_sym_map) - tmp = xrealloc(dst->map->key_sym_map, - (src->max_key_code + 1) * - sizeof(XkbSymMapRec)); - else - tmp = xalloc((src->max_key_code + 1) * - sizeof(XkbSymMapRec)); + tmp = realloc(dst->map->key_sym_map, + (src->max_key_code + 1) * sizeof(XkbSymMapRec)); if (!tmp) return FALSE; dst->map->key_sym_map = tmp; @@ -958,27 +948,25 @@ _XkbCopyClientMap(XkbDescPtr src, XkbDescPtr dst) (src->max_key_code + 1) * sizeof(XkbSymMapRec)); } else { - if (dst->map->key_sym_map) { - xfree(dst->map->key_sym_map); - dst->map->key_sym_map = NULL; - } + free(dst->map->key_sym_map); + dst->map->key_sym_map = NULL; } if (src->map->types && src->map->num_types) { if (src->map->num_types > dst->map->size_types || !dst->map->types || !dst->map->size_types) { if (dst->map->types && dst->map->size_types) { - tmp = xrealloc(dst->map->types, + tmp = realloc(dst->map->types, src->map->num_types * sizeof(XkbKeyTypeRec)); if (!tmp) return FALSE; dst->map->types = tmp; - bzero(dst->map->types + dst->map->num_types, + memset(dst->map->types + dst->map->num_types, 0, (src->map->num_types - dst->map->num_types) * sizeof(XkbKeyTypeRec)); } else { - tmp = xcalloc(src->map->num_types, sizeof(XkbKeyTypeRec)); + tmp = calloc(src->map->num_types, sizeof(XkbKeyTypeRec)); if (!tmp) return FALSE; dst->map->types = tmp; @@ -988,15 +976,12 @@ _XkbCopyClientMap(XkbDescPtr src, XkbDescPtr dst) dst->map->types) { for (i = src->map->num_types, dtype = (dst->map->types + i); i < dst->map->num_types; i++, dtype++) { - if (dtype->level_names) - xfree(dtype->level_names); + free(dtype->level_names); dtype->level_names = NULL; dtype->num_levels = 0; if (dtype->map_count) { - if (dtype->map) - xfree(dtype->map); - if (dtype->preserve) - xfree(dtype->preserve); + free(dtype->map); + free(dtype->preserve); } } } @@ -1008,7 +993,7 @@ _XkbCopyClientMap(XkbDescPtr src, XkbDescPtr dst) if (stype->num_levels != dtype->num_levels && dtype->num_levels && dtype->level_names && i < dst->map->num_types) { - tmp = xrealloc(dtype->level_names, + tmp = realloc(dtype->level_names, stype->num_levels * sizeof(Atom)); if (!tmp) continue; @@ -1016,7 +1001,7 @@ _XkbCopyClientMap(XkbDescPtr src, XkbDescPtr dst) } else if (!dtype->num_levels || !dtype->level_names || i >= dst->map->num_types) { - tmp = xalloc(stype->num_levels * sizeof(Atom)); + tmp = malloc(stype->num_levels * sizeof(Atom)); if (!tmp) continue; dtype->level_names = tmp; @@ -1028,7 +1013,7 @@ _XkbCopyClientMap(XkbDescPtr src, XkbDescPtr dst) else { if (dtype->num_levels && dtype->level_names && i < dst->map->num_types) - xfree(dtype->level_names); + free(dtype->level_names); dtype->num_levels = 0; dtype->level_names = NULL; } @@ -1041,7 +1026,7 @@ _XkbCopyClientMap(XkbDescPtr src, XkbDescPtr dst) if (stype->map_count != dtype->map_count && dtype->map_count && dtype->map && i < dst->map->num_types) { - tmp = xrealloc(dtype->map, + tmp = realloc(dtype->map, stype->map_count * sizeof(XkbKTMapEntryRec)); if (!tmp) @@ -1050,7 +1035,7 @@ _XkbCopyClientMap(XkbDescPtr src, XkbDescPtr dst) } else if (!dtype->map_count || !dtype->map || i >= dst->map->num_types) { - tmp = xalloc(stype->map_count * + tmp = malloc(stype->map_count * sizeof(XkbKTMapEntryRec)); if (!tmp) return FALSE; @@ -1062,7 +1047,7 @@ _XkbCopyClientMap(XkbDescPtr src, XkbDescPtr dst) } else { if (dtype->map && i < dst->map->num_types) - xfree(dtype->map); + free(dtype->map); dtype->map = NULL; } @@ -1070,7 +1055,7 @@ _XkbCopyClientMap(XkbDescPtr src, XkbDescPtr dst) if (stype->map_count != dtype->map_count && dtype->map_count && dtype->preserve && i < dst->map->num_types) { - tmp = xrealloc(dtype->preserve, + tmp = realloc(dtype->preserve, stype->map_count * sizeof(XkbModsRec)); if (!tmp) @@ -1079,7 +1064,7 @@ _XkbCopyClientMap(XkbDescPtr src, XkbDescPtr dst) } else if (!dtype->preserve || !dtype->map_count || i >= dst->map->num_types) { - tmp = xalloc(stype->map_count * + tmp = malloc(stype->map_count * sizeof(XkbModsRec)); if (!tmp) return FALSE; @@ -1091,7 +1076,7 @@ _XkbCopyClientMap(XkbDescPtr src, XkbDescPtr dst) } else { if (dtype->preserve && i < dst->map->num_types) - xfree(dtype->preserve); + free(dtype->preserve); dtype->preserve = NULL; } @@ -1099,10 +1084,8 @@ _XkbCopyClientMap(XkbDescPtr src, XkbDescPtr dst) } else { if (dtype->map_count && i < dst->map->num_types) { - if (dtype->map) - xfree(dtype->map); - if (dtype->preserve) - xfree(dtype->preserve); + free(dtype->map); + free(dtype->preserve); } dtype->map_count = 0; dtype->map = NULL; @@ -1117,26 +1100,22 @@ _XkbCopyClientMap(XkbDescPtr src, XkbDescPtr dst) if (dst->map->types) { for (i = 0, dtype = dst->map->types; i < dst->map->num_types; i++, dtype++) { - if (dtype->level_names) - xfree(dtype->level_names); + free(dtype->level_names); if (dtype->map && dtype->map_count) - xfree(dtype->map); + free(dtype->map); if (dtype->preserve && dtype->map_count) - xfree(dtype->preserve); + free(dtype->preserve); } - xfree(dst->map->types); - dst->map->types = NULL; } + free(dst->map->types); + dst->map->types = NULL; dst->map->num_types = 0; dst->map->size_types = 0; } if (src->map->modmap) { if (src->max_key_code != dst->max_key_code) { - if (dst->map->modmap) - tmp = xrealloc(dst->map->modmap, src->max_key_code + 1); - else - tmp = xalloc(src->max_key_code + 1); + tmp = realloc(dst->map->modmap, src->max_key_code + 1); if (!tmp) return FALSE; dst->map->modmap = tmp; @@ -1144,10 +1123,8 @@ _XkbCopyClientMap(XkbDescPtr src, XkbDescPtr dst) memcpy(dst->map->modmap, src->map->modmap, src->max_key_code + 1); } else { - if (dst->map->modmap) { - xfree(dst->map->modmap); - dst->map->modmap = NULL; - } + free(dst->map->modmap); + dst->map->modmap = NULL; } } else { @@ -1166,7 +1143,7 @@ _XkbCopyServerMap(XkbDescPtr src, XkbDescPtr dst) /* server map */ if (src->server) { if (!dst->server) { - tmp = xcalloc(1, sizeof(XkbServerMapRec)); + tmp = calloc(1, sizeof(XkbServerMapRec)); if (!tmp) return FALSE; dst->server = tmp; @@ -1174,10 +1151,7 @@ _XkbCopyServerMap(XkbDescPtr src, XkbDescPtr dst) if (src->server->explicit) { if (src->max_key_code != dst->max_key_code) { - if (dst->server->explicit) - tmp = xrealloc(dst->server->explicit, src->max_key_code + 1); - else - tmp = xalloc(src->max_key_code + 1); + tmp = realloc(dst->server->explicit, src->max_key_code + 1); if (!tmp) return FALSE; dst->server->explicit = tmp; @@ -1186,19 +1160,14 @@ _XkbCopyServerMap(XkbDescPtr src, XkbDescPtr dst) src->max_key_code + 1); } else { - if (dst->server->explicit) { - xfree(dst->server->explicit); - dst->server->explicit = NULL; - } + free(dst->server->explicit); + dst->server->explicit = NULL; } if (src->server->acts) { if (src->server->size_acts != dst->server->size_acts) { - if (dst->server->acts) - tmp = xrealloc(dst->server->acts, - src->server->size_acts * sizeof(XkbAction)); - else - tmp = xalloc(src->server->size_acts * sizeof(XkbAction)); + tmp = realloc(dst->server->acts, + src->server->size_acts * sizeof(XkbAction)); if (!tmp) return FALSE; dst->server->acts = tmp; @@ -1207,23 +1176,16 @@ _XkbCopyServerMap(XkbDescPtr src, XkbDescPtr dst) src->server->size_acts * sizeof(XkbAction)); } else { - if (dst->server->acts) { - xfree(dst->server->acts); - dst->server->acts = NULL; - } + free(dst->server->acts); + dst->server->acts = NULL; } dst->server->size_acts = src->server->size_acts; dst->server->num_acts = src->server->num_acts; if (src->server->key_acts) { if (src->max_key_code != dst->max_key_code) { - if (dst->server->key_acts) - tmp = xrealloc(dst->server->key_acts, - (src->max_key_code + 1) * - sizeof(unsigned short)); - else - tmp = xalloc((src->max_key_code + 1) * - sizeof(unsigned short)); + tmp = realloc(dst->server->key_acts, + (src->max_key_code + 1) * sizeof(unsigned short)); if (!tmp) return FALSE; dst->server->key_acts = tmp; @@ -1232,21 +1194,14 @@ _XkbCopyServerMap(XkbDescPtr src, XkbDescPtr dst) (src->max_key_code + 1) * sizeof(unsigned short)); } else { - if (dst->server->key_acts) { - xfree(dst->server->key_acts); - dst->server->key_acts = NULL; - } + free(dst->server->key_acts); + dst->server->key_acts = NULL; } if (src->server->behaviors) { if (src->max_key_code != dst->max_key_code) { - if (dst->server->behaviors) - tmp = xrealloc(dst->server->behaviors, - (src->max_key_code + 1) * - sizeof(XkbBehavior)); - else - tmp = xalloc((src->max_key_code + 1) * - sizeof(XkbBehavior)); + tmp = realloc(dst->server->behaviors, + (src->max_key_code + 1) * sizeof(XkbBehavior)); if (!tmp) return FALSE; dst->server->behaviors = tmp; @@ -1255,23 +1210,16 @@ _XkbCopyServerMap(XkbDescPtr src, XkbDescPtr dst) (src->max_key_code + 1) * sizeof(XkbBehavior)); } else { - if (dst->server->behaviors) { - xfree(dst->server->behaviors); - dst->server->behaviors = NULL; - } + free(dst->server->behaviors); + dst->server->behaviors = NULL; } memcpy(dst->server->vmods, src->server->vmods, XkbNumVirtualMods); if (src->server->vmodmap) { if (src->max_key_code != dst->max_key_code) { - if (dst->server->vmodmap) - tmp = xrealloc(dst->server->vmodmap, - (src->max_key_code + 1) * - sizeof(unsigned short)); - else - tmp = xalloc((src->max_key_code + 1) * - sizeof(unsigned short)); + tmp = realloc(dst->server->vmodmap, + (src->max_key_code + 1) * sizeof(unsigned short)); if (!tmp) return FALSE; dst->server->vmodmap = tmp; @@ -1280,10 +1228,8 @@ _XkbCopyServerMap(XkbDescPtr src, XkbDescPtr dst) (src->max_key_code + 1) * sizeof(unsigned short)); } else { - if (dst->server->vmodmap) { - xfree(dst->server->vmodmap); - dst->server->vmodmap = NULL; - } + free(dst->server->vmodmap); + dst->server->vmodmap = NULL; } } else { @@ -1302,19 +1248,15 @@ _XkbCopyNames(XkbDescPtr src, XkbDescPtr dst) /* names */ if (src->names) { if (!dst->names) { - dst->names = xcalloc(1, sizeof(XkbNamesRec)); + dst->names = calloc(1, sizeof(XkbNamesRec)); if (!dst->names) return FALSE; } if (src->names->keys) { if (src->max_key_code != dst->max_key_code) { - if (dst->names->keys) - tmp = xrealloc(dst->names->keys, (src->max_key_code + 1) * - sizeof(XkbKeyNameRec)); - else - tmp = xalloc((src->max_key_code + 1) * - sizeof(XkbKeyNameRec)); + tmp = realloc(dst->names->keys, + (src->max_key_code + 1) * sizeof(XkbKeyNameRec)); if (!tmp) return FALSE; dst->names->keys = tmp; @@ -1323,21 +1265,15 @@ _XkbCopyNames(XkbDescPtr src, XkbDescPtr dst) (src->max_key_code + 1) * sizeof(XkbKeyNameRec)); } else { - if (dst->names->keys) { - xfree(dst->names->keys); - dst->names->keys = NULL; - } + free(dst->names->keys); + dst->names->keys = NULL; } if (src->names->num_key_aliases) { if (src->names->num_key_aliases != dst->names->num_key_aliases) { - if (dst->names->key_aliases) - tmp = xrealloc(dst->names->key_aliases, - src->names->num_key_aliases * - sizeof(XkbKeyAliasRec)); - else - tmp = xalloc(src->names->num_key_aliases * - sizeof(XkbKeyAliasRec)); + tmp = realloc(dst->names->key_aliases, + src->names->num_key_aliases * + sizeof(XkbKeyAliasRec)); if (!tmp) return FALSE; dst->names->key_aliases = tmp; @@ -1346,20 +1282,15 @@ _XkbCopyNames(XkbDescPtr src, XkbDescPtr dst) src->names->num_key_aliases * sizeof(XkbKeyAliasRec)); } else { - if (dst->names->key_aliases) { - xfree(dst->names->key_aliases); - dst->names->key_aliases = NULL; - } + free(dst->names->key_aliases); + dst->names->key_aliases = NULL; } dst->names->num_key_aliases = src->names->num_key_aliases; if (src->names->num_rg) { if (src->names->num_rg != dst->names->num_rg) { - if (dst->names->radio_groups) - tmp = xrealloc(dst->names->radio_groups, - src->names->num_rg * sizeof(Atom)); - else - tmp = xalloc(src->names->num_rg * sizeof(Atom)); + tmp = realloc(dst->names->radio_groups, + src->names->num_rg * sizeof(Atom)); if (!tmp) return FALSE; dst->names->radio_groups = tmp; @@ -1368,8 +1299,7 @@ _XkbCopyNames(XkbDescPtr src, XkbDescPtr dst) src->names->num_rg * sizeof(Atom)); } else { - if (dst->names->radio_groups) - xfree(dst->names->radio_groups); + free(dst->names->radio_groups); } dst->names->num_rg = src->names->num_rg; @@ -1403,20 +1333,15 @@ _XkbCopyCompat(XkbDescPtr src, XkbDescPtr dst) /* compat */ if (src->compat) { if (!dst->compat) { - dst->compat = xcalloc(1, sizeof(XkbCompatMapRec)); + dst->compat = calloc(1, sizeof(XkbCompatMapRec)); if (!dst->compat) return FALSE; } if (src->compat->sym_interpret && src->compat->num_si) { if (src->compat->num_si != dst->compat->size_si) { - if (dst->compat->sym_interpret) - tmp = xrealloc(dst->compat->sym_interpret, - src->compat->num_si * - sizeof(XkbSymInterpretRec)); - else - tmp = xalloc(src->compat->num_si * - sizeof(XkbSymInterpretRec)); + tmp = realloc(dst->compat->sym_interpret, + src->compat->num_si * sizeof(XkbSymInterpretRec)); if (!tmp) return FALSE; dst->compat->sym_interpret = tmp; @@ -1429,7 +1354,7 @@ _XkbCopyCompat(XkbDescPtr src, XkbDescPtr dst) } else { if (dst->compat->sym_interpret && dst->compat->size_si) - xfree(dst->compat->sym_interpret); + free(dst->compat->sym_interpret); dst->compat->sym_interpret = NULL; dst->compat->num_si = 0; @@ -1463,7 +1388,7 @@ _XkbCopyGeom(XkbDescPtr src, XkbDescPtr dst) /* geometry */ if (src->geom) { if (!dst->geom) { - dst->geom = xcalloc(sizeof(XkbGeometryRec), 1); + dst->geom = calloc(sizeof(XkbGeometryRec), 1); if (!dst->geom) return FALSE; } @@ -1479,17 +1404,17 @@ _XkbCopyGeom(XkbDescPtr src, XkbDescPtr dst) dprop = dst->geom->properties + i; i < dst->geom->num_properties; i++, dprop++) { - xfree(dprop->name); - xfree(dprop->value); + free(dprop->name); + free(dprop->value); } } if (dst->geom->sz_properties) - tmp = xrealloc(dst->geom->properties, + tmp = realloc(dst->geom->properties, src->geom->num_properties * sizeof(XkbPropertyRec)); else - tmp = xalloc(src->geom->num_properties * + tmp = malloc(src->geom->num_properties * sizeof(XkbPropertyRec)); if (!tmp) return FALSE; @@ -1501,7 +1426,7 @@ _XkbCopyGeom(XkbDescPtr src, XkbDescPtr dst) dst->geom->sz_properties = src->geom->num_properties; if (dst->geom->sz_properties > dst->geom->num_properties) { - bzero(dst->geom->properties + dst->geom->num_properties, + memset(dst->geom->properties + dst->geom->num_properties, 0, (dst->geom->sz_properties - dst->geom->num_properties) * sizeof(XkbPropertyRec)); } @@ -1513,13 +1438,13 @@ _XkbCopyGeom(XkbDescPtr src, XkbDescPtr dst) i++, sprop++, dprop++) { if (i < dst->geom->num_properties) { if (strlen(sprop->name) != strlen(dprop->name)) { - tmp = xrealloc(dprop->name, strlen(sprop->name) + 1); + tmp = realloc(dprop->name, strlen(sprop->name) + 1); if (!tmp) return FALSE; dprop->name = tmp; } if (strlen(sprop->value) != strlen(dprop->value)) { - tmp = xrealloc(dprop->value, strlen(sprop->value) + 1); + tmp = realloc(dprop->value, strlen(sprop->value) + 1); if (!tmp) return FALSE; dprop->value = tmp; @@ -1541,10 +1466,10 @@ _XkbCopyGeom(XkbDescPtr src, XkbDescPtr dst) for (i = 0, dprop = dst->geom->properties; i < dst->geom->num_properties; i++, dprop++) { - xfree(dprop->name); - xfree(dprop->value); + free(dprop->name); + free(dprop->value); } - xfree(dst->geom->properties); + free(dst->geom->properties); dst->geom->properties = NULL; } @@ -1560,16 +1485,16 @@ _XkbCopyGeom(XkbDescPtr src, XkbDescPtr dst) dcolor = dst->geom->colors + i; i < dst->geom->num_colors; i++, dcolor++) { - xfree(dcolor->spec); + free(dcolor->spec); } } if (dst->geom->sz_colors) - tmp = xrealloc(dst->geom->colors, + tmp = realloc(dst->geom->colors, src->geom->num_colors * sizeof(XkbColorRec)); else - tmp = xalloc(src->geom->num_colors * + tmp = malloc(src->geom->num_colors * sizeof(XkbColorRec)); if (!tmp) return FALSE; @@ -1579,7 +1504,7 @@ _XkbCopyGeom(XkbDescPtr src, XkbDescPtr dst) dst->geom->sz_colors = src->geom->num_colors; if (dst->geom->sz_colors > dst->geom->num_colors) { - bzero(dst->geom->colors + dst->geom->num_colors, + memset(dst->geom->colors + dst->geom->num_colors, 0, (dst->geom->sz_colors - dst->geom->num_colors) * sizeof(XkbColorRec)); } @@ -1591,7 +1516,7 @@ _XkbCopyGeom(XkbDescPtr src, XkbDescPtr dst) i++, scolor++, dcolor++) { if (i < dst->geom->num_colors) { if (strlen(scolor->spec) != strlen(dcolor->spec)) { - tmp = xrealloc(dcolor->spec, strlen(scolor->spec) + 1); + tmp = realloc(dcolor->spec, strlen(scolor->spec) + 1); if (!tmp) return FALSE; dcolor->spec = tmp; @@ -1611,9 +1536,9 @@ _XkbCopyGeom(XkbDescPtr src, XkbDescPtr dst) for (i = 0, dcolor = dst->geom->colors; i < dst->geom->num_colors; i++, dcolor++) { - xfree(dcolor->spec); + free(dcolor->spec); } - xfree(dst->geom->colors); + free(dst->geom->colors); dst->geom->colors = NULL; } @@ -1631,11 +1556,11 @@ _XkbCopyGeom(XkbDescPtr src, XkbDescPtr dst) j < dshape->num_outlines; j++, doutline++) { if (doutline->sz_points) - xfree(doutline->points); + free(doutline->points); } if (dshape->sz_outlines) { - xfree(dshape->outlines); + free(dshape->outlines); dshape->outlines = NULL; } @@ -1645,7 +1570,7 @@ _XkbCopyGeom(XkbDescPtr src, XkbDescPtr dst) } if (src->geom->num_shapes) { - tmp = xcalloc(src->geom->num_shapes, sizeof(XkbShapeRec)); + tmp = calloc(src->geom->num_shapes, sizeof(XkbShapeRec)); if (!tmp) return FALSE; dst->geom->shapes = tmp; @@ -1654,7 +1579,7 @@ _XkbCopyGeom(XkbDescPtr src, XkbDescPtr dst) i < src->geom->num_shapes; i++, sshape++, dshape++) { if (sshape->num_outlines) { - tmp = xcalloc(sshape->num_outlines, sizeof(XkbOutlineRec)); + tmp = calloc(sshape->num_outlines, sizeof(XkbOutlineRec)); if (!tmp) return FALSE; dshape->outlines = tmp; @@ -1665,7 +1590,7 @@ _XkbCopyGeom(XkbDescPtr src, XkbDescPtr dst) j < sshape->num_outlines; j++, soutline++, doutline++) { if (soutline->num_points) { - tmp = xalloc(soutline->num_points * + tmp = malloc(soutline->num_points * sizeof(XkbPointRec)); if (!tmp) return FALSE; @@ -1721,7 +1646,7 @@ _XkbCopyGeom(XkbDescPtr src, XkbDescPtr dst) } else { if (dst->geom->sz_shapes) { - xfree(dst->geom->shapes); + free(dst->geom->shapes); } dst->geom->shapes = NULL; dst->geom->num_shapes = 0; @@ -1739,36 +1664,29 @@ _XkbCopyGeom(XkbDescPtr src, XkbDescPtr dst) j < dsection->num_rows; j++, drow++) { if (drow->num_keys) - xfree(drow->keys); + free(drow->keys); } if (dsection->num_rows) - xfree(dsection->rows); + free(dsection->rows); /* cut and waste from geom/doodad below. */ for (j = 0, ddoodad = dsection->doodads; j < dsection->num_doodads; j++, ddoodad++) { if (ddoodad->any.type == XkbTextDoodad) { - if (ddoodad->text.text) { - xfree(ddoodad->text.text); - ddoodad->text.text = NULL; - } - if (ddoodad->text.font) { - xfree(ddoodad->text.font); - ddoodad->text.font = NULL; - } + free(ddoodad->text.text); + ddoodad->text.text = NULL; + free(ddoodad->text.font); + ddoodad->text.font = NULL; } else if (ddoodad->any.type == XkbLogoDoodad) { - if (ddoodad->logo.logo_name) { - xfree(ddoodad->logo.logo_name); - ddoodad->logo.logo_name = NULL; - } + free(ddoodad->logo.logo_name); + ddoodad->logo.logo_name = NULL; } } - if (dsection->num_doodads) - xfree(dsection->doodads); + free(dsection->doodads); } dst->geom->num_sections = 0; @@ -1777,11 +1695,11 @@ _XkbCopyGeom(XkbDescPtr src, XkbDescPtr dst) if (src->geom->num_sections) { if (dst->geom->sz_sections) - tmp = xrealloc(dst->geom->sections, + tmp = realloc(dst->geom->sections, src->geom->num_sections * sizeof(XkbSectionRec)); else - tmp = xalloc(src->geom->num_sections * sizeof(XkbSectionRec)); + tmp = malloc(src->geom->num_sections * sizeof(XkbSectionRec)); if (!tmp) return FALSE; memset(tmp, 0, src->geom->num_sections * sizeof(XkbSectionRec)); @@ -1796,7 +1714,7 @@ _XkbCopyGeom(XkbDescPtr src, XkbDescPtr dst) i++, ssection++, dsection++) { *dsection = *ssection; if (ssection->num_rows) { - tmp = xcalloc(ssection->num_rows, sizeof(XkbRowRec)); + tmp = calloc(ssection->num_rows, sizeof(XkbRowRec)); if (!tmp) return FALSE; dsection->rows = tmp; @@ -1808,7 +1726,7 @@ _XkbCopyGeom(XkbDescPtr src, XkbDescPtr dst) j < ssection->num_rows; j++, srow++, drow++) { if (srow->num_keys) { - tmp = xalloc(srow->num_keys * sizeof(XkbKeyRec)); + tmp = malloc(srow->num_keys * sizeof(XkbKeyRec)); if (!tmp) return FALSE; drow->keys = tmp; @@ -1824,7 +1742,7 @@ _XkbCopyGeom(XkbDescPtr src, XkbDescPtr dst) } if (ssection->num_doodads) { - tmp = xcalloc(ssection->num_doodads, sizeof(XkbDoodadRec)); + tmp = calloc(ssection->num_doodads, sizeof(XkbDoodadRec)); if (!tmp) return FALSE; dsection->doodads = tmp; @@ -1843,15 +1761,15 @@ _XkbCopyGeom(XkbDescPtr src, XkbDescPtr dst) if (sdoodad->any.type == XkbTextDoodad) { if (sdoodad->text.text) ddoodad->text.text = - xstrdup(sdoodad->text.text); + strdup(sdoodad->text.text); if (sdoodad->text.font) ddoodad->text.font = - xstrdup(sdoodad->text.font); + strdup(sdoodad->text.font); } else if (sdoodad->any.type == XkbLogoDoodad) { if (sdoodad->logo.logo_name) ddoodad->logo.logo_name = - xstrdup(sdoodad->logo.logo_name); + strdup(sdoodad->logo.logo_name); } } dsection->overlays = NULL; @@ -1861,7 +1779,7 @@ _XkbCopyGeom(XkbDescPtr src, XkbDescPtr dst) } else { if (dst->geom->sz_sections) { - xfree(dst->geom->sections); + free(dst->geom->sections); } dst->geom->sections = NULL; @@ -1877,20 +1795,14 @@ _XkbCopyGeom(XkbDescPtr src, XkbDescPtr dst) i < dst->geom->num_doodads; i++, ddoodad++) { if (ddoodad->any.type == XkbTextDoodad) { - if (ddoodad->text.text) { - xfree(ddoodad->text.text); - ddoodad->text.text = NULL; - } - if (ddoodad->text.font) { - xfree(ddoodad->text.font); - ddoodad->text.font = NULL; - } + free(ddoodad->text.text); + ddoodad->text.text = NULL; + free(ddoodad->text.font); + ddoodad->text.font = NULL; } else if (ddoodad->any.type == XkbLogoDoodad) { - if (ddoodad->logo.logo_name) { - xfree(ddoodad->logo.logo_name); - ddoodad->logo.logo_name = NULL; - } + free(ddoodad->logo.logo_name); + ddoodad->logo.logo_name = NULL; } } dst->geom->num_doodads = 0; @@ -1899,11 +1811,11 @@ _XkbCopyGeom(XkbDescPtr src, XkbDescPtr dst) if (src->geom->num_doodads) { if (dst->geom->sz_doodads) - tmp = xrealloc(dst->geom->doodads, + tmp = realloc(dst->geom->doodads, src->geom->num_doodads * sizeof(XkbDoodadRec)); else - tmp = xalloc(src->geom->num_doodads * + tmp = malloc(src->geom->num_doodads * sizeof(XkbDoodadRec)); if (!tmp) return FALSE; @@ -1920,14 +1832,14 @@ _XkbCopyGeom(XkbDescPtr src, XkbDescPtr dst) memcpy(ddoodad , sdoodad, sizeof(XkbDoodadRec)); if (sdoodad->any.type == XkbTextDoodad) { if (sdoodad->text.text) - ddoodad->text.text = xstrdup(sdoodad->text.text); + ddoodad->text.text = strdup(sdoodad->text.text); if (sdoodad->text.font) - ddoodad->text.font = xstrdup(sdoodad->text.font); + ddoodad->text.font = strdup(sdoodad->text.font); } else if (sdoodad->any.type == XkbLogoDoodad) { if (sdoodad->logo.logo_name) ddoodad->logo.logo_name = - xstrdup(sdoodad->logo.logo_name); + strdup(sdoodad->logo.logo_name); } } @@ -1935,7 +1847,7 @@ _XkbCopyGeom(XkbDescPtr src, XkbDescPtr dst) } else { if (dst->geom->sz_doodads) { - xfree(dst->geom->doodads); + free(dst->geom->doodads); } dst->geom->doodads = NULL; @@ -1947,11 +1859,11 @@ _XkbCopyGeom(XkbDescPtr src, XkbDescPtr dst) if (src->geom->num_key_aliases) { if (src->geom->num_key_aliases != dst->geom->sz_key_aliases) { if (dst->geom->sz_key_aliases) - tmp = xrealloc(dst->geom->key_aliases, + tmp = realloc(dst->geom->key_aliases, src->geom->num_key_aliases * 2 * XkbKeyNameLength); else - tmp = xalloc(src->geom->num_key_aliases * + tmp = malloc(src->geom->num_key_aliases * 2 * XkbKeyNameLength); if (!tmp) return FALSE; @@ -1966,9 +1878,7 @@ _XkbCopyGeom(XkbDescPtr src, XkbDescPtr dst) dst->geom->num_key_aliases = dst->geom->sz_key_aliases; } else { - if (dst->geom->key_aliases) { - xfree(dst->geom->key_aliases); - } + free(dst->geom->key_aliases); dst->geom->key_aliases = NULL; dst->geom->num_key_aliases = 0; dst->geom->sz_key_aliases = 0; @@ -1977,14 +1887,14 @@ _XkbCopyGeom(XkbDescPtr src, XkbDescPtr dst) /* font */ if (src->geom->label_font) { if (!dst->geom->label_font) { - tmp = xalloc(strlen(src->geom->label_font) + 1); + tmp = malloc(strlen(src->geom->label_font) + 1); if (!tmp) return FALSE; dst->geom->label_font = tmp; } else if (strlen(src->geom->label_font) != strlen(dst->geom->label_font)) { - tmp = xrealloc(dst->geom->label_font, + tmp = realloc(dst->geom->label_font, strlen(src->geom->label_font) + 1); if (!tmp) return FALSE; @@ -1998,9 +1908,7 @@ _XkbCopyGeom(XkbDescPtr src, XkbDescPtr dst) dst->geom->base_color = &(dst->geom->colors[i]); } else { - if (dst->geom->label_font) { - xfree(dst->geom->label_font); - } + free(dst->geom->label_font); dst->geom->label_font = NULL; dst->geom->label_color = NULL; dst->geom->base_color = NULL; @@ -2028,17 +1936,15 @@ _XkbCopyIndicators(XkbDescPtr src, XkbDescPtr dst) /* indicators */ if (src->indicators) { if (!dst->indicators) { - dst->indicators = xalloc(sizeof(XkbIndicatorRec)); + dst->indicators = malloc(sizeof(XkbIndicatorRec)); if (!dst->indicators) return FALSE; } memcpy(dst->indicators, src->indicators, sizeof(XkbIndicatorRec)); } else { - if (dst->indicators) { - xfree(dst->indicators); - dst->indicators = NULL; - } + free(dst->indicators); + dst->indicators = NULL; } return TRUE; } @@ -2049,17 +1955,15 @@ _XkbCopyControls(XkbDescPtr src, XkbDescPtr dst) /* controls */ if (src->ctrls) { if (!dst->ctrls) { - dst->ctrls = xalloc(sizeof(XkbControlsRec)); + dst->ctrls = malloc(sizeof(XkbControlsRec)); if (!dst->ctrls) return FALSE; } memcpy(dst->ctrls, src->ctrls, sizeof(XkbControlsRec)); } else { - if (dst->ctrls) { - xfree(dst->ctrls); - dst->ctrls = NULL; - } + free(dst->ctrls); + dst->ctrls = NULL; } return TRUE; } @@ -2190,3 +2094,29 @@ XkbGetEffectiveGroup(XkbSrvInfoPtr xkbi, XkbStatePtr xkbState, CARD8 keycode) return effectiveGroup; } + +/* Merge the lockedPtrButtons from all attached SDs for the given master + * device into the MD's state. + */ +void +XkbMergeLockedPtrBtns(DeviceIntPtr master) +{ + DeviceIntPtr d = inputInfo.devices; + XkbSrvInfoPtr xkbi = NULL; + + if (!IsMaster(master)) + return; + + if (!master->key) + return; + + xkbi = master->key->xkbInfo; + xkbi->lockedPtrButtons = 0; + + for (; d; d = d->next) { + if (IsMaster(d) || GetMaster(d, MASTER_KEYBOARD) != master || !d->key) + continue; + + xkbi->lockedPtrButtons |= d->key->xkbInfo->lockedPtrButtons; + } +} diff --git a/xserver/xkb/xkbfmisc.c b/xserver/xkb/xkbfmisc.c index 103e609a9..7aa9863f2 100644 --- a/xserver/xkb/xkbfmisc.c +++ b/xserver/xkb/xkbfmisc.c @@ -437,5 +437,5 @@ XkbNameMatchesPattern(char *name,char *ptrn) ptrn++; } /* if we get here, the pattern is exhausted (-:just like me:-) */ - return (name[0]=='\0'); + return name[0]=='\0'; } diff --git a/xserver/xkb/xkbout.c b/xserver/xkb/xkbout.c index 68ede902f..082c85ee9 100644 --- a/xserver/xkb/xkbout.c +++ b/xserver/xkb/xkbout.c @@ -353,9 +353,13 @@ XkbClientMapPtr map; XkbServerMapPtr srv; Bool showActions; + if (!xkb) { + _XkbLibError(_XkbErrMissingSymbols,"XkbWriteXKBSymbols",0); + return FALSE; + } + map= xkb->map; - srv= xkb->server; - if ((!xkb)||(!map)||(!map->syms)||(!map->key_sym_map)) { + if ((!map)||(!map->syms)||(!map->key_sym_map)) { _XkbLibError(_XkbErrMissingSymbols,"XkbWriteXKBSymbols",0); return FALSE; } @@ -376,6 +380,7 @@ Bool showActions; } if (tmp>0) fprintf(file,"\n"); + srv= xkb->server; for (i=xkb->min_key_code;i<=xkb->max_key_code;i++) { Bool simple; if ((int)XkbKeyNumSyms(xkb,i)<1) diff --git a/xserver/xkb/xkmread.c b/xserver/xkb/xkmread.c index a201731f3..814bb1d41 100644 --- a/xserver/xkb/xkmread.c +++ b/xserver/xkb/xkmread.c @@ -58,7 +58,7 @@ char *new; if (str==NULL) return NULL; - new= xcalloc(strlen(str)+1,sizeof(char)); + new= calloc(strlen(str)+1,sizeof(char)); if (new) strcpy(new,str); return new; @@ -74,13 +74,13 @@ int newCount= *newCountRtrn; if (oldPtr==NULL) { if (newCount==0) return NULL; - oldPtr= xcalloc(newCount,elemSize); + oldPtr= calloc(newCount,elemSize); } else if (oldCount<newCount) { - oldPtr= xrealloc(oldPtr,newCount*elemSize); + oldPtr= realloc(oldPtr,newCount*elemSize); if (oldPtr!=NULL) { char *tmp= (char *)oldPtr; - bzero(&tmp[oldCount*elemSize],(newCount-oldCount)*elemSize); + memset(&tmp[oldCount*elemSize], 0, (newCount-oldCount)*elemSize); } } else if (newCount<oldCount) { @@ -725,8 +725,8 @@ int nRead=0; return -1; } nRead+= tmp*SIZEOF(xkmKeySymMapDesc); - bzero((char *)typeName,XkbNumKbdGroups*sizeof(Atom)); - bzero((char *)type,XkbNumKbdGroups*sizeof(XkbKeyTypePtr)); + memset((char *)typeName, 0, XkbNumKbdGroups*sizeof(Atom)); + memset((char *)type, 0, XkbNumKbdGroups*sizeof(XkbKeyTypePtr)); if (wireMap.flags&XkmKeyHasTypes) { register int g; for (g=0;g<XkbNumKbdGroups;g++) { |