diff options
Diffstat (limited to 'dix/privates.c')
-rw-r--r-- | dix/privates.c | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/dix/privates.c b/dix/privates.c index 1353e29aa..a8f3ee9aa 100644 --- a/dix/privates.c +++ b/dix/privates.c @@ -1,4 +1,5 @@ /* $Xorg: privates.c,v 1.4 2001/02/09 02:04:40 xorgcvs Exp $ */ +/* $XdotOrg: $ */ /* Copyright 1993, 1998 The Open Group @@ -39,6 +40,7 @@ from The Open Group. #include "colormapst.h" #include "servermd.h" #include "site.h" +#include "inputstr.h" /* * See the Wrappers and devPrivates section in "Definition of the @@ -354,3 +356,39 @@ AllocateColormapPrivateIndex (InitCmapPrivFunc initPrivFunc) return index; } + +/* + * device private machinery + */ + +static int devicePrivateIndex = 0; + +int +AllocateDevicePrivateIndex() +{ + return devicePrivateIndex++; +} + +Bool +AllocateDevicePrivate(DeviceIntPtr device, int index) +{ + if (device->nPrivates < ++index) { + DevUnion *nprivs = (DevUnion *) xrealloc(device->devPrivates, + index * sizeof(DevUnion)); + if (!nprivs) + return FALSE; + device->devPrivates = nprivs; + bzero(&nprivs[device->nPrivates], sizeof(DevUnion) + * (index - device->nPrivates)); + device->nPrivates = index; + return TRUE; + } else { + return TRUE; + } +} + +void +ResetDevicePrivateIndex(void) +{ + devicePrivateIndex = 0; +} |