xserver: Branch 'server-1.5-branch'

Eamon Walsh ewalsh at kemper.freedesktop.org
Fri Jun 13 13:47:14 PDT 2008


 dix/privates.c             |   65 +++++++++++++++++++++++++++++++++++++++++++++
 hw/xfree86/loader/dixsym.c |    3 ++
 include/privates.h         |   61 +++++-------------------------------------
 3 files changed, 76 insertions(+), 53 deletions(-)

New commits:
commit 255202666411e15ebe2f9cde35b48a333dc9e38c
Author: Eamon Walsh <ewalsh at tycho.nsa.gov>
Date:   Fri Jun 13 16:39:40 2008 -0400

    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.
    (cherry picked from commit 2d7ba09dc4b5eff5dba8d7867f285111574b1737)

diff --git a/dix/privates.c b/dix/privates.c
index 47a0e1a..efb3204 100644
--- a/dix/privates.c
+++ b/dix/privates.c
@@ -39,6 +39,12 @@ from The Open Group.
 #include "colormapst.h"
 #include "inputstr.h"
 
+struct _Private {
+    DevPrivateKey      key;
+    pointer            value;
+    struct _Private    *next;
+};
+
 typedef struct _PrivateDesc {
     DevPrivateKey key;
     unsigned size;
@@ -117,6 +123,65 @@ dixAllocatePrivate(PrivateRec **privates, const DevPrivateKey key)
 }
 
 /*
+ * Look up a private pointer.
+ */
+_X_EXPORT 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;
+}
+
+/*
+ * Look up the address of a private pointer.
+ */
+_X_EXPORT 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);
+}
+
+/*
+ * Set a private pointer.
+ */
+_X_EXPORT 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;
+}
+
+/*
  * Called to free privates at object deletion time.
  */
 _X_EXPORT void
diff --git a/hw/xfree86/loader/dixsym.c b/hw/xfree86/loader/dixsym.c
index d6d22c4..a8bde75 100644
--- a/hw/xfree86/loader/dixsym.c
+++ b/hw/xfree86/loader/dixsym.c
@@ -265,6 +265,9 @@ _X_HIDDEN void *dixLookupTab[] = {
     SYMFUNC(dixRegisterPrivateInitFunc)
     SYMFUNC(dixRegisterPrivateDeleteFunc)
     SYMFUNC(dixAllocatePrivate)
+    SYMFUNC(dixLookupPrivate)
+    SYMFUNC(dixLookupPrivateAddr)
+    SYMFUNC(dixSetPrivate)
     SYMFUNC(dixFreePrivates)
     SYMFUNC(dixRegisterPrivateOffset)
     SYMFUNC(dixLookupPrivateOffset)
diff --git a/include/privates.h b/include/privates.h
index 8d59b72..98d893c 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.


More information about the xorg-commit mailing list