Merge remote-tracking branch 'ajax/dead-code'

This commit is contained in:
Keith Packard 2014-10-09 15:08:31 +02:00
commit d634ecdf82
7 changed files with 51 additions and 217 deletions

View File

@ -1214,63 +1214,6 @@ QueryMinMaxKeyCodes(KeyCode *minCode, KeyCode *maxCode)
}
}
/* Notably, this function does not expand the destination's keycode range, or
* notify clients. */
Bool
SetKeySymsMap(KeySymsPtr dst, KeySymsPtr src)
{
int i, j;
KeySym *tmp;
int rowDif = src->minKeyCode - dst->minKeyCode;
/* if keysym map size changes, grow map first */
if (src->mapWidth < dst->mapWidth) {
for (i = src->minKeyCode; i <= src->maxKeyCode; i++) {
#define SI(r, c) (((r - src->minKeyCode) * src->mapWidth) + (c))
#define DI(r, c) (((r - dst->minKeyCode) * dst->mapWidth) + (c))
for (j = 0; j < src->mapWidth; j++)
dst->map[DI(i, j)] = src->map[SI(i, j)];
for (j = src->mapWidth; j < dst->mapWidth; j++)
dst->map[DI(i, j)] = NoSymbol;
#undef SI
#undef DI
}
return TRUE;
}
else if (src->mapWidth > dst->mapWidth) {
i = sizeof(KeySym) * src->mapWidth *
(dst->maxKeyCode - dst->minKeyCode + 1);
tmp = calloc(sizeof(KeySym), i);
if (!tmp)
return FALSE;
if (dst->map) {
for (i = 0; i <= dst->maxKeyCode - dst->minKeyCode; i++)
memmove(&tmp[i * src->mapWidth], &dst->map[i * dst->mapWidth],
dst->mapWidth * sizeof(KeySym));
free(dst->map);
}
dst->mapWidth = src->mapWidth;
dst->map = tmp;
}
else if (!dst->map) {
i = sizeof(KeySym) * src->mapWidth *
(dst->maxKeyCode - dst->minKeyCode + 1);
tmp = calloc(sizeof(KeySym), i);
if (!tmp)
return FALSE;
dst->map = tmp;
dst->mapWidth = src->mapWidth;
}
memmove(&dst->map[rowDif * dst->mapWidth], src->map,
(src->maxKeyCode - src->minKeyCode + 1) *
dst->mapWidth * sizeof(KeySym));
return TRUE;
}
Bool
InitButtonClassDeviceStruct(DeviceIntPtr dev, int numButtons, Atom *labels,
CARD8 *map)

View File

@ -214,18 +214,6 @@ typedef struct {
DevPrivateKeyRec gcPrivateKeyRec;
} ExaScreenPrivRec, *ExaScreenPrivPtr;
/*
* This is the only completely portable way to
* compute this info.
*/
#ifndef BitsPerPixel
#define BitsPerPixel(d) (\
PixmapWidthPaddingInfo[d].notPower2 ? \
(PixmapWidthPaddingInfo[d].bytesPerPixel * 8) : \
((1 << PixmapWidthPaddingInfo[d].padBytesLog2) * 8 / \
(PixmapWidthPaddingInfo[d].padRoundUp+1)))
#endif
extern DevPrivateKeyRec exaScreenPrivateKeyRec;
#define exaScreenPrivateKey (&exaScreenPrivateKeyRec)

View File

@ -330,19 +330,6 @@ typedef struct _KdPointerMatrix {
int matrix[2][3];
} KdPointerMatrix;
/*
* This is the only completely portable way to
* compute this info.
*/
#ifndef BitsPerPixel
#define BitsPerPixel(d) (\
PixmapWidthPaddingInfo[d].notPower2 ? \
(PixmapWidthPaddingInfo[d].bytesPerPixel * 8) : \
((1 << PixmapWidthPaddingInfo[d].padBytesLog2) * 8 / \
(PixmapWidthPaddingInfo[d].padRoundUp+1)))
#endif
extern DevPrivateKeyRec kdScreenPrivateKeyRec;
#define kdScreenPrivateKey (&kdScreenPrivateKeyRec)

