Merge remote branch 'whot/for-keith'

This commit is contained in:
Keith Packard 2010-11-10 16:58:21 -08:00
commit 4ed4915bc0
28 changed files with 355 additions and 399 deletions

View File

@ -136,65 +136,30 @@ int SProcXIChangeHierarchy(ClientPtr client)
return (ProcXIChangeHierarchy(client)); return (ProcXIChangeHierarchy(client));
} }
#define SWAPIF(cmd) if (client->swapped) { cmd; } static int
add_master(ClientPtr client, xXIAddMasterInfo *c, int flags[MAXDEVICES])
int
ProcXIChangeHierarchy(ClientPtr client)
{ {
DeviceIntPtr ptr, keybd, XTestptr, XTestkeybd; DeviceIntPtr ptr, keybd, XTestptr, XTestkeybd;
xXIAnyHierarchyChangeInfo *any;
int required_len = sizeof(xXIChangeHierarchyReq);
char n;
int rc = Success;
int flags[MAXDEVICES] = {0};
REQUEST(xXIChangeHierarchyReq);
REQUEST_AT_LEAST_SIZE(xXIChangeHierarchyReq);
if (!stuff->num_changes)
return rc;
any = (xXIAnyHierarchyChangeInfo*)&stuff[1];
while(stuff->num_changes--)
{
SWAPIF(swapl(&any->type, n));
SWAPIF(swaps(&any->length, n));
required_len += any->length;
if ((stuff->length * 4) < required_len)
return BadLength;
switch(any->type)
{
case XIAddMaster:
{
xXIAddMasterInfo* c = (xXIAddMasterInfo*)any;
char* name; char* name;
int rc;
SWAPIF(swaps(&c->name_len, n));
name = calloc(c->name_len + 1, sizeof(char)); name = calloc(c->name_len + 1, sizeof(char));
strncpy(name, (char*)&c[1], c->name_len); strncpy(name, (char*)&c[1], c->name_len);
rc = AllocDevicePair(client, name, &ptr, &keybd, rc = AllocDevicePair(client, name, &ptr, &keybd,
CorePointerProc, CoreKeyboardProc, CorePointerProc, CoreKeyboardProc, TRUE);
TRUE);
if (rc != Success) if (rc != Success)
{
free(name);
goto unwind; goto unwind;
}
if (!c->send_core) if (!c->send_core)
ptr->coreEvents = keybd->coreEvents = FALSE; ptr->coreEvents = keybd->coreEvents = FALSE;
/* Allocate virtual slave devices for xtest events */ /* Allocate virtual slave devices for xtest events */
rc = AllocXTestDevice(client, name, &XTestptr, &XTestkeybd, rc = AllocXTestDevice(client, name, &XTestptr, &XTestkeybd, ptr, keybd);
ptr, keybd);
if (rc != Success) if (rc != Success)
{ {
DeleteInputDeviceRequest(ptr);
free(name); DeleteInputDeviceRequest(keybd);
goto unwind; goto unwind;
} }
@ -228,19 +193,23 @@ ProcXIChangeHierarchy(ClientPtr client)
flags[XTestptr->id] |= XISlaveAttached; flags[XTestptr->id] |= XISlaveAttached;
flags[XTestkeybd->id] |= XISlaveAttached; flags[XTestkeybd->id] |= XISlaveAttached;
unwind:
free(name); free(name);
return rc;
} }
break;
case XIRemoveMaster: static int
remove_master(ClientPtr client, xXIRemoveMasterInfo *r,
int flags[MAXDEVICES])
{ {
xXIRemoveMasterInfo* r = (xXIRemoveMasterInfo*)any; DeviceIntPtr ptr, keybd, XTestptr, XTestkeybd;
int rc = Success;
if (r->return_mode != XIAttachToMaster && if (r->return_mode != XIAttachToMaster &&
r->return_mode != XIFloating) r->return_mode != XIFloating)
return BadValue; return BadValue;
rc = dixLookupDevice(&ptr, r->deviceid, client, rc = dixLookupDevice(&ptr, r->deviceid, client, DixDestroyAccess);
DixDestroyAccess);
if (rc != Success) if (rc != Success)
goto unwind; goto unwind;
@ -252,8 +221,7 @@ ProcXIChangeHierarchy(ClientPtr client)
} }
/* XXX: For now, don't allow removal of VCP, VCK */ /* XXX: For now, don't allow removal of VCP, VCK */
if (ptr == inputInfo.pointer || if (ptr == inputInfo.pointer || ptr == inputInfo.keyboard)
ptr == inputInfo.keyboard)
{ {
rc = BadDevice; rc = BadDevice;
goto unwind; goto unwind;
@ -261,23 +229,16 @@ ProcXIChangeHierarchy(ClientPtr client)
ptr = GetMaster(ptr, MASTER_POINTER); ptr = GetMaster(ptr, MASTER_POINTER);
rc = dixLookupDevice(&ptr, rc = dixLookupDevice(&ptr, ptr->id, client, DixDestroyAccess);
ptr->id,
client,
DixDestroyAccess);
if (rc != Success) if (rc != Success)
goto unwind; goto unwind;
keybd = GetMaster(ptr, MASTER_KEYBOARD); keybd = GetMaster(ptr, MASTER_KEYBOARD);
rc = dixLookupDevice(&keybd, rc = dixLookupDevice(&keybd, keybd->id, client, DixDestroyAccess);
keybd->id,
client,
DixDestroyAccess);
if (rc != Success) if (rc != Success)
goto unwind; goto unwind;
XTestptr = GetXTestDevice(ptr); XTestptr = GetXTestDevice(ptr);
rc = dixLookupDevice(&XTestptr, XTestptr->id, client, rc = dixLookupDevice(&XTestptr, XTestptr->id, client, DixDestroyAccess);
DixDestroyAccess);
if (rc != Success) if (rc != Success)
goto unwind; goto unwind;
@ -295,8 +256,7 @@ ProcXIChangeHierarchy(ClientPtr client)
newptr, newptr,
newkeybd; newkeybd;
rc = dixLookupDevice(&newptr, r->return_pointer, rc = dixLookupDevice(&newptr, r->return_pointer, client, DixAddAccess);
client, DixAddAccess);
if (rc != Success) if (rc != Success)
goto unwind; goto unwind;
@ -319,9 +279,7 @@ ProcXIChangeHierarchy(ClientPtr client)
goto unwind; goto unwind;
} }
for (attached = inputInfo.devices; for (attached = inputInfo.devices; attached; attached = attached->next)
attached;
attached = attached->next)
{ {
if (!IsMaster(attached)) { if (!IsMaster(attached)) {
if (attached->u.master == ptr) if (attached->u.master == ptr)
@ -363,18 +321,22 @@ ProcXIChangeHierarchy(ClientPtr client)
flags[XTestkeybd->id] |= XISlaveRemoved; flags[XTestkeybd->id] |= XISlaveRemoved;
flags[keybd->id] |= XIMasterRemoved; flags[keybd->id] |= XIMasterRemoved;
flags[ptr->id] |= XIMasterRemoved; flags[ptr->id] |= XIMasterRemoved;
}
break;
case XIDetachSlave:
{
xXIDetachSlaveInfo* c = (xXIDetachSlaveInfo*)any;
rc = dixLookupDevice(&ptr, c->deviceid, client, unwind:
DixManageAccess); return rc;
}
static int
detach_slave(ClientPtr client, xXIDetachSlaveInfo *c, int flags[MAXDEVICES])
{
DeviceIntPtr dev;
int rc;
rc = dixLookupDevice(&dev, c->deviceid, client, DixManageAccess);
if (rc != Success) if (rc != Success)
goto unwind; goto unwind;
if (IsMaster(ptr)) if (IsMaster(dev))
{ {
client->errorValue = c->deviceid; client->errorValue = c->deviceid;
rc = BadDevice; rc = BadDevice;
@ -382,28 +344,33 @@ ProcXIChangeHierarchy(ClientPtr client)
} }
/* Don't allow changes to XTest Devices, these are fixed */ /* Don't allow changes to XTest Devices, these are fixed */
if (IsXTestDevice(ptr, NULL)) if (IsXTestDevice(dev, NULL))
{ {
client->errorValue = c->deviceid; client->errorValue = c->deviceid;
rc = BadDevice; rc = BadDevice;
goto unwind; goto unwind;
} }
AttachDevice(client, ptr, NULL); AttachDevice(client, dev, NULL);
flags[ptr->id] |= XISlaveDetached; flags[dev->id] |= XISlaveDetached;
unwind:
return rc;
} }
break;
case XIAttachSlave: static int
attach_slave(ClientPtr client, xXIAttachSlaveInfo *c,
int flags[MAXDEVICES])
{ {
xXIAttachSlaveInfo* c = (xXIAttachSlaveInfo*)any; DeviceIntPtr dev;
DeviceIntPtr newmaster; DeviceIntPtr newmaster;
int rc;
rc = dixLookupDevice(&ptr, c->deviceid, client, rc = dixLookupDevice(&dev, c->deviceid, client, DixManageAccess);
DixManageAccess);
if (rc != Success) if (rc != Success)
goto unwind; goto unwind;
if (IsMaster(ptr)) if (IsMaster(dev))
{ {
client->errorValue = c->deviceid; client->errorValue = c->deviceid;
rc = BadDevice; rc = BadDevice;
@ -411,15 +378,14 @@ ProcXIChangeHierarchy(ClientPtr client)
} }
/* Don't allow changes to XTest Devices, these are fixed */ /* Don't allow changes to XTest Devices, these are fixed */
if (IsXTestDevice(ptr, NULL)) if (IsXTestDevice(dev, NULL))
{ {
client->errorValue = c->deviceid; client->errorValue = c->deviceid;
rc = BadDevice; rc = BadDevice;
goto unwind; goto unwind;
} }
rc = dixLookupDevice(&newmaster, c->new_master, rc = dixLookupDevice(&newmaster, c->new_master, client, DixAddAccess);
client, DixAddAccess);
if (rc != Success) if (rc != Success)
goto unwind; goto unwind;
if (!IsMaster(newmaster)) if (!IsMaster(newmaster))
@ -429,16 +395,86 @@ ProcXIChangeHierarchy(ClientPtr client)
goto unwind; goto unwind;
} }
if (!((IsPointerDevice(newmaster) && if (!((IsPointerDevice(newmaster) && IsPointerDevice(dev)) ||
IsPointerDevice(ptr)) || (IsKeyboardDevice(newmaster) && IsKeyboardDevice(dev))))
(IsKeyboardDevice(newmaster) &&
IsKeyboardDevice(ptr))))
{ {
rc = BadDevice; rc = BadDevice;
goto unwind; goto unwind;
} }
AttachDevice(client, ptr, newmaster);
flags[ptr->id] |= XISlaveAttached; AttachDevice(client, dev, newmaster);
flags[dev->id] |= XISlaveAttached;
unwind:
return rc;
}
#define SWAPIF(cmd) if (client->swapped) { cmd; }
int
ProcXIChangeHierarchy(ClientPtr client)
{
xXIAnyHierarchyChangeInfo *any;
int required_len = sizeof(xXIChangeHierarchyReq);
char n;
int rc = Success;
int flags[MAXDEVICES] = {0};
REQUEST(xXIChangeHierarchyReq);
REQUEST_AT_LEAST_SIZE(xXIChangeHierarchyReq);
if (!stuff->num_changes)
return rc;
any = (xXIAnyHierarchyChangeInfo*)&stuff[1];
while(stuff->num_changes--)
{
SWAPIF(swapl(&any->type, n));
SWAPIF(swaps(&any->length, n));
required_len += any->length;
if ((stuff->length * 4) < required_len)
return BadLength;
switch(any->type)
{
case XIAddMaster:
{
xXIAddMasterInfo* c = (xXIAddMasterInfo*)any;
SWAPIF(swaps(&c->name_len, n));
rc = add_master(client, c, flags);
if (rc != Success)
goto unwind;
}
break;
case XIRemoveMaster:
{
xXIRemoveMasterInfo* r = (xXIRemoveMasterInfo*)any;
rc = remove_master(client, r, flags);
if (rc != Success)
goto unwind;
}
break;
case XIDetachSlave:
{
xXIDetachSlaveInfo* c = (xXIDetachSlaveInfo*)any;
rc = detach_slave(client, c, flags);
if (rc != Success)
goto unwind;
}
break;
case XIAttachSlave:
{
xXIAttachSlaveInfo* c = (xXIAttachSlaveInfo*)any;
rc = attach_slave(client, c, flags);
if (rc != Success)
goto unwind;
} }
break; break;
} }

View File

@ -45,11 +45,6 @@
See the evdev documentation for more information. See the evdev documentation for more information.
You will probably want to add the following option to the ServerFlags of
your xorg.conf:
Option "AllowEmptyInput" "True"
FIXME: Support tablets too. FIXME: Support tablets too.
TODO: I think its fixed, can't test TODO: I think its fixed, can't test

View File

@ -117,10 +117,7 @@ CreateGrab(
static void static void
FreeGrab(GrabPtr pGrab) FreeGrab(GrabPtr pGrab)
{ {
if (pGrab->modifiersDetail.pMask != NULL)
free(pGrab->modifiersDetail.pMask); free(pGrab->modifiersDetail.pMask);
if (pGrab->detail.pMask != NULL)
free(pGrab->detail.pMask); free(pGrab->detail.pMask);
if (pGrab->cursor) if (pGrab->cursor)

View File

@ -952,11 +952,9 @@ SetAccelerationProfile(
if(profile == NULL && profile_num != PROFILE_UNINITIALIZE) if(profile == NULL && profile_num != PROFILE_UNINITIALIZE)
return FALSE; return FALSE;
if(vel->profile_private != NULL){
/* Here one could free old profile-private data */ /* Here one could free old profile-private data */
free(vel->profile_private); free(vel->profile_private);
vel->profile_private = NULL; vel->profile_private = NULL;
}
/* Here one could init profile-private data */ /* Here one could init profile-private data */
vel->Profile = profile; vel->Profile = profile;
vel->statistics.profile_number = profile_num; vel->statistics.profile_number = profile_num;

View File

@ -1158,9 +1158,7 @@ __glXDRIscreenProbe(ScreenPtr pScreen)
*/ */
buffer_size = __glXGetExtensionString(screen->glx_enable_bits, NULL); buffer_size = __glXGetExtensionString(screen->glx_enable_bits, NULL);
if (buffer_size > 0) { if (buffer_size > 0) {
if (screen->base.GLXextensions != NULL) {
free(screen->base.GLXextensions); free(screen->base.GLXextensions);
}
screen->base.GLXextensions = xnfalloc(buffer_size); screen->base.GLXextensions = xnfalloc(buffer_size);
(void) __glXGetExtensionString(screen->glx_enable_bits, (void) __glXGetExtensionString(screen->glx_enable_bits,

View File

@ -792,9 +792,7 @@ __glXDRIscreenProbe(ScreenPtr pScreen)
*/ */
buffer_size = __glXGetExtensionString(screen->glx_enable_bits, NULL); buffer_size = __glXGetExtensionString(screen->glx_enable_bits, NULL);
if (buffer_size > 0) { if (buffer_size > 0) {
if (screen->base.GLXextensions != NULL) {
free(screen->base.GLXextensions); free(screen->base.GLXextensions);
}
screen->base.GLXextensions = xnfalloc(buffer_size); screen->base.GLXextensions = xnfalloc(buffer_size);
(void) __glXGetExtensionString(screen->glx_enable_bits, (void) __glXGetExtensionString(screen->glx_enable_bits,

View File

@ -346,9 +346,7 @@ int DoGetString(__GLXclientState *cl, GLbyte *pc, GLboolean need_swap)
cl->GLClientextensions); cl->GLClientextensions);
buf = __glXcombine_strings(buf1, buf = __glXcombine_strings(buf1,
cx->pGlxScreen->GLextensions); cx->pGlxScreen->GLextensions);
if (buf1 != NULL) {
free(buf1); free(buf1);
}
string = buf; string = buf;
} }
else if ( name == GL_VERSION ) { else if ( name == GL_VERSION ) {
@ -377,7 +375,6 @@ int DoGetString(__GLXclientState *cl, GLbyte *pc, GLboolean need_swap)
__GLX_SEND_HEADER(); __GLX_SEND_HEADER();
WriteToClient(client, length, (char *) string); WriteToClient(client, length, (char *) string);
if (buf != NULL)
free(buf); free(buf);
return Success; return Success;

View File

@ -2565,7 +2565,7 @@ int __glXClientInfo(__GLXclientState *cl, GLbyte *pc)
cl->GLClientmajorVersion = req->major; cl->GLClientmajorVersion = req->major;
cl->GLClientminorVersion = req->minor; cl->GLClientminorVersion = req->minor;
if (cl->GLClientextensions) free(cl->GLClientextensions); free(cl->GLClientextensions);
buf = (const char *)(req+1); buf = (const char *)(req+1);
cl->GLClientextensions = strdup(buf); cl->GLClientextensions = strdup(buf);

View File

@ -77,10 +77,10 @@ static void ResetClientState(int clientIndex)
Display **keep_be_displays; Display **keep_be_displays;
int i; int i;
if (cl->returnBuf) free(cl->returnBuf); free(cl->returnBuf);
if (cl->currentContexts) free(cl->currentContexts); free(cl->currentContexts);
if (cl->currentDrawables) free(cl->currentDrawables); free(cl->currentDrawables);
if (cl->largeCmdBuf) free(cl->largeCmdBuf); free(cl->largeCmdBuf);
for (i=0; i< screenInfo.numScreens; i++) { for (i=0; i< screenInfo.numScreens; i++) {
if (cl->be_displays[i]) if (cl->be_displays[i])
@ -97,7 +97,7 @@ static void ResetClientState(int clientIndex)
*/ */
cl->GLClientmajorVersion = 1; cl->GLClientmajorVersion = 1;
cl->GLClientminorVersion = 0; cl->GLClientminorVersion = 0;
if (cl->GLClientextensions) free(cl->GLClientextensions); free(cl->GLClientextensions);
memset(cl->be_displays, 0, screenInfo.numScreens * sizeof(Display *)); memset(cl->be_displays, 0, screenInfo.numScreens * sizeof(Display *));
} }
@ -222,10 +222,10 @@ GLboolean __glXFreeContext(__GLXcontext *cx)
{ {
if (cx->idExists || cx->isCurrent) return GL_FALSE; if (cx->idExists || cx->isCurrent) return GL_FALSE;
if (cx->feedbackBuf) free(cx->feedbackBuf); free(cx->feedbackBuf);
if (cx->selectBuf) free(cx->selectBuf); free(cx->selectBuf);
if (cx->real_ids) free(cx->real_ids); free(cx->real_ids);
if (cx->real_vids) free(cx->real_vids); free(cx->real_vids);
if (cx->pGlxPixmap) { if (cx->pGlxPixmap) {
/* /*

View File

@ -215,11 +215,8 @@ fakeUnmapFramebuffer (KdScreenInfo *screen)
{ {
FakePriv *priv = screen->card->driver; FakePriv *priv = screen->card->driver;
KdShadowFbFree (screen); KdShadowFbFree (screen);
if (priv->base)
{
free(priv->base); free(priv->base);
priv->base = 0; priv->base = NULL;
}
return TRUE; return TRUE;
} }

View File

@ -742,8 +742,6 @@ static OptionInfoRec FlagOptions[] = {
{0}, FALSE }, {0}, FALSE },
{ FLAG_AIGLX, "AIGLX", OPTV_BOOLEAN, { FLAG_AIGLX, "AIGLX", OPTV_BOOLEAN,
{0}, FALSE }, {0}, FALSE },
{ FLAG_ALLOW_EMPTY_INPUT, "AllowEmptyInput", OPTV_BOOLEAN,
{0}, FALSE },
{ FLAG_IGNORE_ABI, "IgnoreABI", OPTV_BOOLEAN, { FLAG_IGNORE_ABI, "IgnoreABI", OPTV_BOOLEAN,
{0}, FALSE }, {0}, FALSE },
{ FLAG_USE_DEFAULT_FONT_PATH, "UseDefaultFontPath", OPTV_BOOLEAN, { FLAG_USE_DEFAULT_FONT_PATH, "UseDefaultFontPath", OPTV_BOOLEAN,
@ -956,7 +954,6 @@ configServerFlags(XF86ConfFlagsPtr flagsconf, XF86OptionPtr layoutopts)
/* AllowEmptyInput is automatically true if we're hotplugging */ /* AllowEmptyInput is automatically true if we're hotplugging */
xf86Info.allowEmptyInput = (xf86Info.autoAddDevices && xf86Info.autoEnableDevices); xf86Info.allowEmptyInput = (xf86Info.autoAddDevices && xf86Info.autoEnableDevices);
xf86GetOptValBool(FlagOptions, FLAG_ALLOW_EMPTY_INPUT, &xf86Info.allowEmptyInput);
/* AEI on? Then we're not using kbd, so use the evdev rules set. */ /* AEI on? Then we're not using kbd, so use the evdev rules set. */
#if defined(linux) #if defined(linux)
@ -1437,8 +1434,10 @@ checkCoreInputDevices(serverLayoutPtr servlayoutp, Bool implicitLayout)
"reconfigure %s or disable AutoAddDevices.\n", "reconfigure %s or disable AutoAddDevices.\n",
config_backend, config_backend); config_backend, config_backend);
#else #else
xf86Msg(X_INFO, "Hotplugging is disabled and no input devices were configured.\n" xf86Msg(X_WARNING, "Hotplugging requested but the server was "
"\tTry disabling AllowEmptyInput.\n"); "compiled without a config backend. "
"No input devices were configured, the server "
"will start without any input devices.\n");
#endif #endif
} }
@ -2353,7 +2352,7 @@ checkInput(serverLayoutPtr layout, Bool implicit_layout) {
IDevPtr *current; IDevPtr *current;
if (!warned) if (!warned)
{ {
xf86Msg(X_WARNING, "AllowEmptyInput is on, devices using " xf86Msg(X_WARNING, "Hotplugging is on, devices using "
"drivers 'kbd', 'mouse' or 'vmmouse' will be disabled.\n"); "drivers 'kbd', 'mouse' or 'vmmouse' will be disabled.\n");
warned = TRUE; warned = TRUE;
} }

View File

@ -558,9 +558,6 @@ Default: off.
This tells the mousedrv(__drivermansuffix__) and vmmouse(__drivermansuffix__) This tells the mousedrv(__drivermansuffix__) and vmmouse(__drivermansuffix__)
drivers to not report failure if the mouse device can't be opened/initialised. drivers to not report failure if the mouse device can't be opened/initialised.
It has no effect on the evdev(__drivermansuffix__) or other drivers. It has no effect on the evdev(__drivermansuffix__) or other drivers.
The previous functionality of allowing the server to start up even if
the mouse device can't be opened/initialised is now handled by the
AllowEmptyInput option.
Default: false. Default: false.
.TP 7 .TP 7
.BI "Option \*qVTSysReq\*q \*q" boolean \*q .BI "Option \*qVTSysReq\*q \*q" boolean \*q
@ -677,12 +674,6 @@ default.
Allow modules built for a different, potentially incompatible version of Allow modules built for a different, potentially incompatible version of
the X server to load. Disabled by default. the X server to load. Disabled by default.
.TP 7 .TP 7
.BI "Option \*qAllowEmptyInput\*q \*q" boolean \*q
If enabled, don't add the standard keyboard and mouse drivers, if there are no
input devices in the config file. Enabled by default if AutoAddDevices and
AutoEnableDevices is enabled, otherwise disabled.
If AllowEmptyInput is on, devices using the kbd, mouse or vmmouse driver are ignored.
.TP 7
.BI "Option \*qAutoAddDevices\*q \*q" boolean \*q .BI "Option \*qAutoAddDevices\*q \*q" boolean \*q
If this option is disabled, then no devices will be added from HAL events. If this option is disabled, then no devices will be added from HAL events.
Enabled by default. Enabled by default.

View File

@ -2964,7 +2964,6 @@ xf86OutputSetEDID (xf86OutputPtr output, xf86MonPtr edid_mon)
int size; int size;
#endif #endif
if (output->MonInfo != NULL)
free(output->MonInfo); free(output->MonInfo);
output->MonInfo = edid_mon; output->MonInfo = edid_mon;

View File

@ -681,11 +681,8 @@ glxWinScreenProbe(ScreenPtr pScreen)
{ {
unsigned int buffer_size = __glXGetExtensionString(screen->glx_enable_bits, NULL); unsigned int buffer_size = __glXGetExtensionString(screen->glx_enable_bits, NULL);
if (buffer_size > 0) if (buffer_size > 0)
{
if (screen->base.GLXextensions != NULL)
{ {
free(screen->base.GLXextensions); free(screen->base.GLXextensions);
}
screen->base.GLXextensions = xnfalloc(buffer_size); screen->base.GLXextensions = xnfalloc(buffer_size);
__glXGetExtensionString(screen->glx_enable_bits, screen->base.GLXextensions); __glXGetExtensionString(screen->glx_enable_bits, screen->base.GLXextensions);

View File

@ -516,11 +516,8 @@ winGetPaletteDD (ScreenPtr pScreen, ColormapPtr pcmap)
pScreen->blackPixel = 0; pScreen->blackPixel = 0;
/* Free colormap */ /* Free colormap */
if (ppeColors != NULL)
{
free(ppeColors); free(ppeColors);
ppeColors = NULL; ppeColors = NULL;
}
/* Free the DC */ /* Free the DC */
if (hdc != NULL) if (hdc != NULL)

View File

@ -163,11 +163,8 @@ winDestroyPixmapNativeGDI (PixmapPtr pPixmap)
if (pPixmapPriv->hBitmap) DeleteObject (pPixmapPriv->hBitmap); if (pPixmapPriv->hBitmap) DeleteObject (pPixmapPriv->hBitmap);
/* Free the bitmap info header memory */ /* Free the bitmap info header memory */
if (pPixmapPriv->pbmih != NULL)
{
free(pPixmapPriv->pbmih); free(pPixmapPriv->pbmih);
pPixmapPriv->pbmih = NULL; pPixmapPriv->pbmih = NULL;
}
/* Free the pixmap memory */ /* Free the pixmap memory */
free (pPixmap); free (pPixmap);

View File

@ -215,7 +215,7 @@ void miAppendSpans(SpanGroup *spanGroup, SpanGroup *otherGroup, Spans *spans)
void miFreeSpanGroup(SpanGroup *spanGroup) void miFreeSpanGroup(SpanGroup *spanGroup)
{ {
if (spanGroup->group != NULL) free(spanGroup->group); free(spanGroup->group);
} }
static void QuickSortSpansX( static void QuickSortSpansX(

View File

@ -92,7 +92,6 @@ RootlessUpdateScreenPixmap(ScreenPtr pScreen)
rowbytes = PixmapBytePad(pScreen->width, pScreen->rootDepth); rowbytes = PixmapBytePad(pScreen->width, pScreen->rootDepth);
if (s->pixmap_data_size < rowbytes) { if (s->pixmap_data_size < rowbytes) {
if (s->pixmap_data != NULL)
free(s->pixmap_data); free(s->pixmap_data);
s->pixmap_data_size = rowbytes; s->pixmap_data_size = rowbytes;

View File

@ -1140,10 +1140,8 @@ FinishFrameResize(WindowPtr pWin, Bool gravity, int oldX, int oldY,
} }
} }
if (gResizeDeathBits != NULL) {
free(gResizeDeathBits); free(gResizeDeathBits);
gResizeDeathBits = NULL; gResizeDeathBits = NULL;
}
if (gravity) { if (gravity) {
pScreen->CopyWindow = gResizeOldCopyWindowProc; pScreen->CopyWindow = gResizeOldCopyWindowProc;

View File

@ -481,7 +481,6 @@ AuditFlush(OsTimerPtr timer, CARD32 now, pointer arg)
ErrorF("%slast message repeated %d times\n", ErrorF("%slast message repeated %d times\n",
prefix != NULL ? prefix : "", nrepeat); prefix != NULL ? prefix : "", nrepeat);
nrepeat = 0; nrepeat = 0;
if (prefix != NULL)
free(prefix); free(prefix);
return AUDIT_TIMEOUT; return AUDIT_TIMEOUT;
} else { } else {
@ -515,7 +514,6 @@ VAuditF(const char *f, va_list args)
nrepeat = 0; nrepeat = 0;
auditTimer = TimerSet(auditTimer, 0, AUDIT_TIMEOUT, AuditFlush, NULL); auditTimer = TimerSet(auditTimer, 0, AUDIT_TIMEOUT, AuditFlush, NULL);
} }
if (prefix != NULL)
free(prefix); free(prefix);
} }

View File

@ -15,8 +15,8 @@
*/ */
#ifdef HAVE_XORG_CONFIG_H #ifdef HAVE_DIX_CONFIG_H
#include <xorg-config.h> #include <dix-config.h>
#endif #endif
#include <sys/types.h> #include <sys/types.h>

View File

@ -14,8 +14,8 @@
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/ */
#ifdef HAVE_XORG_CONFIG_H #ifdef HAVE_DIX_CONFIG_H
#include <xorg-config.h> #include <dix-config.h>
#endif #endif
#include <sys/types.h> #include <sys/types.h>

View File

@ -321,17 +321,11 @@ miInitIndexed (ScreenPtr pScreen,
void void
miCloseIndexed (ScreenPtr pScreen, miCloseIndexed (ScreenPtr pScreen,
PictFormatPtr pFormat) PictFormatPtr pFormat)
{
if (pFormat->index.devPrivate)
{ {
free(pFormat->index.devPrivate); free(pFormat->index.devPrivate);
pFormat->index.devPrivate = 0; pFormat->index.devPrivate = NULL;
}
if (pFormat->index.pValues)
{
free(pFormat->index.pValues); free(pFormat->index.pValues);
pFormat->index.pValues = 0; pFormat->index.pValues = NULL;
}
} }
void void

View File

@ -1390,12 +1390,9 @@ SetPictureTransform (PicturePtr pPicture,
*pPicture->transform = *transform; *pPicture->transform = *transform;
} }
else else
{
if (pPicture->transform)
{ {
free(pPicture->transform); free(pPicture->transform);
pPicture->transform = 0; pPicture->transform = NULL;
}
} }
pPicture->serialNumber |= GC_CHANGE_SERIAL_BIT; pPicture->serialNumber |= GC_CHANGE_SERIAL_BIT;

View File

@ -212,13 +212,11 @@ XkbNamesPtr names;
register XkbKeyTypePtr type; register XkbKeyTypePtr type;
type= map->types; type= map->types;
for (i=0;i<map->num_types;i++,type++) { for (i=0;i<map->num_types;i++,type++) {
if (type->level_names!=NULL) {
free(type->level_names); free(type->level_names);
type->level_names = NULL; type->level_names = NULL;
} }
} }
} }
}
if ((which&XkbKeyNamesMask)&&(names->keys!=NULL)) { if ((which&XkbKeyNamesMask)&&(names->keys!=NULL)) {
free(names->keys); free(names->keys);
names->keys= NULL; names->keys= NULL;

View File

@ -50,10 +50,8 @@ _XkbFreeGeomLeafElems( Bool freeAll,
{ {
if ((freeAll)||(*elems==NULL)) { if ((freeAll)||(*elems==NULL)) {
*num_inout= *sz_inout= 0; *num_inout= *sz_inout= 0;
if (*elems!=NULL) {
free(*elems); free(*elems);
*elems = NULL; *elems = NULL;
}
return; return;
} }
@ -373,23 +371,17 @@ XkbDoodadPtr doodad= (XkbDoodadPtr)doodad_in;
switch (doodad->any.type) { switch (doodad->any.type) {
case XkbTextDoodad: case XkbTextDoodad:
{ {
if (doodad->text.text!=NULL) {
free(doodad->text.text); free(doodad->text.text);
doodad->text.text = NULL; doodad->text.text = NULL;
}
if (doodad->text.font!=NULL) {
free(doodad->text.font); free(doodad->text.font);
doodad->text.font = NULL; doodad->text.font = NULL;
} }
}
break; break;
case XkbLogoDoodad: case XkbLogoDoodad:
{ {
if (doodad->logo.logo_name!=NULL) {
free(doodad->logo.logo_name); free(doodad->logo.logo_name);
doodad->logo.logo_name = NULL; doodad->logo.logo_name = NULL;
} }
}
break; break;
} }
return; return;
@ -434,10 +426,8 @@ XkbFreeGeometry(XkbGeometryPtr geom,unsigned which,Bool freeMap)
if ((which&XkbGeomKeyAliasesMask)&&(geom->key_aliases!=NULL)) if ((which&XkbGeomKeyAliasesMask)&&(geom->key_aliases!=NULL))
XkbFreeGeomKeyAliases(geom,0,geom->num_key_aliases,TRUE); XkbFreeGeomKeyAliases(geom,0,geom->num_key_aliases,TRUE);
if (freeMap) { if (freeMap) {
if (geom->label_font!=NULL) {
free(geom->label_font); free(geom->label_font);
geom->label_font = NULL; geom->label_font = NULL;
}
free(geom); free(geom);
} }
return; return;

View File

@ -292,10 +292,8 @@ KeyCode matchingKeys[XkbMaxKeyCount],nMatchingKeys;
} }
type= &xkb->map->types[type_ndx]; type= &xkb->map->types[type_ndx];
if (map_count==0) { if (map_count==0) {
if (type->map!=NULL)
free(type->map); free(type->map);
type->map= NULL; type->map= NULL;
if (type->preserve!=NULL)
free(type->preserve); free(type->preserve);
type->preserve= NULL; type->preserve= NULL;
type->map_count= 0; type->map_count= 0;
@ -321,7 +319,7 @@ KeyCode matchingKeys[XkbMaxKeyCount],nMatchingKeys;
return BadAlloc; return BadAlloc;
} }
} }
else if (type->preserve!=NULL) { else {
free(type->preserve); free(type->preserve);
type->preserve = NULL; type->preserve = NULL;
} }
@ -807,31 +805,23 @@ XkbClientMapPtr map;
register int i; register int i;
XkbKeyTypePtr type; XkbKeyTypePtr type;
for (i=0,type=map->types;i<map->num_types;i++,type++) { for (i=0,type=map->types;i<map->num_types;i++,type++) {
if (type->map!=NULL) {
free(type->map); free(type->map);
type->map = NULL; type->map = NULL;
}
if (type->preserve!=NULL) {
free(type->preserve); free(type->preserve);
type->preserve = NULL; type->preserve = NULL;
}
type->map_count= 0; type->map_count= 0;
if (type->level_names!=NULL) {
free(type->level_names); free(type->level_names);
type->level_names = NULL; type->level_names = NULL;
} }
} }
}
free(map->types); free(map->types);
map->num_types= map->size_types= 0; map->num_types= map->size_types= 0;
map->types= NULL; map->types= NULL;
} }
} }
if (what&XkbKeySymsMask) { if (what&XkbKeySymsMask) {
if (map->key_sym_map!=NULL) {
free(map->key_sym_map); free(map->key_sym_map);
map->key_sym_map = NULL; map->key_sym_map = NULL;
}
if (map->syms!=NULL) { if (map->syms!=NULL) {
free(map->syms); free(map->syms);
map->size_syms= map->num_syms= 0; map->size_syms= map->num_syms= 0;
@ -864,10 +854,8 @@ XkbServerMapPtr map;
map->explicit= NULL; map->explicit= NULL;
} }
if (what&XkbKeyActionsMask) { if (what&XkbKeyActionsMask) {
if (map->key_acts!=NULL) {
free(map->key_acts); free(map->key_acts);
map->key_acts = NULL; map->key_acts = NULL;
}
if (map->acts!=NULL) { if (map->acts!=NULL) {
free(map->acts); free(map->acts);
map->num_acts= map->size_acts= 0; map->num_acts= map->size_acts= 0;

View File

@ -267,7 +267,6 @@ XkbDDXCompileKeymapByNames( XkbDescPtr xkb,
strncpy(nameRtrn,keymap,nameRtrnLen); strncpy(nameRtrn,keymap,nameRtrnLen);
nameRtrn[nameRtrnLen-1]= '\0'; nameRtrn[nameRtrnLen-1]= '\0';
} }
if (buf != NULL)
free(buf); free(buf);
return TRUE; return TRUE;
} }
@ -287,7 +286,6 @@ XkbDDXCompileKeymapByNames( XkbDescPtr xkb,
} }
if (nameRtrn) if (nameRtrn)
nameRtrn[0]= '\0'; nameRtrn[0]= '\0';
if (buf != NULL)
free(buf); free(buf);
return FALSE; return FALSE;
} }