devPrivates rework: use camelcase standard for name of key type.

This commit is contained in:
Eamon Walsh 2007-08-16 15:30:25 -04:00 committed by Eamon Walsh
parent 0a994d4f85
commit b2b7817497
3 changed files with 22 additions and 22 deletions

View File

@ -54,7 +54,7 @@ in this Software without prior written authorization from The Open Group.
static int SecurityErrorBase; /* first Security error number */ static int SecurityErrorBase; /* first Security error number */
static int SecurityEventBase; /* first Security event number */ static int SecurityEventBase; /* first Security event number */
static devprivate_key_t stateKey; static const DevPrivateKey stateKey = &stateKey;
/* this is what we store as client security state */ /* this is what we store as client security state */
typedef struct { typedef struct {
@ -64,11 +64,11 @@ typedef struct {
} SecurityClientStateRec; } SecurityClientStateRec;
#define HAVESTATE(client) (((SecurityClientStateRec *) \ #define HAVESTATE(client) (((SecurityClientStateRec *) \
dixLookupPrivate(DEVPRIV_PTR(client), &stateKey))->haveState) dixLookupPrivate(DEVPRIV_PTR(client), stateKey))->haveState)
#define TRUSTLEVEL(client) (((SecurityClientStateRec *) \ #define TRUSTLEVEL(client) (((SecurityClientStateRec *) \
dixLookupPrivate(DEVPRIV_PTR(client), &stateKey))->trustLevel) dixLookupPrivate(DEVPRIV_PTR(client), stateKey))->trustLevel)
#define AUTHID(client)(((SecurityClientStateRec *) \ #define AUTHID(client)(((SecurityClientStateRec *) \
dixLookupPrivate(DEVPRIV_PTR(client), &stateKey))->authId) dixLookupPrivate(DEVPRIV_PTR(client), stateKey))->authId)
static CallbackListPtr SecurityValidateGroupCallback = NULL; static CallbackListPtr SecurityValidateGroupCallback = NULL;
@ -1812,7 +1812,7 @@ SecurityExtensionInit(INITARGS)
RTEventClient |= RC_NEVERRETAIN; RTEventClient |= RC_NEVERRETAIN;
/* Allocate the private storage */ /* Allocate the private storage */
if (!dixRequestPrivate(&stateKey, sizeof(SecurityClientStateRec))) if (!dixRequestPrivate(stateKey, sizeof(SecurityClientStateRec)))
FatalError("SecurityExtensionSetup: Can't allocate client private.\n"); FatalError("SecurityExtensionSetup: Can't allocate client private.\n");
if (!AddCallback(&ClientStateCallback, SecurityClientStateCallback, NULL)) if (!AddCallback(&ClientStateCallback, SecurityClientStateCallback, NULL))

View File

