Remove dixRegisterPrivateOffset; hard-code devPrivates offsets instead

For predefined resource types, the offset of the devPrivates field was
already kept in a constant table. The only non-predefined type needing
this treatment was dbeDrawableResType, which is just a magic alias for
RT_PIXMAP.

This patch special-cases looking up RC_DRAWABLE offsets and uses the
table directly for everything else.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Jamey Sharp <jamey@minilop.net>
This commit is contained in:
Keith Packard
2010-05-15 14:52:39 -07:00
parent 7ef612de78
commit 431781a921
4 changed files with 19 additions and 63 deletions

View File

@@ -107,26 +107,16 @@ dixFreePrivates(PrivateRec *privates);
extern _X_EXPORT int
dixResetPrivates(void);
/*
* These next two functions are necessary because the position of
* the devPrivates field varies by structure and calling code might
* only know the resource type, not the structure definition.
*/
/*
* Looks up the offset where the devPrivates field is located.
* Returns -1 if no offset has been registered for the resource type.
* Returns -1 if the specified resource has no dev privates.
* The position of the devPrivates field varies by structure
* and calling code might only know the resource type, not the
* structure definition.
*/
extern _X_EXPORT int
dixLookupPrivateOffset(RESTYPE type);
/*
* Specifies the offset where the devPrivates field is located.
* A negative value indicates no devPrivates field is available.
*/
extern _X_EXPORT int
dixRegisterPrivateOffset(RESTYPE type, int offset);
/*
* Convenience macro for adding an offset to an object pointer
* when making a call to one of the devPrivates functions