diff options
author | Eamon Walsh <ewalsh@tycho.nsa.gov> | 2008-06-13 16:39:40 -0400 |
---|---|---|
committer | Eamon Walsh <ewalsh@moss-charon.epoch.ncsc.mil> | 2008-06-13 16:43:56 -0400 |
commit | 2d7ba09dc4b5eff5dba8d7867f285111574b1737 (patch) | |
tree | 7e0704eaf68ad6e1eb3bdc7d184bd08316542f50 /include/privates.h | |
parent | 9e0e558f263a132babf8c91d31230831653f19c1 (diff) |
Make devPrivates lookup functions ABI instead of static inlines.
This is required to preserve compatibility across changes to the
internal representation of the privates list.
Diffstat (limited to 'include/privates.h')
-rw-r--r-- | include/privates.h | 61 |
1 files changed, 8 insertions, 53 deletions
diff --git a/include/privates.h b/include/privates.h index 8d59b728f..98d893c77 100644 --- a/include/privates.h +++ b/include/privates.h @@ -20,12 +20,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *****************************************************************/ typedef void *DevPrivateKey; - -typedef struct _Private { - DevPrivateKey key; - pointer value; - struct _Private *next; -} PrivateRec; +struct _Private; +typedef struct _Private PrivateRec; /* * Request pre-allocated private space for your driver/module. @@ -43,61 +39,20 @@ dixAllocatePrivate(PrivateRec **privates, const DevPrivateKey key); /* * Look up a private pointer. */ -static _X_INLINE pointer -dixLookupPrivate(PrivateRec **privates, const DevPrivateKey key) -{ - PrivateRec *rec = *privates; - pointer *ptr; - - while (rec) { - if (rec->key == key) - return rec->value; - rec = rec->next; - } - - ptr = dixAllocatePrivate(privates, key); - return ptr ? *ptr : NULL; -} +pointer +dixLookupPrivate(PrivateRec **privates, const DevPrivateKey key); /* * Look up the address of a private pointer. */ -static _X_INLINE pointer * -dixLookupPrivateAddr(PrivateRec **privates, const DevPrivateKey key) -{ - PrivateRec *rec = *privates; - - while (rec) { - if (rec->key == key) - return &rec->value; - rec = rec->next; - } - - return dixAllocatePrivate(privates, key); -} +pointer * +dixLookupPrivateAddr(PrivateRec **privates, const DevPrivateKey key); /* * Set a private pointer. */ -static _X_INLINE int -dixSetPrivate(PrivateRec **privates, const DevPrivateKey key, pointer val) -{ - PrivateRec *rec; - - top: - rec = *privates; - while (rec) { - if (rec->key == key) { - rec->value = val; - return TRUE; - } - rec = rec->next; - } - - if (!dixAllocatePrivate(privates, key)) - return FALSE; - goto top; -} +int +dixSetPrivate(PrivateRec **privates, const DevPrivateKey key, pointer val); /* * Register callbacks to be called on private allocation/freeing. |