summaryrefslogtreecommitdiff
path: root/dix/privates.c
diff options
context:
space:
mode:
authorEamon Walsh <ewalsh@tycho.nsa.gov>2007-03-08 12:13:36 -0500
committerEamon Walsh <ewalsh@moss-uranus.epoch.ncsc.mil>2007-03-08 12:13:36 -0500
commit2fcb45eb5dc1803b372df8b5765f6a43bea83611 (patch)
tree85f22bb3b8a695300ac8f29c7cc1e34ecf1bb664 /dix/privates.c
parent947f8d249bac61beb10669d935888c4c280b5062 (diff)
devPrivates rework: redo field offset registration, drop RC_PRIVATES class.
Diffstat (limited to 'dix/privates.c')
-rw-r--r--dix/privates.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/dix/privates.c b/dix/privates.c
index 01d327b8c..29e261f6b 100644
--- a/dix/privates.c
+++ b/dix/privates.c
@@ -195,12 +195,14 @@ dixRegisterPrivateOffset(RESTYPE type, unsigned offset)
/* resize offsets table if necessary */
while (type >= offsetsSize) {
- offsets = (unsigned *)xrealloc(offsets,
- offsetsSize * 2 * sizeof(unsigned));
+ unsigned i = offsetsSize * 2 * sizeof(int);
+ offsets = (unsigned *)xrealloc(offsets, i);
if (!offsets) {
offsetsSize = 0;
return FALSE;
}
+ for (i=offsetsSize; i < 2*offsetsSize; i++)
+ offsets[i] = -1;
offsetsSize *= 2;
}
@@ -208,10 +210,9 @@ dixRegisterPrivateOffset(RESTYPE type, unsigned offset)
return TRUE;
}
-_X_EXPORT unsigned
+_X_EXPORT int
dixLookupPrivateOffset(RESTYPE type)
{
- assert(type & RC_PRIVATES);
type = type & TypeMask;
assert(type < offsetsSize);
return offsets[type];
@@ -233,19 +234,22 @@ int
dixResetPrivates(void)
{
PrivateDescRec *next;
+ unsigned i;
+
+ /* reset internal structures */
while (items) {
next = items->next;
xfree(items);
items = next;
}
-
if (offsets)
xfree(offsets);
-
offsetsSize = 16;
offsets = (unsigned *)xalloc(offsetsSize * sizeof(unsigned));
if (!offsets)
return FALSE;
+ for (i=0; i < offsetsSize; i++)
+ offsets[i] = -1;
/* reset legacy devPrivates support */
if (!ResetExtensionPrivates() || !ResetClientPrivates())