diff options
Diffstat (limited to 'xorg-server')
-rw-r--r-- | xorg-server/dix/cursor.c | 203 | ||||
-rw-r--r-- | xorg-server/hw/xfree86/common/xf86Xinput.c | 20 | ||||
-rw-r--r-- | xorg-server/include/xkbsrv.h | 19 | ||||
-rw-r--r-- | xorg-server/os/utils.c | 4 | ||||
-rw-r--r-- | xorg-server/xkb/XKBAlloc.c | 46 | ||||
-rw-r--r-- | xorg-server/xkb/XKBGAlloc.c | 2 | ||||
-rw-r--r-- | xorg-server/xkb/XKBMAlloc.c | 71 | ||||
-rw-r--r-- | xorg-server/xkb/XKBMisc.c | 8 | ||||
-rw-r--r-- | xorg-server/xkb/ddxList.c | 2 | ||||
-rw-r--r-- | xorg-server/xkb/maprules.c | 16 | ||||
-rw-r--r-- | xorg-server/xkb/xkb.c | 7 | ||||
-rw-r--r-- | xorg-server/xkb/xkbActions.c | 7 | ||||
-rw-r--r-- | xorg-server/xkb/xkbEvents.c | 2 | ||||
-rw-r--r-- | xorg-server/xkb/xkbLEDs.c | 18 | ||||
-rw-r--r-- | xorg-server/xkb/xkbfmisc.c | 10 | ||||
-rw-r--r-- | xorg-server/xkb/xkbout.c | 2 | ||||
-rw-r--r-- | xorg-server/xkb/xkbtext.c | 4 |
17 files changed, 197 insertions, 244 deletions
diff --git a/xorg-server/dix/cursor.c b/xorg-server/dix/cursor.c index 6103b15e3..324d73345 100644 --- a/xorg-server/dix/cursor.c +++ b/xorg-server/dix/cursor.c @@ -160,6 +160,64 @@ CheckForEmptyMask(CursorBitsPtr bits) } /** + * realize the cursor for every screen. Do not change the refcnt, this will be + * changed when ChangeToCursor actually changes the sprite. + * + * @return Success if all cursors realize on all screens, BadAlloc if realize + * failed for a device on a given screen. + */ +static int +RealizeCursorAllScreens(CursorPtr pCurs) +{ + DeviceIntPtr pDev; + ScreenPtr pscr; + int nscr; + + for (nscr = 0; nscr < screenInfo.numScreens; nscr++) + { + pscr = screenInfo.screens[nscr]; + for (pDev = inputInfo.devices; pDev; pDev = pDev->next) + { + if (DevHasCursor(pDev)) + { + if (!( *pscr->RealizeCursor)(pDev, pscr, pCurs)) + { + /* Realize failed for device pDev on screen pscr. + * We have to assume that for all devices before, realize + * worked. We need to rollback all devices so far on the + * current screen and then all devices on previous + * screens. + */ + DeviceIntPtr pDevIt = inputInfo.devices; /*dev iterator*/ + while(pDevIt && pDevIt != pDev) + { + if (DevHasCursor(pDevIt)) + ( *pscr->UnrealizeCursor)(pDevIt, pscr, pCurs); + pDevIt = pDevIt->next; + } + while (--nscr >= 0) + { + pscr = screenInfo.screens[nscr]; + /* now unrealize all devices on previous screens */ + pDevIt = inputInfo.devices; + while (pDevIt) + { + if (DevHasCursor(pDevIt)) + ( *pscr->UnrealizeCursor)(pDevIt, pscr, pCurs); + pDevIt = pDevIt->next; + } + ( *pscr->UnrealizeCursor)(pDev, pscr, pCurs); + } + return BadAlloc; + } + } + } + } + + return Success; +} + +/** * does nothing about the resource table, just creates the data structure. * does not copy the src and mask bits * @@ -176,9 +234,7 @@ AllocARGBCursor(unsigned char *psrcbits, unsigned char *pmaskbits, { CursorBitsPtr bits; CursorPtr pCurs; - int rc, nscr; - ScreenPtr pscr; - DeviceIntPtr pDev; + int rc; *ppCurs = NULL; pCurs = (CursorPtr)xcalloc(sizeof(CursorRec) + sizeof(CursorBits), 1); @@ -222,62 +278,21 @@ AllocARGBCursor(unsigned char *psrcbits, unsigned char *pmaskbits, /* security creation/labeling check */ rc = XaceHook(XACE_RESOURCE_ACCESS, client, cid, RT_CURSOR, pCurs, RT_NONE, NULL, DixCreateAccess); - if (rc != Success) { - dixFreePrivates(pCurs->devPrivates); - FreeCursorBits(bits); - xfree(pCurs); - return rc; - } - - /* - * realize the cursor for every screen - * Do not change the refcnt, this will be changed when ChangeToCursor - * actually changes the sprite. - */ - for (nscr = 0; nscr < screenInfo.numScreens; nscr++) - { - pscr = screenInfo.screens[nscr]; - for (pDev = inputInfo.devices; pDev; pDev = pDev->next) - { - if (DevHasCursor(pDev)) - { - if (!( *pscr->RealizeCursor)(pDev, pscr, pCurs)) - { - /* Realize failed for device pDev on screen pscr. - * We have to assume that for all devices before, realize - * worked. We need to rollback all devices so far on the - * current screen and then all devices on previous - * screens. - */ - DeviceIntPtr pDevIt = inputInfo.devices; /*dev iterator*/ - while(pDevIt && pDevIt != pDev) - { - if (DevHasCursor(pDevIt)) - ( *pscr->UnrealizeCursor)(pDevIt, pscr, pCurs); - pDevIt = pDevIt->next; - } - while (--nscr >= 0) - { - pscr = screenInfo.screens[nscr]; - /* now unrealize all devices on previous screens */ - pDevIt = inputInfo.devices; - while (pDevIt) - { - if (DevHasCursor(pDevIt)) - ( *pscr->UnrealizeCursor)(pDevIt, pscr, pCurs); - pDevIt = pDevIt->next; - } - ( *pscr->UnrealizeCursor)(pDev, pscr, pCurs); - } - dixFreePrivates(pCurs->devPrivates); - FreeCursorBits(bits); - xfree(pCurs); - return BadAlloc; - } - } - } - } + if (rc != Success) + goto error; + + rc = RealizeCursorAllScreens(pCurs); + if (rc != Success) + goto error; + *ppCurs = pCurs; + return Success; + +error: + dixFreePrivates(pCurs->devPrivates); + FreeCursorBits(bits); + xfree(pCurs); + return rc; } @@ -294,10 +309,7 @@ AllocGlyphCursor(Font source, unsigned sourceChar, Font mask, unsigned maskChar, int rc; CursorBitsPtr bits; CursorPtr pCurs; - int nscr; - ScreenPtr pscr; GlyphSharePtr pShare; - DeviceIntPtr pDev; rc = dixLookupResourceByType((pointer *)&sourcefont, source, RT_FONT, client, DixUseAccess); @@ -444,67 +456,22 @@ AllocGlyphCursor(Font source, unsigned sourceChar, Font mask, unsigned maskChar, /* security creation/labeling check */ rc = XaceHook(XACE_RESOURCE_ACCESS, client, cid, RT_CURSOR, pCurs, RT_NONE, NULL, DixCreateAccess); - if (rc != Success) { - dixFreePrivates(pCurs->devPrivates); - FreeCursorBits(bits); - xfree(pCurs); - return rc; - } - - /* - * realize the cursor for every screen - */ - for (nscr = 0; nscr < screenInfo.numScreens; nscr++) - { - pscr = screenInfo.screens[nscr]; - - for (pDev = inputInfo.devices; pDev; pDev = pDev->next) - { - if (DevHasCursor(pDev)) - { - if (!( *pscr->RealizeCursor)(pDev, pscr, pCurs)) - { - /* Realize failed for device pDev on screen pscr. - * We have to assume that for all devices before, realize - * worked. We need to rollback all devices so far on the - * current screen and then all devices on previous - * screens. - */ - DeviceIntPtr pDevIt = inputInfo.devices; /*dev iterator*/ - while(pDevIt && pDevIt != pDev) - { - if (DevHasCursor(pDevIt)) - ( *pscr->UnrealizeCursor)(pDevIt, pscr, pCurs); - pDevIt = pDevIt->next; - } - - (*pscr->UnrealizeCursor)(inputInfo.pointer, pscr, pCurs); + if (rc != Success) + goto error; - while (--nscr >= 0) - { - pscr = screenInfo.screens[nscr]; - /* now unrealize all devices on previous screens */ - ( *pscr->UnrealizeCursor)(inputInfo.pointer, pscr, pCurs); + rc = RealizeCursorAllScreens(pCurs); + if (rc != Success) + goto error; - pDevIt = inputInfo.devices; - while (pDevIt) - { - if (DevHasCursor(pDevIt)) - ( *pscr->UnrealizeCursor)(pDevIt, pscr, pCurs); - pDevIt = pDevIt->next; - } - ( *pscr->UnrealizeCursor)(pDev, pscr, pCurs); - } - dixFreePrivates(pCurs->devPrivates); - FreeCursorBits(bits); - xfree(pCurs); - return BadAlloc; - } - } - } - } *ppCurs = pCurs; return Success; + +error: + dixFreePrivates(pCurs->devPrivates); + FreeCursorBits(bits); + xfree(pCurs); + + return rc; } /** CreateRootCursor diff --git a/xorg-server/hw/xfree86/common/xf86Xinput.c b/xorg-server/hw/xfree86/common/xf86Xinput.c index df774a155..fb0ee9c3f 100644 --- a/xorg-server/hw/xfree86/common/xf86Xinput.c +++ b/xorg-server/hw/xfree86/common/xf86Xinput.c @@ -504,10 +504,10 @@ InputClassMatches(XF86ConfInputClassPtr iclass, InputAttributes *attrs) { if (iclass->match_product && (!attrs->product || !strstr(attrs->product, iclass->match_product))) - return False; + return FALSE; if (iclass->match_vendor && (!attrs->vendor || !strstr(attrs->vendor, iclass->match_vendor))) - return False; + return FALSE; if (iclass->match_device && #ifdef HAVE_FNMATCH_H (!attrs->device || @@ -515,26 +515,26 @@ InputClassMatches(XF86ConfInputClassPtr iclass, InputAttributes *attrs) #else (!attrs->device || !strstr(attrs->device, iclass->match_device))) #endif - return False; + return FALSE; if (iclass->is_keyboard.set && iclass->is_keyboard.val != !!(attrs->flags & ATTR_KEYBOARD)) - return False; + return FALSE; if (iclass->is_pointer.set && iclass->is_pointer.val != !!(attrs->flags & ATTR_POINTER)) - return False; + return FALSE; if (iclass->is_joystick.set && iclass->is_joystick.val != !!(attrs->flags & ATTR_JOYSTICK)) - return False; + return FALSE; if (iclass->is_tablet.set && iclass->is_tablet.val != !!(attrs->flags & ATTR_TABLET)) - return False; + return FALSE; if (iclass->is_touchpad.set && iclass->is_touchpad.val != !!(attrs->flags & ATTR_TOUCHPAD)) - return False; + return FALSE; if (iclass->is_touchscreen.set && iclass->is_touchscreen.val != !!(attrs->flags & ATTR_TOUCHSCREEN)) - return False; - return True; + return FALSE; + return TRUE; } /* diff --git a/xorg-server/include/xkbsrv.h b/xorg-server/include/xkbsrv.h index ebc7cdbb8..c309465f1 100644 --- a/xorg-server/include/xkbsrv.h +++ b/xorg-server/include/xkbsrv.h @@ -275,10 +275,10 @@ typedef struct device->public.realInputProc = oldprocs->realInputProc; \ device->unwrapProc = oldprocs->unwrapProc; -extern _X_EXPORT DevPrivateKey xkbDevicePrivateKey; +extern DevPrivateKey xkbDevicePrivateKey; #define XKBDEVICEINFO(dev) ((xkbDeviceInfoPtr)dixLookupPrivate(&(dev)->devPrivates, xkbDevicePrivateKey)) -extern _X_EXPORT void xkbUnwrapProc(DeviceIntPtr, DeviceHandleProc, pointer); +extern void xkbUnwrapProc(DeviceIntPtr, DeviceHandleProc, pointer); /***====================================================================***/ @@ -299,12 +299,6 @@ extern _X_EXPORT char * XkbBinDirectory; extern _X_EXPORT CARD32 xkbDebugFlags; -#define _XkbTypedAlloc(t) ((t *)xalloc(sizeof(t))) -#define _XkbTypedCalloc(n,t) ((t *)Xcalloc((n)*sizeof(t))) -#define _XkbTypedRealloc(o,n,t) \ - ((o)?(t *)Xrealloc((o),(n)*sizeof(t)):_XkbTypedCalloc(n,t)) -#define _XkbClearElems(a,f,l,t) bzero(&(a)[f],((l)-(f)+1)*sizeof(t)) - #define _XkbLibError(c,l,d) /* Epoch fail */ #define _XkbErrCode2(a,b) ((XID)((((unsigned int)(a))<<24)|((b)&0xffffff))) #define _XkbErrCode3(a,b,c) _XkbErrCode2(a,(((unsigned int)(b))<<16)|(c)) @@ -313,13 +307,6 @@ extern _X_EXPORT CARD32 xkbDebugFlags; extern _X_EXPORT int DeviceKeyPress,DeviceKeyRelease,DeviceMotionNotify; extern _X_EXPORT int DeviceButtonPress,DeviceButtonRelease; -#define _XkbIsPressEvent(t) (((t)==KeyPress)||((t)==DeviceKeyPress)) -#define _XkbIsReleaseEvent(t) (((t)==KeyRelease)||((t)==DeviceKeyRelease)) - -#define XConvertCase(s,l,u) XkbConvertCase(s,l,u) -#undef IsKeypadKey -#define IsKeypadKey(s) XkbKSIsKeypad(s) - #define Status int #ifndef True @@ -1000,6 +987,4 @@ extern _X_EXPORT XkbDescPtr XkbCompileKeymap( XkbRMLVOSet * /* rmlvo */ ); -#define XkbAtomGetString(s) NameForAtom(s) - #endif /* _XKBSRV_H_ */ diff --git a/xorg-server/os/utils.c b/xorg-server/os/utils.c index 3718b170c..d7c8388d0 100644 --- a/xorg-server/os/utils.c +++ b/xorg-server/os/utils.c @@ -472,7 +472,7 @@ AdjustWaitForDelay (pointer waitTime, unsigned long newdelay) void UseMsg(void) { ErrorF("use: X [:<display>] [option]\n"); - ErrorF("-a # mouse acceleration (pixels)\n"); + ErrorF("-a # default pointer acceleration (factor)\n"); ErrorF("-ac disable access control restrictions\n"); ErrorF("-audit int set audit trail level\n"); ErrorF("-auth file select authorization file\n"); @@ -524,7 +524,7 @@ void UseMsg(void) #endif ErrorF("-retro start with classic stipple and cursor\n"); ErrorF("-s # screen-saver timeout (minutes)\n"); - ErrorF("-t # mouse threshold (pixels)\n"); + ErrorF("-t # default pointer threshold (pixels/t)\n"); ErrorF("-terminate terminate at server reset\n"); ErrorF("-to # connection time out\n"); ErrorF("-tst disable testing extensions\n"); diff --git a/xorg-server/xkb/XKBAlloc.c b/xorg-server/xkb/XKBAlloc.c index 7265d83f2..6464e9970 100644 --- a/xorg-server/xkb/XKBAlloc.c +++ b/xorg-server/xkb/XKBAlloc.c @@ -35,6 +35,8 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include "inputstr.h" #include <xkbsrv.h> #include "xkbgeom.h" +#include <os.h> +#include <string.h> /***===================================================================***/ @@ -55,24 +57,24 @@ XkbSymInterpretRec *prev_interpret; if (compat->sym_interpret==NULL) compat->num_si= 0; prev_interpret = compat->sym_interpret; - compat->sym_interpret= _XkbTypedRealloc(compat->sym_interpret, - nSI,XkbSymInterpretRec); + compat->sym_interpret= xrealloc(compat->sym_interpret, + nSI * sizeof(XkbSymInterpretRec)); if (compat->sym_interpret==NULL) { xfree(prev_interpret); compat->size_si= compat->num_si= 0; return BadAlloc; } if (compat->num_si!=0) { - _XkbClearElems(compat->sym_interpret,compat->num_si, - compat->size_si-1,XkbSymInterpretRec); + memset(&compat->sym_interpret[compat->num_si], 0, + (compat->size_si - compat->num_si) * sizeof(XkbSymInterpretRec)); } return Success; } - compat= _XkbTypedCalloc(1,XkbCompatMapRec); + compat= xcalloc(1, sizeof(XkbCompatMapRec)); if (compat==NULL) return BadAlloc; if (nSI>0) { - compat->sym_interpret= _XkbTypedCalloc(nSI,XkbSymInterpretRec); + compat->sym_interpret= xcalloc(nSI, sizeof(XkbSymInterpretRec)); if (!compat->sym_interpret) { xfree(compat); return BadAlloc; @@ -121,7 +123,7 @@ XkbNamesPtr names; if (xkb==NULL) return BadMatch; if (xkb->names==NULL) { - xkb->names = _XkbTypedCalloc(1,XkbNamesRec); + xkb->names = xcalloc(1, sizeof(XkbNamesRec)); if (xkb->names==NULL) return BadAlloc; } @@ -133,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= _XkbTypedCalloc(type->num_levels,Atom); + type->level_names= xcalloc(type->num_levels, sizeof(Atom)); if (type->level_names==NULL) return BadAlloc; } @@ -144,22 +146,22 @@ XkbNamesPtr names; (!XkbIsLegalKeycode(xkb->max_key_code))|| (xkb->max_key_code<xkb->min_key_code)) return BadValue; - names->keys= _XkbTypedCalloc((xkb->max_key_code+1),XkbKeyNameRec); + names->keys= xcalloc((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= _XkbTypedCalloc(nTotalAliases,XkbKeyAliasRec); + names->key_aliases= xcalloc(nTotalAliases, sizeof(XkbKeyAliasRec)); } else if (nTotalAliases>names->num_key_aliases) { XkbKeyAliasRec *prev_aliases = names->key_aliases; - names->key_aliases= _XkbTypedRealloc(names->key_aliases, - nTotalAliases,XkbKeyAliasRec); + names->key_aliases= xrealloc(names->key_aliases, + nTotalAliases * sizeof(XkbKeyAliasRec)); if (names->key_aliases!=NULL) { - _XkbClearElems(names->key_aliases,names->num_key_aliases, - nTotalAliases-1,XkbKeyAliasRec); + memset(&names->key_aliases[names->num_key_aliases], 0, + (nTotalAliases - names->num_key_aliases) * sizeof(XkbKeyAliasRec)); } else { xfree(prev_aliases); } @@ -172,16 +174,16 @@ XkbNamesPtr names; } if ((which&XkbRGNamesMask)&&(nTotalRG>0)) { if (names->radio_groups==NULL) { - names->radio_groups= _XkbTypedCalloc(nTotalRG,Atom); + names->radio_groups= xcalloc(nTotalRG, sizeof(Atom)); } else if (nTotalRG>names->num_rg) { Atom *prev_radio_groups = names->radio_groups; - names->radio_groups= _XkbTypedRealloc(names->radio_groups,nTotalRG, - Atom); + names->radio_groups= xrealloc(names->radio_groups, + nTotalRG * sizeof(Atom)); if (names->radio_groups!=NULL) { - _XkbClearElems(names->radio_groups,names->num_rg,nTotalRG-1, - Atom); + memset(&names->radio_groups[names->num_rg], 0, + (nTotalRG - names->num_rg) * sizeof(Atom)); } else { xfree(prev_radio_groups); } @@ -249,7 +251,7 @@ XkbAllocControls(XkbDescPtr xkb,unsigned which) return BadMatch; if (xkb->ctrls==NULL) { - xkb->ctrls= _XkbTypedCalloc(1,XkbControlsRec); + xkb->ctrls= xcalloc(1, sizeof(XkbControlsRec)); if (!xkb->ctrls) return BadAlloc; } @@ -275,7 +277,7 @@ XkbAllocIndicatorMaps(XkbDescPtr xkb) if (xkb==NULL) return BadMatch; if (xkb->indicators==NULL) { - xkb->indicators= _XkbTypedCalloc(1,XkbIndicatorRec); + xkb->indicators= xcalloc(1, sizeof(XkbIndicatorRec)); if (!xkb->indicators) return BadAlloc; } @@ -299,7 +301,7 @@ XkbAllocKeyboard(void) { XkbDescRec *xkb; - xkb = _XkbTypedCalloc(1,XkbDescRec); + xkb = xcalloc(1, sizeof(XkbDescRec)); if (xkb) xkb->device_spec= XkbUseCoreKbd; return xkb; diff --git a/xorg-server/xkb/XKBGAlloc.c b/xorg-server/xkb/XKBGAlloc.c index 752b11a94..0bab39a23 100644 --- a/xorg-server/xkb/XKBGAlloc.c +++ b/xorg-server/xkb/XKBGAlloc.c @@ -615,7 +615,7 @@ XkbGeometryPtr geom; Status rtrn; if (xkb->geom==NULL) { - xkb->geom= _XkbTypedCalloc(1,XkbGeometryRec); + xkb->geom= xcalloc(1, sizeof(XkbGeometryRec)); if (!xkb->geom) return BadAlloc; } diff --git a/xorg-server/xkb/XKBMAlloc.c b/xorg-server/xkb/XKBMAlloc.c index 728c0297b..fd12e2b6c 100644 --- a/xorg-server/xkb/XKBMAlloc.c +++ b/xorg-server/xkb/XKBMAlloc.c @@ -59,7 +59,7 @@ XkbClientMapPtr map; } if (xkb->map==NULL) { - map= _XkbTypedCalloc(1,XkbClientMapRec); + map= xcalloc(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= _XkbTypedCalloc(nTotalTypes,XkbKeyTypeRec); + map->types= xcalloc(nTotalTypes, sizeof(XkbKeyTypeRec)); if (map->types==NULL) return BadAlloc; map->num_types= 0; @@ -77,7 +77,7 @@ XkbClientMapPtr map; else if (map->size_types<nTotalTypes) { XkbKeyTypeRec *prev_types = map->types; - map->types= _XkbTypedRealloc(map->types,nTotalTypes,XkbKeyTypeRec); + map->types= xrealloc(map->types,nTotalTypes * sizeof(XkbKeyTypeRec)); if (map->types==NULL) { xfree(prev_types); map->num_types= map->size_types= 0; @@ -92,7 +92,7 @@ XkbClientMapPtr map; int nKeys= XkbNumKeys(xkb); if (map->syms==NULL) { map->size_syms= (nKeys*15)/10; - map->syms= _XkbTypedCalloc(map->size_syms,KeySym); + map->syms= xcalloc(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= _XkbTypedCalloc(i,XkbSymMapRec); + map->key_sym_map= xcalloc(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= _XkbTypedCalloc(i,unsigned char); + map->modmap= xcalloc(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= _XkbTypedCalloc(1,XkbServerMapRec); + map= xcalloc(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= _XkbTypedCalloc(i,unsigned char); + map->explicit= xcalloc(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= _XkbTypedCalloc((nNewActions+1),XkbAction); + map->acts= xcalloc((nNewActions+1), sizeof(XkbAction)); if (map->acts==NULL) return BadAlloc; map->num_acts= 1; @@ -170,7 +170,7 @@ XkbServerMapPtr map; unsigned need; XkbAction *prev_acts = map->acts; need= map->num_acts+nNewActions; - map->acts= _XkbTypedRealloc(map->acts,need,XkbAction); + map->acts= xrealloc(map->acts,need * sizeof(XkbAction)); if (map->acts==NULL) { xfree(prev_acts); map->num_acts= map->size_acts= 0; @@ -182,7 +182,7 @@ XkbServerMapPtr map; } if (map->key_acts==NULL) { i= xkb->max_key_code+1; - map->key_acts= _XkbTypedCalloc(i,unsigned short); + map->key_acts= xcalloc(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= _XkbTypedCalloc(i,XkbBehavior); + map->behaviors= xcalloc(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= _XkbTypedCalloc(i,unsigned short); + map->vmodmap= xcalloc(i, sizeof(unsigned short)); if (map->vmodmap==NULL) return BadAlloc; } @@ -235,20 +235,20 @@ XkbCopyKeyType(XkbKeyTypePtr from,XkbKeyTypePtr into) } *into= *from; if ((from->map)&&(into->map_count>0)) { - into->map= _XkbTypedCalloc(into->map_count,XkbKTMapEntryRec); + into->map= xcalloc(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= _XkbTypedCalloc(into->map_count,XkbModsRec); + into->preserve= xcalloc(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= _XkbTypedCalloc(into->num_levels,Atom); + into->level_names= xcalloc(into->num_levels, sizeof(Atom)); if (!into->level_names) return BadAlloc; memcpy(into->level_names,from->level_names, @@ -310,7 +310,7 @@ KeyCode matchingKeys[XkbMaxKeyCount],nMatchingKeys; XkbKTMapEntryRec *prev_map = type->map; if ((map_count>type->map_count)||(type->map==NULL)) - type->map=_XkbTypedRealloc(type->map,map_count,XkbKTMapEntryRec); + type->map = xrealloc(type->map,map_count * sizeof(XkbKTMapEntryRec)); if (!type->map) { if (prev_map) xfree(prev_map); @@ -320,8 +320,8 @@ KeyCode matchingKeys[XkbMaxKeyCount],nMatchingKeys; XkbModsRec *prev_preserve = type->preserve; if ((map_count>type->map_count)||(type->preserve==NULL)) { - type->preserve= _XkbTypedRealloc(type->preserve,map_count, - XkbModsRec); + type->preserve = xrealloc(type->preserve, + map_count * sizeof(XkbModsRec)); } if (!type->preserve) { if (prev_preserve) @@ -339,7 +339,8 @@ 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=_XkbTypedRealloc(type->level_names,new_num_lvls,Atom); + type->level_names = xrealloc(type->level_names, + new_num_lvls * sizeof(Atom)); if (!type->level_names) { if (prev_level_names) xfree(prev_level_names); @@ -396,7 +397,7 @@ KeyCode matchingKeys[XkbMaxKeyCount],nMatchingKeys; if (nResize>0) { int nextMatch; xkb->map->size_syms= (nTotal*15)/10; - newSyms = _XkbTypedCalloc(xkb->map->size_syms,KeySym); + newSyms = xcalloc(xkb->map->size_syms, sizeof(KeySym)); if (newSyms==NULL) return BadAlloc; nextMatch= 0; @@ -498,7 +499,7 @@ KeySym *newSyms; return &xkb->map->syms[xkb->map->key_sym_map[key].offset]; } xkb->map->size_syms+= (needed>32?needed:32); - newSyms = _XkbTypedCalloc(xkb->map->size_syms,KeySym); + newSyms = xcalloc(xkb->map->size_syms, sizeof(KeySym)); if (newSyms==NULL) return NULL; newSyms[0]= NoSymbol; @@ -637,8 +638,8 @@ int tmp; if (xkb->map->key_sym_map) { XkbSymMapRec *prev_key_sym_map = xkb->map->key_sym_map; - xkb->map->key_sym_map= _XkbTypedRealloc(xkb->map->key_sym_map, - (maxKC+1),XkbSymMapRec); + xkb->map->key_sym_map = xrealloc(xkb->map->key_sym_map, + (maxKC+1) * sizeof(XkbSymMapRec)); if (!xkb->map->key_sym_map) { xfree(prev_key_sym_map); return BadAlloc; @@ -655,8 +656,8 @@ int tmp; if (xkb->map->modmap) { unsigned char *prev_modmap = xkb->map->modmap; - xkb->map->modmap= _XkbTypedRealloc(xkb->map->modmap, - (maxKC+1),unsigned char); + xkb->map->modmap = xrealloc(xkb->map->modmap, + (maxKC+1) * sizeof(unsigned char)); if (!xkb->map->modmap) { xfree(prev_modmap); return BadAlloc; @@ -674,8 +675,8 @@ int tmp; if (xkb->server->behaviors) { XkbBehavior *prev_behaviors = xkb->server->behaviors; - xkb->server->behaviors=_XkbTypedRealloc(xkb->server->behaviors, - (maxKC+1),XkbBehavior); + xkb->server->behaviors = xrealloc(xkb->server->behaviors, + (maxKC+1) * sizeof(XkbBehavior)); if (!xkb->server->behaviors) { xfree(prev_behaviors); return BadAlloc; @@ -692,8 +693,8 @@ int tmp; if (xkb->server->key_acts) { unsigned short *prev_key_acts = xkb->server->key_acts; - xkb->server->key_acts= _XkbTypedRealloc(xkb->server->key_acts, - (maxKC+1),unsigned short); + xkb->server->key_acts= xrealloc(xkb->server->key_acts, + (maxKC+1) * sizeof(unsigned short)); if (!xkb->server->key_acts) { xfree(prev_key_acts); return BadAlloc; @@ -710,8 +711,8 @@ int tmp; if (xkb->server->vmodmap) { unsigned short *prev_vmodmap = xkb->server->vmodmap; - xkb->server->vmodmap= _XkbTypedRealloc(xkb->server->vmodmap, - (maxKC+1),unsigned short); + xkb->server->vmodmap= xrealloc(xkb->server->vmodmap, + (maxKC+1) * sizeof(unsigned short)); if (!xkb->server->vmodmap) { xfree(prev_vmodmap); return BadAlloc; @@ -729,8 +730,8 @@ int tmp; if ((xkb->names)&&(xkb->names->keys)) { XkbKeyNameRec *prev_keys = xkb->names->keys; - xkb->names->keys= _XkbTypedRealloc(xkb->names->keys, - (maxKC+1),XkbKeyNameRec); + xkb->names->keys = xrealloc(xkb->names->keys, + (maxKC+1) * sizeof(XkbKeyNameRec)); if (!xkb->names->keys) { xfree(prev_keys); return BadAlloc; @@ -767,7 +768,7 @@ XkbAction *newActs; return &xkb->server->acts[xkb->server->key_acts[key]]; } xkb->server->size_acts= xkb->server->num_acts+needed+8; - newActs = _XkbTypedCalloc(xkb->server->size_acts,XkbAction); + newActs = xcalloc(xkb->server->size_acts, sizeof(XkbAction)); if (newActs==NULL) return NULL; newActs[0].type = XkbSA_NoAction; diff --git a/xorg-server/xkb/XKBMisc.c b/xorg-server/xkb/XKBMisc.c index 867906046..c1a17c082 100644 --- a/xorg-server/xkb/XKBMisc.c +++ b/xorg-server/xkb/XKBMisc.c @@ -162,7 +162,7 @@ BOOL replicated = FALSE; syms= &xkb_syms_rtrn[XKB_OFFSET(i,0)]; if ((nSyms[i]>1)&&(syms[1]==NoSymbol)&&(syms[0]!=NoSymbol)) { KeySym upper,lower; - XConvertCase(syms[0],&lower,&upper); + XkbConvertCase(syms[0],&lower,&upper); if (upper!=lower) { xkb_syms_rtrn[XKB_OFFSET(i,0)]= lower; xkb_syms_rtrn[XKB_OFFSET(i,1)]= upper; @@ -175,11 +175,11 @@ BOOL replicated = FALSE; } } if (((protected&(1<<i))==0)&&(types_inout[i]==XkbTwoLevelIndex)) { - if (IsKeypadKey(syms[0])||IsKeypadKey(syms[1])) + if (XkbKSIsKeypad(syms[0])||XkbKSIsKeypad(syms[1])) types_inout[i]= XkbKeypadIndex; else { KeySym upper,lower; - XConvertCase(syms[0],&lower,&upper); + XkbConvertCase(syms[0],&lower,&upper); if ((syms[0]==lower)&&(syms[1]==upper)) types_inout[i]= XkbAlphabeticIndex; } @@ -388,7 +388,7 @@ unsigned changed,tmp; nSyms= XkbKeyNumSyms(xkb,key); syms= XkbKeySymsPtr(xkb,key); if (nSyms>IBUF_SIZE) { - interps= _XkbTypedCalloc(nSyms,XkbSymInterpretPtr); + interps= xcalloc(nSyms, sizeof(XkbSymInterpretPtr)); if (interps==NULL) { interps= ibuf; nSyms= IBUF_SIZE; diff --git a/xorg-server/xkb/ddxList.c b/xorg-server/xkb/ddxList.c index 3ff3d81b4..bf4931127 100644 --- a/xorg-server/xkb/ddxList.c +++ b/xorg-server/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= _XkbTypedRealloc(list->pool,list->szPool,char); + list->pool= xrealloc(list->pool, list->szPool * sizeof(char)); if (!list->pool) return BadAlloc; } diff --git a/xorg-server/xkb/maprules.c b/xorg-server/xkb/maprules.c index 168c5277f..ec6fe3f01 100644 --- a/xorg-server/xkb/maprules.c +++ b/xorg-server/xkb/maprules.c @@ -474,7 +474,7 @@ int len; if ((!str1)||(!str2)) return str1; len= strlen(str1)+strlen(str2)+1; - str1= _XkbTypedRealloc(str1,len,char); + str1= xrealloc(str1,len * sizeof(char)); if (str1) strcat(str1,str2); return str1; @@ -864,12 +864,12 @@ XkbRF_AddRule(XkbRF_RulesPtr rules) if (rules->sz_rules<1) { rules->sz_rules= 16; rules->num_rules= 0; - rules->rules= _XkbTypedCalloc(rules->sz_rules,XkbRF_RuleRec); + rules->rules= xcalloc(rules->sz_rules, sizeof(XkbRF_RuleRec)); } else if (rules->num_rules>=rules->sz_rules) { rules->sz_rules*= 2; - rules->rules= _XkbTypedRealloc(rules->rules,rules->sz_rules, - XkbRF_RuleRec); + rules->rules= xrealloc(rules->rules, + rules->sz_rules * sizeof(XkbRF_RuleRec)); } if (!rules->rules) { rules->sz_rules= rules->num_rules= 0; @@ -886,12 +886,12 @@ XkbRF_AddGroup(XkbRF_RulesPtr rules) if (rules->sz_groups<1) { rules->sz_groups= 16; rules->num_groups= 0; - rules->groups= _XkbTypedCalloc(rules->sz_groups,XkbRF_GroupRec); + rules->groups= xcalloc(rules->sz_groups, sizeof(XkbRF_GroupRec)); } else if (rules->num_groups >= rules->sz_groups) { rules->sz_groups *= 2; - rules->groups= _XkbTypedRealloc(rules->groups,rules->sz_groups, - XkbRF_GroupRec); + rules->groups= xrealloc(rules->groups, + rules->sz_groups * sizeof(XkbRF_GroupRec)); } if (!rules->groups) { rules->sz_groups= rules->num_groups= 0; @@ -972,7 +972,7 @@ Bool ok; XkbRF_RulesPtr XkbRF_Create(void) { - return _XkbTypedCalloc(1, XkbRF_RulesRec); + return xcalloc(1, sizeof( XkbRF_RulesRec)); } /***====================================================================***/ diff --git a/xorg-server/xkb/xkb.c b/xorg-server/xkb/xkb.c index bfed11406..ec26d6e7c 100644 --- a/xorg-server/xkb/xkb.c +++ b/xorg-server/xkb/xkb.c @@ -2777,9 +2777,8 @@ _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= _XkbTypedRealloc(compat->sym_interpret, - compat->num_si, - XkbSymInterpretRec); + compat->sym_interpret= xrealloc(compat->sym_interpret, + compat->num_si * sizeof(XkbSymInterpretRec)); if (!compat->sym_interpret) { compat->num_si= 0; return BadAlloc; @@ -6460,7 +6459,7 @@ _XkbSetDeviceInfoCheck(ClientPtr client, DeviceIntPtr dev, nBtns= dev->button->numButtons; acts= dev->button->xkb_acts; if (acts==NULL) { - acts= _XkbTypedCalloc(nBtns,XkbAction); + acts= xcalloc(nBtns, sizeof(XkbAction)); if (!acts) return BadAlloc; dev->button->xkb_acts= acts; diff --git a/xorg-server/xkb/xkbActions.c b/xorg-server/xkb/xkbActions.c index b0ab427b6..75f3c722e 100644 --- a/xorg-server/xkb/xkbActions.c +++ b/xorg-server/xkb/xkbActions.c @@ -1016,7 +1016,7 @@ register int i; if (xkbi->szFilters==0) { xkbi->szFilters = 4; - xkbi->filters = _XkbTypedCalloc(xkbi->szFilters,XkbFilterRec); + xkbi->filters = xcalloc(xkbi->szFilters, sizeof(XkbFilterRec)); /* 6/21/93 (ef) -- XXX! deal with allocation failure */ } for (i=0;i<xkbi->szFilters;i++) { @@ -1026,9 +1026,8 @@ register int i; } } xkbi->szFilters*=2; - xkbi->filters= _XkbTypedRealloc(xkbi->filters, - xkbi->szFilters, - XkbFilterRec); + xkbi->filters= xrealloc(xkbi->filters, + xkbi->szFilters * sizeof(XkbFilterRec)); /* 6/21/93 (ef) -- XXX! deal with allocation failure */ bzero(&xkbi->filters[xkbi->szFilters/2], (xkbi->szFilters/2)*sizeof(XkbFilterRec)); diff --git a/xorg-server/xkb/xkbEvents.c b/xorg-server/xkb/xkbEvents.c index 8fb49c1d8..58f75b306 100644 --- a/xorg-server/xkb/xkbEvents.c +++ b/xorg-server/xkb/xkbEvents.c @@ -1041,7 +1041,7 @@ XkbInterestPtr interest; return ((interest->resource==id)?interest:NULL); interest = interest->next; } - interest = _XkbTypedAlloc(XkbInterestRec); + interest = xalloc(sizeof(XkbInterestRec)); bzero(interest,sizeof(XkbInterestRec)); if (interest) { interest->dev = dev; diff --git a/xorg-server/xkb/xkbLEDs.c b/xorg-server/xkb/xkbLEDs.c index 6ca80d784..3cf24e33f 100644 --- a/xorg-server/xkb/xkbLEDs.c +++ b/xorg-server/xkb/xkbLEDs.c @@ -524,7 +524,7 @@ Bool checkNames; sli= NULL; checkAccel= checkNames= False; if ((kf!=NULL)&&(kf->xkb_sli==NULL)) { - kf->xkb_sli= sli= _XkbTypedCalloc(1,XkbSrvLedInfoRec); + kf->xkb_sli= sli= xcalloc(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= _XkbTypedCalloc(1,XkbSrvLedInfoRec); + lf->xkb_sli= sli= xcalloc(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= _XkbTypedCalloc(XkbNumIndicators,Atom); + sli->names= xcalloc(XkbNumIndicators, sizeof(Atom)); if ((sli->maps==NULL)&&(needed_parts&XkbXI_IndicatorMapsMask)) - sli->maps= _XkbTypedCalloc(XkbNumIndicators,XkbIndicatorMapRec); + sli->maps= xcalloc(XkbNumIndicators, sizeof(XkbIndicatorMapRec)); if (checkNames) { register unsigned i,bit; sli->namesPresent= 0; @@ -633,7 +633,7 @@ XkbCopySrvLedInfo( DeviceIntPtr from, if (!src) goto finish; - sli_new = _XkbTypedCalloc(1, XkbSrvLedInfoRec); + sli_new = xcalloc(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= _XkbTypedCalloc(XkbNumIndicators,Atom); - sli_new->maps= _XkbTypedCalloc(XkbNumIndicators,XkbIndicatorMapRec); + sli_new->names= xcalloc(XkbNumIndicators, sizeof(Atom)); + sli_new->maps= xcalloc(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= _XkbTypedCalloc(XkbNumIndicators,Atom); + sli->names= xcalloc(XkbNumIndicators, sizeof(Atom)); if ((sli->maps==NULL)&&(needed_parts&XkbXI_IndicatorMapsMask)) - sli->maps= _XkbTypedCalloc(XkbNumIndicators,XkbIndicatorMapRec); + sli->maps= xcalloc(XkbNumIndicators, sizeof(XkbIndicatorMapRec)); return sli; } diff --git a/xorg-server/xkb/xkbfmisc.c b/xorg-server/xkb/xkbfmisc.c index 52ef6362c..804ef2080 100644 --- a/xorg-server/xkb/xkbfmisc.c +++ b/xorg-server/xkb/xkbfmisc.c @@ -240,7 +240,7 @@ unsigned wantNames,wantConfig,wantDflts; if ((xkb!=NULL) && (old_names!=NULL)) { if (wantNames&XkmTypesMask) { if (old_names->types!=None) { - tmp= XkbAtomGetString(old_names->types); + tmp= NameForAtom(old_names->types); names->types= _XkbDupString(tmp); } else { @@ -250,7 +250,7 @@ unsigned wantNames,wantConfig,wantDflts; } if (wantNames&XkmCompatMapMask) { if (old_names->compat!=None) { - tmp= XkbAtomGetString(old_names->compat); + tmp= NameForAtom(old_names->compat); names->compat= _XkbDupString(tmp); } else wantDflts|= XkmCompatMapMask; @@ -259,13 +259,13 @@ unsigned wantNames,wantConfig,wantDflts; if (wantNames&XkmSymbolsMask) { if (old_names->symbols==None) return False; - tmp= XkbAtomGetString(old_names->symbols); + tmp= NameForAtom(old_names->symbols); names->symbols= _XkbDupString(tmp); complete|= XkmSymbolsMask; } if (wantNames&XkmKeyNamesMask) { if (old_names->keycodes!=None) { - tmp= XkbAtomGetString(old_names->keycodes); + tmp= NameForAtom(old_names->keycodes); names->keycodes= _XkbDupString(tmp); } else wantDflts|= XkmKeyNamesMask; @@ -274,7 +274,7 @@ unsigned wantNames,wantConfig,wantDflts; if (wantNames&XkmGeometryMask) { if (old_names->geometry==None) return False; - tmp= XkbAtomGetString(old_names->geometry); + tmp= NameForAtom(old_names->geometry); names->geometry= _XkbDupString(tmp); complete|= XkmGeometryMask; wantNames&= ~XkmGeometryMask; diff --git a/xorg-server/xkb/xkbout.c b/xorg-server/xkb/xkbout.c index b1c30d052..53f68411a 100644 --- a/xorg-server/xkb/xkbout.c +++ b/xorg-server/xkb/xkbout.c @@ -233,7 +233,7 @@ WriteXKBIndicatorMap( FILE * file, void * priv) { - fprintf(file," indicator \"%s\" {\n",XkbAtomGetString(name)); + fprintf(file," indicator \"%s\" {\n",NameForAtom(name)); if (led->flags&XkbIM_NoExplicit) fprintf(file," !allowExplicit;\n"); if (led->flags&XkbIM_LEDDrivesKB) diff --git a/xorg-server/xkb/xkbtext.c b/xorg-server/xkb/xkbtext.c index 95ad01378..324254dd3 100644 --- a/xorg-server/xkb/xkbtext.c +++ b/xorg-server/xkb/xkbtext.c @@ -74,7 +74,7 @@ XkbAtomText(Atom atm,unsigned format) const char *atmstr; char *rtrn,*tmp; - atmstr = XkbAtomGetString(atm); + atmstr = NameForAtom(atm); if (atmstr != NULL) { int len; len= strlen(atmstr)+1; @@ -118,7 +118,7 @@ char numBuf[20]; if (ndx>=XkbNumVirtualMods) tmp= "illegal"; else if (vmodNames&&(vmodNames[ndx]!=None)) - tmp= XkbAtomGetString(vmodNames[ndx]); + tmp= NameForAtom(vmodNames[ndx]); if (tmp==NULL) { sprintf(numBuf,"%d",ndx); tmp = numBuf; |