From b2b7817497dd5da73d23ec9cc637c563041fc490 Mon Sep 17 00:00:00 2001 From: Eamon Walsh Date: Thu, 16 Aug 2007 15:30:25 -0400 Subject: [PATCH] devPrivates rework: use camelcase standard for name of key type. --- Xext/security.c | 10 +++++----- dix/privates.c | 12 ++++++------ include/privates.h | 22 +++++++++++----------- 3 files changed, 22 insertions(+), 22 deletions(-) diff --git a/Xext/security.c b/Xext/security.c index bf414a50f..fe1e48a14 100644 --- a/Xext/security.c +++ b/Xext/security.c @@ -54,7 +54,7 @@ in this Software without prior written authorization from The Open Group. static int SecurityErrorBase; /* first Security error 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 */ typedef struct { @@ -64,11 +64,11 @@ typedef struct { } SecurityClientStateRec; #define HAVESTATE(client) (((SecurityClientStateRec *) \ - dixLookupPrivate(DEVPRIV_PTR(client), &stateKey))->haveState) + dixLookupPrivate(DEVPRIV_PTR(client), stateKey))->haveState) #define TRUSTLEVEL(client) (((SecurityClientStateRec *) \ - dixLookupPrivate(DEVPRIV_PTR(client), &stateKey))->trustLevel) + dixLookupPrivate(DEVPRIV_PTR(client), stateKey))->trustLevel) #define AUTHID(client)(((SecurityClientStateRec *) \ - dixLookupPrivate(DEVPRIV_PTR(client), &stateKey))->authId) + dixLookupPrivate(DEVPRIV_PTR(client), stateKey))->authId) static CallbackListPtr SecurityValidateGroupCallback = NULL; @@ -1812,7 +1812,7 @@ SecurityExtensionInit(INITARGS) RTEventClient |= RC_NEVERRETAIN; /* Allocate the private storage */ - if (!dixRequestPrivate(&stateKey, sizeof(SecurityClientStateRec))) + if (!dixRequestPrivate(stateKey, sizeof(SecurityClientStateRec))) FatalError("SecurityExtensionSetup: Can't allocate client private.\n"); if (!AddCallback(&ClientStateCallback, SecurityClientStateCallback, NULL)) diff --git a/dix/privates.c b/dix/privates.c index f2f1c49ee..4dbba437c 100644 --- a/dix/privates.c +++ b/dix/privates.c @@ -47,7 +47,7 @@ from The Open Group. #include "extnsionst.h" typedef struct _PrivateDesc { - devprivate_key_t *key; + DevPrivateKey key; unsigned size; CallbackListPtr initfuncs; CallbackListPtr deletefuncs; @@ -58,7 +58,7 @@ typedef struct _PrivateDesc { static PrivateDescRec *items = NULL; static _X_INLINE PrivateDescRec * -findItem(devprivate_key_t *const key) +findItem(const DevPrivateKey key) { PrivateDescRec *item = items; while (item) { @@ -73,7 +73,7 @@ findItem(devprivate_key_t *const key) * Request pre-allocated space. */ _X_EXPORT int -dixRequestPrivate(devprivate_key_t *const key, unsigned size) +dixRequestPrivate(const DevPrivateKey key, unsigned size) { PrivateDescRec *item = findItem(key); if (item) { @@ -98,7 +98,7 @@ dixRequestPrivate(devprivate_key_t *const key, unsigned size) * Allocate a private and attach it to an existing object. */ _X_EXPORT pointer * -dixAllocatePrivate(PrivateRec **privates, devprivate_key_t *const key) +dixAllocatePrivate(PrivateRec **privates, const DevPrivateKey key) { PrivateDescRec *item = findItem(key); PrivateRec *ptr; @@ -156,7 +156,7 @@ dixFreePrivates(PrivateRec *privates) * Callback registration */ _X_EXPORT int -dixRegisterPrivateInitFunc(devprivate_key_t *const key, +dixRegisterPrivateInitFunc(const DevPrivateKey key, CallbackProcPtr callback, pointer data) { PrivateDescRec *item = findItem(key); @@ -169,7 +169,7 @@ dixRegisterPrivateInitFunc(devprivate_key_t *const key, } _X_EXPORT int -dixRegisterPrivateDeleteFunc(devprivate_key_t *const key, +dixRegisterPrivateDeleteFunc(const DevPrivateKey key, CallbackProcPtr callback, pointer data) { PrivateDescRec *item = findItem(key); diff --git a/include/privates.h b/include/privates.h index e57f16712..e377b3068 100644 --- a/include/privates.h +++ b/include/privates.h @@ -19,10 +19,10 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * STUFF FOR PRIVATES *****************************************************************/ -typedef char devprivate_key_t; +typedef void *DevPrivateKey; typedef struct _Private { - devprivate_key_t *key; + DevPrivateKey key; pointer value; struct _Private *next; } PrivateRec; @@ -39,19 +39,19 @@ typedef struct _Private { * Calling this is not necessary if only a pointer by itself is needed. */ 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. */ extern pointer * -dixAllocatePrivate(PrivateRec **privates, devprivate_key_t *const key); +dixAllocatePrivate(PrivateRec **privates, const DevPrivateKey key); /* * Look up a private pointer. */ static _X_INLINE pointer -dixLookupPrivate(PrivateRec **privates, devprivate_key_t *const key) +dixLookupPrivate(PrivateRec **privates, const DevPrivateKey key) { PrivateRec *rec = *privates; pointer *ptr; @@ -70,7 +70,7 @@ dixLookupPrivate(PrivateRec **privates, devprivate_key_t *const key) * Look up the address of a private pointer. */ static _X_INLINE pointer * -dixLookupPrivateAddr(PrivateRec **privates, devprivate_key_t *const key) +dixLookupPrivateAddr(PrivateRec **privates, const DevPrivateKey key) { PrivateRec *rec = *privates; @@ -87,7 +87,7 @@ dixLookupPrivateAddr(PrivateRec **privates, devprivate_key_t *const key) * Set a private pointer. */ static _X_INLINE int -dixSetPrivate(PrivateRec **privates, devprivate_key_t *const key, pointer val) +dixSetPrivate(PrivateRec **privates, const DevPrivateKey key, pointer val) { 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. */ typedef struct _PrivateCallback { - devprivate_key_t *key; /* private registration key */ - pointer *value; /* address of private pointer */ + DevPrivateKey key; /* private registration key */ + pointer *value; /* address of private pointer */ } PrivateCallbackRec; extern int -dixRegisterPrivateInitFunc(devprivate_key_t *const key, +dixRegisterPrivateInitFunc(const DevPrivateKey key, CallbackProcPtr callback, pointer userdata); extern int -dixRegisterPrivateDeleteFunc(devprivate_key_t *const key, +dixRegisterPrivateDeleteFunc(const DevPrivateKey key, CallbackProcPtr callback, pointer userdata); /*