Remove devPrivates init and delete callback lists.
XSELinux was the only consumer of these interfaces and it no longer needs them. Signed-off-by: Keith Packard <keithp@keithp.com> Reviewed-by: Jamey Sharp <jamey@minilop.net>
This commit is contained in:
parent
c9e7ca4404
commit
f2a0c324e3
|
@ -47,8 +47,6 @@ struct _Private {
|
||||||
typedef struct _PrivateDesc {
|
typedef struct _PrivateDesc {
|
||||||
DevPrivateKey key;
|
DevPrivateKey key;
|
||||||
unsigned size;
|
unsigned size;
|
||||||
CallbackListPtr initfuncs;
|
|
||||||
CallbackListPtr deletefuncs;
|
|
||||||
} PrivateDescRec;
|
} PrivateDescRec;
|
||||||
|
|
||||||
#define PRIV_MAX 256
|
#define PRIV_MAX 256
|
||||||
|
@ -102,7 +100,6 @@ pointer *
|
||||||
dixAllocatePrivate(PrivateRec **privates, const DevPrivateKey key)
|
dixAllocatePrivate(PrivateRec **privates, const DevPrivateKey key)
|
||||||
{
|
{
|
||||||
PrivateDescRec *item = findItem(key);
|
PrivateDescRec *item = findItem(key);
|
||||||
PrivateCallbackRec calldata;
|
|
||||||
PrivateRec *ptr;
|
PrivateRec *ptr;
|
||||||
pointer value;
|
pointer value;
|
||||||
int oldsize, newsize;
|
int oldsize, newsize;
|
||||||
|
@ -144,10 +141,6 @@ dixAllocatePrivate(PrivateRec **privates, const DevPrivateKey key)
|
||||||
ptr->value = value;
|
ptr->value = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
calldata.key = key;
|
|
||||||
calldata.value = &ptr->value;
|
|
||||||
CallCallbacks(&item->initfuncs, &calldata);
|
|
||||||
|
|
||||||
return &ptr->value;
|
return &ptr->value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -202,16 +195,10 @@ void
|
||||||
dixFreePrivates(PrivateRec *privates)
|
dixFreePrivates(PrivateRec *privates)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
PrivateCallbackRec calldata;
|
|
||||||
|
|
||||||
if (privates)
|
if (privates)
|
||||||
for (i = 1; i < privates->state; i++)
|
for (i = 1; i < privates->state; i++)
|
||||||
if (privates[i].state) {
|
if (privates[i].state) {
|
||||||
/* call the delete callbacks */
|
|
||||||
calldata.key = items[i].key;
|
|
||||||
calldata.value = &privates[i].value;
|
|
||||||
CallCallbacks(&items[i].deletefuncs, &calldata);
|
|
||||||
|
|
||||||
/* free pre-allocated memory */
|
/* free pre-allocated memory */
|
||||||
if (items[i].size)
|
if (items[i].size)
|
||||||
free(privates[i].value);
|
free(privates[i].value);
|
||||||
|
@ -220,31 +207,6 @@ dixFreePrivates(PrivateRec *privates)
|
||||||
free(privates);
|
free(privates);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* Callback registration
|
|
||||||
*/
|
|
||||||
int
|
|
||||||
dixRegisterPrivateInitFunc(const DevPrivateKey key,
|
|
||||||
CallbackProcPtr callback, pointer data)
|
|
||||||
{
|
|
||||||
PrivateDescRec *item = findItem(key);
|
|
||||||
if (!item)
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
return AddCallback(&item->initfuncs, callback, data);
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
dixRegisterPrivateDeleteFunc(const DevPrivateKey key,
|
|
||||||
CallbackProcPtr callback, pointer data)
|
|
||||||
{
|
|
||||||
PrivateDescRec *item = findItem(key);
|
|
||||||
if (!item)
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
return AddCallback(&item->deletefuncs, callback, data);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Table of devPrivates offsets */
|
/* Table of devPrivates offsets */
|
||||||
static const int offsetDefaults[] = {
|
static const int offsetDefaults[] = {
|
||||||
-1, /* RT_NONE */
|
-1, /* RT_NONE */
|
||||||
|
@ -304,8 +266,6 @@ dixResetPrivates(void)
|
||||||
for (i = 1; i < nextPriv; i++) {
|
for (i = 1; i < nextPriv; i++) {
|
||||||
*items[i].key = 0;
|
*items[i].key = 0;
|
||||||
items[i].size = 0;
|
items[i].size = 0;
|
||||||
DeleteCallbackList(&items[i].initfuncs);
|
|
||||||
DeleteCallbackList(&items[i].deletefuncs);
|
|
||||||
}
|
}
|
||||||
nextPriv = 1;
|
nextPriv = 1;
|
||||||
|
|
||||||
|
|
|
@ -94,33 +94,7 @@ extern _X_EXPORT int
|
||||||
dixSetPrivate(PrivateRec **privates, const DevPrivateKey key, pointer val);
|
dixSetPrivate(PrivateRec **privates, const DevPrivateKey key, pointer val);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Register callbacks to be called on private allocation/freeing.
|
* Unassociates all keys from 'privates' and frees all private data automatically
|
||||||
* The calldata argument to the callbacks is a PrivateCallbackPtr.
|
|
||||||
*/
|
|
||||||
typedef struct _PrivateCallback {
|
|
||||||
DevPrivateKey key; /* private registration key */
|
|
||||||
pointer *value; /* address of private pointer */
|
|
||||||
} PrivateCallbackRec;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Register a function to be called when dixAllocPrivate successfully associates
|
|
||||||
* 'key' with a new PrivateRec.
|
|
||||||
*/
|
|
||||||
extern _X_EXPORT int
|
|
||||||
dixRegisterPrivateInitFunc(const DevPrivateKey key,
|
|
||||||
CallbackProcPtr callback, pointer userdata);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Register a function to be called when dixFreePrivates unassociates 'key' with
|
|
||||||
* a PrivateRec.
|
|
||||||
*/
|
|
||||||
extern _X_EXPORT int
|
|
||||||
dixRegisterPrivateDeleteFunc(const DevPrivateKey key,
|
|
||||||
CallbackProcPtr callback, pointer userdata);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Unassociates all keys from 'privates', calls the callbacks registered with
|
|
||||||
* dixRegisterPrivateDeleteFunc, and frees all private data automatically
|
|
||||||
* allocated via dixRequestPrivate.
|
* allocated via dixRequestPrivate.
|
||||||
*/
|
*/
|
||||||
extern _X_EXPORT void
|
extern _X_EXPORT void
|
||||||
|
|
Loading…
Reference in New Issue