View File

@ -380,26 +380,10 @@ ddxProcessArgument(int argc, char *argv[], int i)
return 0;
}
static DevPrivateKeyRec cmapScrPrivateKeyRec;
#define cmapScrPrivateKey (&cmapScrPrivateKeyRec)
#define GetInstalledColormap(s) ((ColormapPtr) dixLookupPrivate(&(s)->devPrivates, cmapScrPrivateKey))
#define SetInstalledColormap(s,c) (dixSetPrivate(&(s)->devPrivates, cmapScrPrivateKey, c))
static int
vfbListInstalledColormaps(ScreenPtr pScreen, Colormap * pmaps)
{
/* By the time we are processing requests, we can guarantee that there
* is always a colormap installed */
*pmaps = GetInstalledColormap(pScreen)->mid;
return 1;
}
static void
vfbInstallColormap(ColormapPtr pmap)
{
ColormapPtr oldpmap = GetInstalledColormap(pmap->pScreen);
ColormapPtr oldpmap = GetInstalledmiColormap(pmap->pScreen);
if (pmap != oldpmap) {
int entries;
@ -410,11 +394,7 @@ vfbInstallColormap(ColormapPtr pmap)
xColorItem *defs;
int i;
if (oldpmap != (ColormapPtr) None)
WalkTree(pmap->pScreen, TellLostMap, (char *) &oldpmap->mid);
/* Install pmap */
SetInstalledColormap(pmap->pScreen, pmap);
WalkTree(pmap->pScreen, TellGainedMap, (char *) &pmap->mid);
miInstallColormap(pmap);
entries = pmap->pVisual->ColormapEntries;
pXWDHeader = vfbScreens[pmap->pScreen->myNum].pXWDHeader;
@ -451,29 +431,13 @@ vfbInstallColormap(ColormapPtr pmap)
}
}
static void
vfbUninstallColormap(ColormapPtr pmap)
{
ColormapPtr curpmap = GetInstalledColormap(pmap->pScreen);
if (pmap == curpmap) {
if (pmap->mid != pmap->pScreen->defColormap) {
dixLookupResourceByType((void **) &curpmap,
pmap->pScreen->defColormap,
RT_COLORMAP, serverClient,
DixInstallAccess);
(*pmap->pScreen->InstallColormap) (curpmap);
}
}
}
static void
vfbStoreColors(ColormapPtr pmap, int ndef, xColorItem * pdefs)
{
XWDColor *pXWDCmap;
int i;
if (pmap != GetInstalledColormap(pmap->pScreen)) {
if (pmap != GetInstalledmiColormap(pmap->pScreen)) {
return;
}
@ -761,17 +725,9 @@ static Bool
vfbCloseScreen(ScreenPtr pScreen)
{
vfbScreenInfoPtr pvfb = &vfbScreens[pScreen->myNum];
int i;
pScreen->CloseScreen = pvfb->closeScreen;
/*
* XXX probably lots of stuff to clean. For now,
* clear installed colormaps so that server reset works correctly.
*/
for (i = 0; i < screenInfo.numScreens; i++)
SetInstalledColormap(screenInfo.screens[i], NULL);
/*
* fb overwrites miCloseScreen, so do this here
*/
@ -790,9 +746,6 @@ vfbScreenInit(ScreenPtr pScreen, int argc, char **argv)
int ret;
char *pbits;
if (!dixRegisterPrivateKey(&cmapScrPrivateKeyRec, PRIVATE_SCREEN, 0))
return FALSE;
if (dpix == 0)
dpix = 100;
@ -859,8 +812,6 @@ vfbScreenInit(ScreenPtr pScreen, int argc, char **argv)
return FALSE;
pScreen->InstallColormap = vfbInstallColormap;
pScreen->UninstallColormap = vfbUninstallColormap;
pScreen->ListInstalledColormaps = vfbListInstalledColormaps;
pScreen->SaveScreen = vfbSaveScreen;
pScreen->StoreColors = vfbStoreColors;

View File

@ -308,14 +308,6 @@ xf86CreateRootWindow(WindowPtr pWin)
DebugF("xf86CreateRootWindow(%p)\n", pWin);
if (pScreen->CreateWindow != xf86CreateRootWindow) {
/* Can't find hook we are hung on */
xf86DrvMsg(pScreen->myNum, X_WARNING /* X_ERROR */ ,
"xf86CreateRootWindow %p called when not in pScreen->CreateWindow %p n",
(void *) xf86CreateRootWindow,
(void *) pScreen->CreateWindow);
}
/* Unhook this function ... */
pScreen->CreateWindow = create_window;
dixSetPrivate(&pScreen->devPrivates, xf86CreateRootWindowKey, NULL);
@ -343,15 +335,8 @@ xf86CreateRootWindow(WindowPtr pWin)
ret &= (err == Success);
}
else {
xf86Msg(X_ERROR, "xf86CreateRootWindow unexpectedly called with "
"non-root window %p (parent %p)\n",
(void *) pWin, (void *) pWin->parent);
ret = FALSE;
}
}
DebugF("xf86CreateRootWindow() returns %d\n", ret);
return ret;
}

