summaryrefslogtreecommitdiff
path: root/dix/resource.c
diff options
context:
space:
mode:
authorEamon Walsh <ewalsh@tycho.nsa.gov>2007-02-23 13:23:12 -0500
committerEamon Walsh <ewalsh@moss-uranus.epoch.ncsc.mil>2007-02-23 13:23:12 -0500
commit81372f9096b952f4be545654b0b44ac37ef4f2c2 (patch)
tree6255b5249cee9ed6a1bd35a2106c8bcf5fb72794 /dix/resource.c
parent16f2b8892d9ebcef6410a675d10549043223f617 (diff)
devPrivates rework: hook up new interface in resource system; add new
resource-adding function that takes an additional ScreenPtr argument.
Diffstat (limited to 'dix/resource.c')
-rw-r--r--dix/resource.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/dix/resource.c b/dix/resource.c
index 584ac94fb..bddc18cc3 100644
--- a/dix/resource.c
+++ b/dix/resource.c
@@ -135,6 +135,7 @@ Equipment Corporation.
#include "misc.h"
#include "os.h"
#include "resource.h"
+#include "privates.h"
#include "dixstruct.h"
#include "opaque.h"
#include "windowstr.h"
@@ -206,6 +207,8 @@ CreateNewResourceType(DeleteType deleteFunc)
if (next & lastResourceClass)
return 0;
+ if (!dixUpdatePrivates())
+ return 0;
funcs = (DeleteType *)xrealloc(DeleteFuncs,
(next + 1) * sizeof(DeleteType));
if (!funcs)
@@ -451,7 +454,7 @@ FakeClientID(register int client)
}
_X_EXPORT Bool
-AddResource(XID id, RESTYPE type, pointer value)
+dixAddResource(XID id, RESTYPE type, pointer value, pointer parent)
{
int client;
register ClientResourceRec *rrec;
@@ -472,7 +475,7 @@ AddResource(XID id, RESTYPE type, pointer value)
(rrec->hashsize < MAXHASHSIZE))
RebuildTable(client);
head = &rrec->resources[Hash(client, id)];
- res = (ResourcePtr)xalloc(sizeof(ResourceRec));
+ res = dixAllocateResourceRec(type, value, parent);
if (!res)
{
(*DeleteFuncs[type & TypeMask])(value, id);
@@ -486,9 +489,16 @@ AddResource(XID id, RESTYPE type, pointer value)
rrec->elements++;
if (!(id & SERVER_BIT) && (id >= rrec->expectID))
rrec->expectID = id + 1;
+ dixCallPrivateInitFuncs(res);
return TRUE;
}
+_X_EXPORT Bool
+AddResource(XID id, RESTYPE type, pointer value)
+{
+ return dixAddResource(id, type, value, NULL);
+}
+
static void
RebuildTable(int client)
{
@@ -570,7 +580,7 @@ FreeResource(XID id, RESTYPE skipDeleteFuncType)
FlushClientCaches(res->id);
if (rtype != skipDeleteFuncType)
(*DeleteFuncs[rtype & TypeMask])(res->value, res->id);
- xfree(res);
+ dixFreeResourceRec(res);
if (*eltptr != elements)
prev = head; /* prev may no longer be valid */
gotOne = TRUE;
@@ -614,7 +624,7 @@ FreeResourceByType(XID id, RESTYPE type, Bool skipFree)
FlushClientCaches(res->id);
if (!skipFree)
(*DeleteFuncs[type & TypeMask])(res->value, res->id);
- xfree(res);
+ dixFreeResourceRec(res);
break;
}
else
@@ -779,7 +789,7 @@ FreeClientNeverRetainResources(ClientPtr client)
if (rtype & RC_CACHED)
FlushClientCaches(this->id);
(*DeleteFuncs[rtype & TypeMask])(this->value, this->id);
- xfree(this);
+ dixFreeResourceRec(this);
}
else
prev = &this->next;
@@ -829,7 +839,7 @@ FreeClientResources(ClientPtr client)
if (rtype & RC_CACHED)
FlushClientCaches(this->id);
(*DeleteFuncs[rtype & TypeMask])(this->value, this->id);
- xfree(this);
+ dixFreeResourceRec(this);
}
}
xfree(clientTable[client->index].resources);