@ -47,7 +47,7 @@ from The Open Group.
#include "extnsionst.h" #include "extnsionst.h"
typedef struct _PrivateDesc { typedef struct _PrivateDesc {
devprivate_key_t *key; DevPrivateKey key;
unsigned size; unsigned size;
CallbackListPtr initfuncs; CallbackListPtr initfuncs;
CallbackListPtr deletefuncs; CallbackListPtr deletefuncs;
@ -58,7 +58,7 @@ typedef struct _PrivateDesc {
static PrivateDescRec *items = NULL; static PrivateDescRec *items = NULL;
static _X_INLINE PrivateDescRec * static _X_INLINE PrivateDescRec *
findItem(devprivate_key_t *const key) findItem(const DevPrivateKey key)
{ {
PrivateDescRec *item = items; PrivateDescRec *item = items;
while (item) { while (item) {
@ -73,7 +73,7 @@ findItem(devprivate_key_t *const key)
* Request pre-allocated space. * Request pre-allocated space.
*/ */
_X_EXPORT int _X_EXPORT int
dixRequestPrivate(devprivate_key_t *const key, unsigned size) dixRequestPrivate(const DevPrivateKey key, unsigned size)
{ {
PrivateDescRec *item = findItem(key); PrivateDescRec *item = findItem(key);
if (item) { if (item) {
@ -98,7 +98,7 @@ dixRequestPrivate(devprivate_key_t *const key, unsigned size)
* Allocate a private and attach it to an existing object. * Allocate a private and attach it to an existing object.
*/ */
_X_EXPORT pointer * _X_EXPORT pointer *
dixAllocatePrivate(PrivateRec **privates, devprivate_key_t *const key) dixAllocatePrivate(PrivateRec **privates, const DevPrivateKey key)
{ {
PrivateDescRec *item = findItem(key); PrivateDescRec *item = findItem(key);
PrivateRec *ptr; PrivateRec *ptr;
@ -156,7 +156,7 @@ dixFreePrivates(PrivateRec *privates)
* Callback registration * Callback registration
*/ */
_X_EXPORT int _X_EXPORT int
dixRegisterPrivateInitFunc(devprivate_key_t *const key, dixRegisterPrivateInitFunc(const DevPrivateKey key,
CallbackProcPtr callback, pointer data) CallbackProcPtr callback, pointer data)
{ {
PrivateDescRec *item = findItem(key); PrivateDescRec *item = findItem(key);
@ -169,7 +169,7 @@ dixRegisterPrivateInitFunc(devprivate_key_t *const key,
} }
_X_EXPORT int _X_EXPORT int
dixRegisterPrivateDeleteFunc(devprivate_key_t *const key, dixRegisterPrivateDeleteFunc(const DevPrivateKey key,
CallbackProcPtr callback, pointer data) CallbackProcPtr callback, pointer data)
{ {
PrivateDescRec *item = findItem(key); PrivateDescRec *item = findItem(key);

View File

@ -19,10 +19,10 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
* STUFF FOR PRIVATES * STUFF FOR PRIVATES
*****************************************************************/ *****************************************************************/
typedef char devprivate_key_t; typedef void *DevPrivateKey;
typedef struct _Private { typedef struct _Private {
devprivate_key_t *key; DevPrivateKey key;
pointer value; pointer value;
struct _Private *next; struct _Private *next;
} PrivateRec; } PrivateRec;
@ -39,19 +39,19 @@ typedef struct _Private {
* Calling this is not necessary if only a pointer by itself is needed. * Calling this is not necessary if only a pointer by itself is needed.
*/ */
extern int extern int
dixRequestPrivate(devprivate_key_t *const key, unsigned size); dixRequestPrivate(const DevPrivateKey key, unsigned size);
/* /*
* Allocates a new private and attaches it to an existing object. * Allocates a new private and attaches it to an existing object.
*/ */
extern pointer * extern pointer *
dixAllocatePrivate(PrivateRec **privates, devprivate_key_t *const key); dixAllocatePrivate(PrivateRec **privates, const DevPrivateKey key);
/* /*
* Look up a private pointer. * Look up a private pointer.
*/ */
static _X_INLINE pointer static _X_INLINE pointer
dixLookupPrivate(PrivateRec **privates, devprivate_key_t *const key) dixLookupPrivate(PrivateRec **privates, const DevPrivateKey key)
{ {
PrivateRec *rec = *privates; PrivateRec *rec = *privates;
pointer *ptr; pointer *ptr;
@ -70,7 +70,7 @@ dixLookupPrivate(PrivateRec **privates, devprivate_key_t *const key)
* Look up the address of a private pointer. * Look up the address of a private pointer.
*/ */
static _X_INLINE pointer * static _X_INLINE pointer *
dixLookupPrivateAddr(PrivateRec **privates, devprivate_key_t *const key) dixLookupPrivateAddr(PrivateRec **privates, const DevPrivateKey key)
{ {
PrivateRec *rec = *privates; PrivateRec *rec = *privates;
@ -87,7 +87,7 @@ dixLookupPrivateAddr(PrivateRec **privates, devprivate_key_t *const key)
* Set a private pointer. * Set a private pointer.
*/ */
static _X_INLINE int static _X_INLINE int
dixSetPrivate(PrivateRec **privates, devprivate_key_t *const key, pointer val) dixSetPrivate(PrivateRec **privates, const DevPrivateKey key, pointer val)
{ {
PrivateRec *rec; PrivateRec *rec;
@ -111,16 +111,16 @@ dixSetPrivate(PrivateRec **privates, devprivate_key_t *const key, pointer val)
* The calldata argument to the callbacks is a PrivateCallbackPtr. * The calldata argument to the callbacks is a PrivateCallbackPtr.
*/ */
typedef struct _PrivateCallback { typedef struct _PrivateCallback {
devprivate_key_t *key; /* private registration key */ DevPrivateKey key; /* private registration key */
pointer *value; /* address of private pointer */ pointer *value; /* address of private pointer */
} PrivateCallbackRec; } PrivateCallbackRec;
extern int extern int
dixRegisterPrivateInitFunc(devprivate_key_t *const key, dixRegisterPrivateInitFunc(const DevPrivateKey key,
CallbackProcPtr callback, pointer userdata); CallbackProcPtr callback, pointer userdata);
extern int extern int
dixRegisterPrivateDeleteFunc(devprivate_key_t *const key, dixRegisterPrivateDeleteFunc(const DevPrivateKey key,
CallbackProcPtr callback, pointer userdata); CallbackProcPtr callback, pointer userdata);
/* /*