View File

@ -77,12 +77,8 @@ typedef struct _pattern {
static char *FindModule(const char *, const char *, const char **, PatternPtr);
static Bool CheckVersion(const char *, XF86ModuleVersionInfo *,
const XF86ModReqInfo *);
static void UnloadModuleOrDriver(ModuleDescPtr mod);
static char *LoaderGetCanonicalName(const char *, PatternPtr);
static void RemoveChild(ModuleDescPtr);
static ModuleDescPtr doLoadModule(const char *, const char *, const char **,
const char **, void *,
const XF86ModReqInfo *, int *, int *);
const ModuleVersions LoaderVersionInfo = {
XORG_VERSION_CURRENT,
@ -754,8 +750,8 @@ LoadSubModule(void *_parent, const char *module,
return NULL;
}
submod = doLoadModule(module, NULL, subdirlist, patternlist, options,
modreq, errmaj, errmin);
submod = LoadModule(module, NULL, subdirlist, patternlist, options,
modreq, errmaj, errmin);
if (submod && submod != (ModuleDescPtr) 1) {
parent->child = AddSibling(parent->child, submod);
submod->parent = parent;
@ -818,10 +814,47 @@ static const char *compiled_in_modules[] = {
NULL
};
static ModuleDescPtr
doLoadModule(const char *module, const char *path, const char **subdirlist,
const char **patternlist, void *options,
const XF86ModReqInfo * modreq, int *errmaj, int *errmin)
/*
* LoadModule: load a module
*
* module The module name. Normally this is not a filename but the
* module's "canonical name. A full pathname is, however,
* also accepted.
* path A comma separated list of module directories.
* subdirlist A NULL terminated list of subdirectories to search. When
* NULL, the default "stdSubdirs" list is used. The default
* list is also substituted for entries with value DEFAULT_LIST.
* patternlist A NULL terminated list of regular expressions used to find
* module filenames. Each regex should contain exactly one
* subexpression that corresponds to the canonical module name.
* When NULL, the default "stdPatterns" list is used. The
* default list is also substituted for entries with value
* DEFAULT_LIST.
* options A NULL terminated list of Options that are passed to the
* module's SetupProc function.
* modreq An optional XF86ModReqInfo* containing
* version/ABI/vendor-ABI requirements to check for when
* loading the module. The following fields of the
* XF86ModReqInfo struct are checked:
* majorversion - must match the module's majorversion exactly
* minorversion - the module's minorversion must be >= this
* patchlevel - the module's minorversion.patchlevel must be
* >= this. Patchlevel is ignored when
* minorversion is not set.
* abiclass - (string) must match the module's abiclass
* abiversion - must be consistent with the module's
* abiversion (major equal, minor no older)
* moduleclass - string must match the module's moduleclass
* string
* "don't care" values are ~0 for numbers, and NULL for strings
* errmaj Major error return.
* errmin Minor error return.
*
*/
ModuleDescPtr
LoadModule(const char *module, const char *path, const char **subdirlist,
const char **patternlist, void *options,
const XF86ModReqInfo * modreq, int *errmaj, int *errmin)
{
XF86ModuleData *initdata = NULL;
char **pathlist = NULL;
@ -1009,61 +1042,11 @@ doLoadModule(const char *module, const char *path, const char **subdirlist,
return ret;
}
/*
* LoadModule: load a module
*
* module The module name. Normally this is not a filename but the
* module's "canonical name. A full pathname is, however,
* also accepted.
* path A comma separated list of module directories.
* subdirlist A NULL terminated list of subdirectories to search. When
* NULL, the default "stdSubdirs" list is used. The default
* list is also substituted for entries with value DEFAULT_LIST.
* patternlist A NULL terminated list of regular expressions used to find
* module filenames. Each regex should contain exactly one
* subexpression that corresponds to the canonical module name.
* When NULL, the default "stdPatterns" list is used. The
* default list is also substituted for entries with value
* DEFAULT_LIST.
* options A NULL terminated list of Options that are passed to the
* module's SetupProc function.
* modreq An optional XF86ModReqInfo* containing
* version/ABI/vendor-ABI requirements to check for when
* loading the module. The following fields of the
* XF86ModReqInfo struct are checked:
* majorversion - must match the module's majorversion exactly
* minorversion - the module's minorversion must be >= this
* patchlevel - the module's minorversion.patchlevel must be
* >= this. Patchlevel is ignored when
* minorversion is not set.
* abiclass - (string) must match the module's abiclass
* abiversion - must be consistent with the module's
* abiversion (major equal, minor no older)
* moduleclass - string must match the module's moduleclass
* string
* "don't care" values are ~0 for numbers, and NULL for strings
* errmaj Major error return.
* errmin Minor error return.
*
*/
ModuleDescPtr
LoadModule(const char *module, const char *path, const char **subdirlist,
const char **patternlist, void *options,
const XF86ModReqInfo * modreq, int *errmaj, int *errmin)
{
return doLoadModule(module, path, subdirlist, patternlist, options,
modreq, errmaj, errmin);
}
void
UnloadModule(void *mod)
UnloadModule(void *_mod)
{
UnloadModuleOrDriver((ModuleDescPtr) mod);
}
ModuleDescPtr mod = _mod;
static void
UnloadModuleOrDriver(ModuleDescPtr mod)
{
if (mod == (ModuleDescPtr) 1)
return;
@ -1083,9 +1066,9 @@ UnloadModuleOrDriver(ModuleDescPtr mod)
}
if (mod->child)
UnloadModuleOrDriver(mod->child);
UnloadModule(mod->child);
if (mod->sib)
UnloadModuleOrDriver(mod->sib);
UnloadModule(mod->sib);
free(mod->path);
free(mod->name);
free(mod);
@ -1100,7 +1083,7 @@ UnloadSubModule(void *_mod)
if (mod == (ModuleDescPtr) 1)
return;
RemoveChild(mod);
UnloadModuleOrDriver(mod);
UnloadModule(mod);
}
static void

View File

@ -287,9 +287,6 @@ extern _X_EXPORT int dixLookupDevice(DeviceIntPtr * /* dev */ ,
extern _X_EXPORT void QueryMinMaxKeyCodes(KeyCode * /*minCode */ ,
KeyCode * /*maxCode */ );
extern _X_EXPORT Bool SetKeySymsMap(KeySymsPtr /*dst */ ,
KeySymsPtr /*src */ );
extern _X_EXPORT Bool InitButtonClassDeviceStruct(DeviceIntPtr /*device */ ,
int /*numButtons */ ,
Atom * /* labels */ ,