From 660e48e6c6a9df08655c286ac3a9ffa45eb44c26 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Sat, 10 Dec 2011 15:15:18 -0800 Subject: [PATCH 09/11] glx: Use one function to add a context to all global tables Instead of having separate __glXAddContextToList and AddResource functions, just have one function that does both steps. Signed-off-by: Ian Romanick Reviewed-by: Jesse Barnes Reviewed-by: Christopher James Halse Rogers --- glx/glxcmds.c | 6 ++---- glx/glxext.c | 11 +++++++++-- glx/glxext.h | 2 +- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/glx/glxcmds.c b/glx/glxcmds.c index 8a9a1d3..d9d2201 100644 --- a/glx/glxcmds.c +++ b/glx/glxcmds.c @@ -308,16 +308,14 @@ DoCreateContext(__GLXclientState * cl, GLXContextID gcId, glxc->drawPriv = NULL; glxc->readPriv = NULL; - /* Register this context as a resource. + /* Add the new context to the various global tables of GLX contexts. */ - if (!AddResource(gcId, __glXContextRes, (pointer)glxc)) { + if (!__glXAddContext(glxc)) { (*glxc->destroy) (glxc); client->errorValue = gcId; return BadAlloc; } - __glXAddToContextList(glxc); - return Success; } diff --git a/glx/glxext.c b/glx/glxext.c index 599f029..8d168d8 100644 --- a/glx/glxext.c +++ b/glx/glxext.c @@ -157,11 +157,18 @@ DrawableGone(__GLXdrawable * glxPriv, XID xid) return True; } -void -__glXAddToContextList(__GLXcontext * cx) +Bool +__glXAddContext(__GLXcontext * cx) { + /* Register this context as a resource. + */ + if (!AddResource(cx->id, __glXContextRes, (pointer)cx)) { + return False; + } + cx->next = glxAllContexts; glxAllContexts = cx; + return True; } static void diff --git a/glx/glxext.h b/glx/glxext.h index 7cd5cb4..9b0978b 100644 --- a/glx/glxext.h +++ b/glx/glxext.h @@ -38,7 +38,7 @@ extern GLboolean __glXFreeContext(__GLXcontext * glxc); extern void __glXFlushContextCache(void); -extern void __glXAddToContextList(__GLXcontext * cx); +extern Bool __glXAddContext(__GLXcontext * cx); extern void __glXErrorCallBack(GLenum code); extern void __glXClearErrorOccured(void); extern GLboolean __glXErrorOccured(void); -- 1.7.3.4