aboutsummaryrefslogtreecommitdiff
path: root/nx-X11/programs/Xserver/GL/glx
diff options
context:
space:
mode:
Diffstat (limited to 'nx-X11/programs/Xserver/GL/glx')
-rw-r--r--nx-X11/programs/Xserver/GL/glx/glxcmds.c56
-rw-r--r--nx-X11/programs/Xserver/GL/glx/glxcmdsswap.c9
-rw-r--r--nx-X11/programs/Xserver/GL/glx/glxext.c27
-rw-r--r--nx-X11/programs/Xserver/GL/glx/glxfb.c4
-rw-r--r--nx-X11/programs/Xserver/GL/glx/glximports.c17
-rw-r--r--nx-X11/programs/Xserver/GL/glx/glxpix.c4
-rw-r--r--nx-X11/programs/Xserver/GL/glx/glxscreens.c22
-rw-r--r--nx-X11/programs/Xserver/GL/glx/glxserver.h1
-rw-r--r--nx-X11/programs/Xserver/GL/glx/glxutil.c98
-rw-r--r--nx-X11/programs/Xserver/GL/glx/glxutil.h6
-rw-r--r--nx-X11/programs/Xserver/GL/glx/single2.c53
-rw-r--r--nx-X11/programs/Xserver/GL/glx/single2swap.c5
-rw-r--r--nx-X11/programs/Xserver/GL/glx/xfont.c4
13 files changed, 114 insertions, 192 deletions
diff --git a/nx-X11/programs/Xserver/GL/glx/glxcmds.c b/nx-X11/programs/Xserver/GL/glx/glxcmds.c
index dd5e40ffe..d082e84bf 100644
--- a/nx-X11/programs/Xserver/GL/glx/glxcmds.c
+++ b/nx-X11/programs/Xserver/GL/glx/glxcmds.c
@@ -39,6 +39,7 @@
#endif
#include <string.h>
+#include <assert.h>
#include "glxserver.h"
#include <GL/glxtokens.h>
@@ -50,7 +51,6 @@
#include "glximports.h"
#include "glxutil.h"
#include "glxext.h"
-#include "GL/glx_ansic.h"
#include "glcontextmodes.h"
/************************************************************************/
@@ -193,11 +193,11 @@ int DoCreateContext(__GLXclientState *cl, GLXContextID gcId,
/*
** Allocate memory for the new context
*/
- glxc = (__GLXcontext *) __glXMalloc(sizeof(__GLXcontext));
+ glxc = (__GLXcontext *) malloc(sizeof(__GLXcontext));
if (!glxc) {
return BadAlloc;
}
- __glXMemset(glxc, 0, sizeof(__GLXcontext));
+ memset(glxc, 0, sizeof(__GLXcontext));
/*
** Initially, setup the part of the context that could be used by
@@ -216,7 +216,7 @@ int DoCreateContext(__GLXclientState *cl, GLXContextID gcId,
imports.other = (void *)glxc;
glxc->gc = (*pGlxScreen->createContext)(&imports, glxc->modes, shareGC);
if (!glxc->gc) {
- __glXFree(glxc);
+ free(glxc);
client->errorValue = gcId;
return BadAlloc;
}
@@ -233,7 +233,7 @@ int DoCreateContext(__GLXclientState *cl, GLXContextID gcId,
if (!isDirect) {
(*glxc->gc->exports.destroyContext)((__GLcontext *)glxc->gc);
}
- __glXFree(glxc);
+ free(glxc);
client->errorValue = gcId;
return BadAlloc;
}
@@ -335,9 +335,9 @@ static int AddCurrentContext(__GLXclientState *cl, __GLXcontext *glxc)
** Didn't find a free slot, so we'll have to grow the table.
*/
if (!num) {
- table = (__GLXcontext **) __glXMalloc(sizeof(__GLXcontext *));
+ table = (__GLXcontext **) malloc(sizeof(__GLXcontext *));
} else {
- table = (__GLXcontext **) __glXRealloc(table,
+ table = (__GLXcontext **) realloc(table,
(num+1)*sizeof(__GLXcontext *));
}
table[num] = glxc;
@@ -685,7 +685,7 @@ int DoMakeCurrent( __GLXclientState *cl,
** refcount of the X pixmap and free only if it's zero.
*/
(*prevglxc->readPixmap->pScreen->DestroyPixmap)(pPixmap);
- __glXFree(prevglxc->readPixmap);
+ free(prevglxc->readPixmap);
}
}
@@ -701,7 +701,7 @@ int DoMakeCurrent( __GLXclientState *cl,
** refcount of the X pixmap and free only if it's zero.
*/
(*prevglxc->drawPixmap->pScreen->DestroyPixmap)(pPixmap);
- __glXFree(prevglxc->drawPixmap);
+ free(prevglxc->drawPixmap);
}
prevglxc->drawPixmap = NULL;
@@ -1192,7 +1192,7 @@ int DoCreateGLXPixmap(__GLXclientState *cl, VisualID visual,
return BadValue;
}
- pGlxPixmap = (__GLXpixmap *) __glXMalloc(sizeof(__GLXpixmap));
+ pGlxPixmap = (__GLXpixmap *) malloc(sizeof(__GLXpixmap));
if (!pGlxPixmap) {
return BadAlloc;
}
@@ -1382,7 +1382,7 @@ int __glXQueryContextInfoEXT(__GLXclientState *cl, GLbyte *pc)
reply.n = nProps;
nReplyBytes = reply.length << 2;
- sendBuf = (int *)__glXMalloc((size_t)nReplyBytes);
+ sendBuf = (int *)malloc((size_t)nReplyBytes);
if (sendBuf == NULL) {
return __glXBadContext; /* XXX: Is this correct? */
}
@@ -1400,7 +1400,7 @@ int __glXQueryContextInfoEXT(__GLXclientState *cl, GLbyte *pc)
WriteToClient(client, sz_xGLXQueryContextInfoEXTReply, &reply);
WriteToClient(client, nReplyBytes, sendBuf);
}
- __glXFree((char *)sendBuf);
+ free((char *)sendBuf);
return Success;
}
@@ -1626,17 +1626,17 @@ int __glXRenderLarge(__GLXclientState *cl, GLbyte *pc)
*/
if (cl->largeCmdBufSize < cmdlen) {
if (!cl->largeCmdBuf) {
- cl->largeCmdBuf = (GLbyte *) __glXMalloc((size_t)cmdlen);
+ cl->largeCmdBuf = (GLbyte *) malloc((size_t)cmdlen);
} else {
- cl->largeCmdBuf = (GLbyte *) __glXRealloc(cl->largeCmdBuf,
- (size_t)cmdlen);
+ cl->largeCmdBuf = (GLbyte *) realloc(cl->largeCmdBuf,
+ (size_t)cmdlen);
}
if (!cl->largeCmdBuf) {
return BadAlloc;
}
cl->largeCmdBufSize = cmdlen;
}
- __glXMemcpy(cl->largeCmdBuf, pc, dataBytes);
+ memcpy(cl->largeCmdBuf, pc, dataBytes);
cl->largeCmdBytesSoFar = dataBytes;
cl->largeCmdBytesTotal = cmdlen;
@@ -1679,7 +1679,7 @@ int __glXRenderLarge(__GLXclientState *cl, GLbyte *pc)
__glXResetLargeCommandStatus(cl);
return __glXBadLargeRequest;
}
- __glXMemcpy(cl->largeCmdBuf + cl->largeCmdBytesSoFar, pc, dataBytes);
+ memcpy(cl->largeCmdBuf + cl->largeCmdBytesSoFar, pc, dataBytes);
cl->largeCmdBytesSoFar += dataBytes;
cl->largeCmdRequestsSoFar++;
@@ -2074,17 +2074,18 @@ int __glXQueryExtensionsString(__GLXclientState *cl, GLbyte *pc)
ptr = __glXActiveScreens[screen].GLXextensions;
- n = __glXStrlen(ptr) + 1;
+ n = strlen(ptr) + 1;
length = __GLX_PAD(n) >> 2;
reply.type = X_Reply;
reply.sequenceNumber = client->sequence;
reply.length = length;
reply.n = n;
- if ((buf = (char *) __glXMalloc(length << 2)) == NULL) {
+ /* Allocate buffer to make sure it's a multiple of 4 bytes big.*/
+ buf = (char *) malloc(length << 2);
+ if (buf == NULL)
return BadAlloc;
- }
- __glXStrncpy(buf, ptr, n);
+ memcpy(buf, ptr, n);
if (client->swapped) {
glxSwapQueryExtensionsStringReply(client, &reply, buf);
@@ -2093,7 +2094,7 @@ int __glXQueryExtensionsString(__GLXclientState *cl, GLbyte *pc)
WriteToClient(client, (int)(length << 2), buf);
}
- __glXFree(buf);
+ free(buf);
return Success;
}
@@ -2131,7 +2132,7 @@ int __glXQueryServerString(__GLXclientState *cl, GLbyte *pc)
return BadValue;
}
- n = __glXStrlen(ptr) + 1;
+ n = strlen(ptr) + 1;
length = __GLX_PAD(n) >> 2;
reply.type = X_Reply;
reply.sequenceNumber = client->sequence;
@@ -2141,7 +2142,7 @@ int __glXQueryServerString(__GLXclientState *cl, GLbyte *pc)
if ((buf = (char *) malloc(length << 2)) == NULL) {
return BadAlloc;
}
- __glXStrncpy(buf, ptr, n);
+ memcpy(buf, ptr, n);
if (client->swapped) {
glxSwapQueryServerStringReply(client, &reply, buf);
@@ -2150,7 +2151,7 @@ int __glXQueryServerString(__GLXclientState *cl, GLbyte *pc)
WriteToClient(client, (int)(length << 2), buf);
}
- __glXFree(buf);
+ free(buf);
return Success;
}
@@ -2161,9 +2162,10 @@ int __glXClientInfo(__GLXclientState *cl, GLbyte *pc)
cl->GLClientmajorVersion = req->major;
cl->GLClientminorVersion = req->minor;
- if (cl->GLClientextensions) __glXFree(cl->GLClientextensions);
+ if (cl->GLClientextensions)
+ free(cl->GLClientextensions);
buf = (const char *)(req+1);
- cl->GLClientextensions = __glXStrdup(buf);
+ cl->GLClientextensions = xstrdup(buf);
return Success;
}
diff --git a/nx-X11/programs/Xserver/GL/glx/glxcmdsswap.c b/nx-X11/programs/Xserver/GL/glx/glxcmdsswap.c
index 092a14e66..98acfe5af 100644
--- a/nx-X11/programs/Xserver/GL/glx/glxcmdsswap.c
+++ b/nx-X11/programs/Xserver/GL/glx/glxcmdsswap.c
@@ -47,7 +47,6 @@
#include <pixmapstr.h>
#include <windowstr.h>
#include "glxext.h"
-#include "GL/glx_ansic.h"
static int __glXSwapGetFBConfigsSGIX(__GLXclientState *cl, GLbyte *pc);
static int __glXSwapCreateContextWithConfigSGIX(__GLXclientState *cl, GLbyte *pc);
@@ -683,16 +682,16 @@ int __glXSwapRenderLarge(__GLXclientState *cl, GLbyte *pc)
*/
if (cl->largeCmdBufSize < cmdlen) {
if (!cl->largeCmdBuf) {
- cl->largeCmdBuf = (GLbyte *) __glXMalloc(cmdlen);
+ cl->largeCmdBuf = (GLbyte *) malloc(cmdlen);
} else {
- cl->largeCmdBuf = (GLbyte *) __glXRealloc(cl->largeCmdBuf, cmdlen);
+ cl->largeCmdBuf = (GLbyte *) realloc(cl->largeCmdBuf, cmdlen);
}
if (!cl->largeCmdBuf) {
return BadAlloc;
}
cl->largeCmdBufSize = cmdlen;
}
- __glXMemcpy(cl->largeCmdBuf, pc, dataBytes);
+ memcpy(cl->largeCmdBuf, pc, dataBytes);
cl->largeCmdBytesSoFar = dataBytes;
cl->largeCmdBytesTotal = cmdlen;
@@ -735,7 +734,7 @@ int __glXSwapRenderLarge(__GLXclientState *cl, GLbyte *pc)
__glXResetLargeCommandStatus(cl);
return __glXBadLargeRequest;
}
- __glXMemcpy(cl->largeCmdBuf + cl->largeCmdBytesSoFar, pc, dataBytes);
+ memcpy(cl->largeCmdBuf + cl->largeCmdBytesSoFar, pc, dataBytes);
cl->largeCmdBytesSoFar += dataBytes;
cl->largeCmdRequestsSoFar++;
diff --git a/nx-X11/programs/Xserver/GL/glx/glxext.c b/nx-X11/programs/Xserver/GL/glx/glxext.c
index f908c08cf..f6d572d2a 100644
--- a/nx-X11/programs/Xserver/GL/glx/glxext.c
+++ b/nx-X11/programs/Xserver/GL/glx/glxext.c
@@ -62,17 +62,18 @@ static void ResetClientState(int clientIndex)
{
__GLXclientState *cl = __glXClients[clientIndex];
- if (cl->returnBuf) __glXFree(cl->returnBuf);
- if (cl->largeCmdBuf) __glXFree(cl->largeCmdBuf);
- if (cl->currentContexts) __glXFree(cl->currentContexts);
- __glXMemset(cl, 0, sizeof(__GLXclientState));
+ if (cl->returnBuf) free(cl->returnBuf);
+ if (cl->largeCmdBuf) free(cl->largeCmdBuf);
+ if (cl->currentContexts) free(cl->currentContexts);
+ memset(cl, 0, sizeof(__GLXclientState));
/*
** By default, assume that the client supports
** GLX major version 1 minor version 0 protocol.
*/
cl->GLClientmajorVersion = 1;
cl->GLClientminorVersion = 0;
- if (cl->GLClientextensions) __glXFree(cl->GLClientextensions);
+ if (cl->GLClientextensions)
+ free(cl->GLClientextensions);
}
@@ -151,7 +152,7 @@ static int PixmapGone(__GLXpixmap *pGlxPixmap, XID id)
** only if it's zero.
*/
(*pGlxPixmap->pScreen->DestroyPixmap)(pPixmap);
- __glXFree(pGlxPixmap);
+ free(pGlxPixmap);
}
return True;
@@ -169,9 +170,9 @@ GLboolean __glXFreeContext(__GLXcontext *cx)
return GL_FALSE;
}
}
- if (cx->feedbackBuf) __glXFree(cx->feedbackBuf);
- if (cx->selectBuf) __glXFree(cx->selectBuf);
- __glXFree(cx);
+ if (cx->feedbackBuf) free(cx->feedbackBuf);
+ if (cx->selectBuf) free(cx->selectBuf);
+ free(cx);
if (cx == __glXLastContext) {
__glXFlushContextCache();
}
@@ -404,12 +405,12 @@ static int __glXDispatch(ClientPtr client)
opcode = stuff->glxCode;
cl = __glXClients[client->index];
if (!cl) {
- cl = (__GLXclientState *) __glXMalloc(sizeof(__GLXclientState));
+ cl = (__GLXclientState *) malloc(sizeof(__GLXclientState));
__glXClients[client->index] = cl;
if (!cl) {
return BadAlloc;
}
- __glXMemset(cl, 0, sizeof(__GLXclientState));
+ memset(cl, 0, sizeof(__GLXclientState));
}
if (!cl->inUse) {
@@ -458,12 +459,12 @@ static int __glXSwapDispatch(ClientPtr client)
opcode = stuff->glxCode;
cl = __glXClients[client->index];
if (!cl) {
- cl = (__GLXclientState *) __glXMalloc(sizeof(__GLXclientState));
+ cl = (__GLXclientState *) malloc(sizeof(__GLXclientState));
__glXClients[client->index] = cl;
if (!cl) {
return BadAlloc;
}
- __glXMemset(cl, 0, sizeof(__GLXclientState));
+ memset(cl, 0, sizeof(__GLXclientState));
}
if (!cl->inUse) {
diff --git a/nx-X11/programs/Xserver/GL/glx/glxfb.c b/nx-X11/programs/Xserver/GL/glx/glxfb.c
index 9573d97b9..955c1dd79 100644
--- a/nx-X11/programs/Xserver/GL/glx/glxfb.c
+++ b/nx-X11/programs/Xserver/GL/glx/glxfb.c
@@ -130,7 +130,7 @@ Free(__GLdrawableBuffer *buf, __GLdrawablePrivate *glPriv)
FreeScratchGC(bufferInfo->pGC);
}
- __glXFree(bufferInfo);
+ free(bufferInfo);
buf->other = NULL;
}
@@ -173,7 +173,7 @@ __glXInitFB(__GLdrawableBuffer *buf, __GLdrawablePrivate *glPriv, GLint bits)
buf->free = Free;
/* allocate local information */
- bufferInfo = (__GLFBbufferInfo *) __glXMalloc(sizeof(__GLFBbufferInfo));
+ bufferInfo = (__GLFBbufferInfo *) malloc(sizeof(__GLFBbufferInfo));
buf->other = (void *) bufferInfo;
pGC = CreateScratchGC(glxPriv->pDraw->pScreen,
diff --git a/nx-X11/programs/Xserver/GL/glx/glximports.c b/nx-X11/programs/Xserver/GL/glx/glximports.c
index a5a5e37ae..fb4d508a9 100644
--- a/nx-X11/programs/Xserver/GL/glx/glximports.c
+++ b/nx-X11/programs/Xserver/GL/glx/glximports.c
@@ -44,7 +44,6 @@
#include "glxserver.h"
#include "glxcontext.h"
#include "glximports.h"
-#include "GL/glx_ansic.h"
void *__glXImpMalloc(__GLcontext *gc, size_t size)
{
@@ -76,7 +75,7 @@ void *__glXImpCalloc(__GLcontext *gc, size_t numElements, size_t elementSize)
return NULL;
}
/* zero out memory */
- __glXMemset(addr, 0, size);
+ memset(addr, 0, size);
return addr;
}
@@ -119,17 +118,17 @@ void __glXImpWarning(__GLcontext *gc, char *msg)
void __glXImpFatal(__GLcontext *gc, char *msg)
{
ErrorF("%s",(char *)msg);
- __glXAbort();
+ abort();
}
char *__glXImpGetenv(__GLcontext *gc, const char *var)
{
- return __glXGetenv(var);
+ return getenv(var);
}
int __glXImpAtoi(__GLcontext *gc, const char *str)
{
- return __glXAtoi(str);
+ return atoi(str);
}
int __glXImpSprintf(__GLcontext *gc, char *str, const char *fmt, ...)
@@ -139,7 +138,7 @@ int __glXImpSprintf(__GLcontext *gc, char *str, const char *fmt, ...)
/* have to deal with var args */
va_start(ap, fmt);
- ret = __glXVsprintf(str, fmt, ap);
+ ret = vsprintf(str, fmt, ap);
va_end(ap);
return ret;
@@ -147,12 +146,12 @@ int __glXImpSprintf(__GLcontext *gc, char *str, const char *fmt, ...)
void *__glXImpFopen(__GLcontext *gc, const char *path, const char *mode)
{
- return (void *) __glXFopen(path, mode);
+ return (void *) fopen(path, mode);
}
int __glXImpFclose(__GLcontext *gc, void *stream)
{
- return __glXFclose((FILE *)stream);
+ return fclose((FILE *)stream);
}
int __glXImpFprintf(__GLcontext *gc, void *stream, const char *fmt, ...)
@@ -162,7 +161,7 @@ int __glXImpFprintf(__GLcontext *gc, void *stream, const char *fmt, ...)
/* have to deal with var args */
va_start(ap, fmt);
- ret = __glXVfprintf((FILE *)stream, fmt, ap);
+ ret = vfprintf((FILE *)stream, fmt, ap);
va_end(ap);
return ret;
diff --git a/nx-X11/programs/Xserver/GL/glx/glxpix.c b/nx-X11/programs/Xserver/GL/glx/glxpix.c
index e1628efc0..81e29a9c5 100644
--- a/nx-X11/programs/Xserver/GL/glx/glxpix.c
+++ b/nx-X11/programs/Xserver/GL/glx/glxpix.c
@@ -95,7 +95,7 @@ Free(__GLdrawableBuffer *buf, __GLdrawablePrivate *glPriv)
FreeScratchGC(bufferInfo->pGC);
}
- __glXFree(bufferInfo);
+ free(bufferInfo);
buf->other = NULL;
}
@@ -123,7 +123,7 @@ __glXInitPix(__GLdrawableBuffer *buf, __GLdrawablePrivate *glPriv,
buf->free = Free;
/* allocate local information */
- bufferInfo = (__GLPixBufferInfo *) __glXMalloc(sizeof(__GLPixBufferInfo));
+ bufferInfo = (__GLPixBufferInfo *) malloc(sizeof(__GLPixBufferInfo));
buf->other = (void *) bufferInfo;
bufferInfo->pGC = CreateScratchGC(pGlxPixmap->pDraw->pScreen,
diff --git a/nx-X11/programs/Xserver/GL/glx/glxscreens.c b/nx-X11/programs/Xserver/GL/glx/glxscreens.c
index 6b274a64b..1bff4bc3a 100644
--- a/nx-X11/programs/Xserver/GL/glx/glxscreens.c
+++ b/nx-X11/programs/Xserver/GL/glx/glxscreens.c
@@ -288,7 +288,7 @@ static void wrapPositionWindow(int screen)
void __glXHyperpipeInit(int screen, __GLXHyperpipeExtensionFuncs *funcs)
{
if (__glXNumHyperpipeFuncs < screen + 1) {
- __glXHyperpipeFuncs = __glXRealloc(__glXHyperpipeFuncs,
+ __glXHyperpipeFuncs = realloc(__glXHyperpipeFuncs,
(screen+1) * sizeof(__GLXHyperpipeExtensionFuncs));
__glXNumHyperpipeFuncs = screen + 1;
}
@@ -306,7 +306,7 @@ void __glXHyperpipeInit(int screen, __GLXHyperpipeExtensionFuncs *funcs)
void __glXSwapBarrierInit(int screen, __GLXSwapBarrierExtensionFuncs *funcs)
{
if (__glXNumSwapBarrierFuncs < screen + 1) {
- __glXSwapBarrierFuncs = __glXRealloc(__glXSwapBarrierFuncs,
+ __glXSwapBarrierFuncs = realloc(__glXSwapBarrierFuncs,
(screen+1) * sizeof(__GLXSwapBarrierExtensionFuncs));
__glXNumSwapBarrierFuncs = screen + 1;
}
@@ -327,7 +327,7 @@ void __glXScreenInit(GLint numscreens)
** This alloc has to work or else the server might as well core dump.
*/
__glXActiveScreens =
- (__GLXscreenInfo *) __glXMalloc(sizeof(__GLXscreenInfo) * numscreens);
+ (__GLXscreenInfo *) malloc(sizeof(__GLXscreenInfo) * numscreens);
for (i=0; i < numscreens; i++) {
/*
@@ -338,10 +338,10 @@ void __glXScreenInit(GLint numscreens)
__glXActiveScreens[i] = *__glXScreens[j];
__glXActiveScreens[i].numUsableVisuals = __glXActiveScreens[i].numVisuals;
- __glXActiveScreens[i].GLextensions = __glXStrdup(GLServerExtensions);
- __glXActiveScreens[i].GLXvendor = __glXStrdup(GLXServerVendorName);
- __glXActiveScreens[i].GLXversion = __glXStrdup(GLXServerVersion);
- __glXActiveScreens[i].GLXextensions = __glXStrdup(GLXServerExtensions);
+ __glXActiveScreens[i].GLextensions = strdup(GLServerExtensions);
+ __glXActiveScreens[i].GLXvendor = strdup(GLXServerVendorName);
+ __glXActiveScreens[i].GLXversion = strdup(GLXServerVersion);
+ __glXActiveScreens[i].GLXextensions = strdup(GLXServerExtensions);
__glXDrawableRes = CreateNewResourceType((DeleteType)DrawableGone);
wrapPositionWindow(i);
@@ -356,10 +356,10 @@ void __glXScreenReset(void)
int i;
for (i = 0; i < __glXNumActiveScreens; i++) {
- __glXFree(__glXActiveScreens[i].GLXvendor);
- __glXFree(__glXActiveScreens[i].GLXversion);
- __glXFree(__glXActiveScreens[i].GLXextensions);
- __glXFree(__glXActiveScreens[i].GLextensions);
+ free(__glXActiveScreens[i].GLXvendor);
+ free(__glXActiveScreens[i].GLXversion);
+ free(__glXActiveScreens[i].GLXextensions);
+ free(__glXActiveScreens[i].GLextensions);
}
free(__glXActiveScreens);
free(__glXHyperpipeFuncs);
diff --git a/nx-X11/programs/Xserver/GL/glx/glxserver.h b/nx-X11/programs/Xserver/GL/glx/glxserver.h
index a991f907e..2debc8435 100644
--- a/nx-X11/programs/Xserver/GL/glx/glxserver.h
+++ b/nx-X11/programs/Xserver/GL/glx/glxserver.h
@@ -50,7 +50,6 @@
#include <extnsionst.h>
#include <resource.h>
#include <scrnintstr.h>
-#include "GL/glx_ansic.h"
#include "protocol-versions.h"
#include <limits.h>
diff --git a/nx-X11/programs/Xserver/GL/glx/glxutil.c b/nx-X11/programs/Xserver/GL/glx/glxutil.c
index 5d40bc832..b4cd10a84 100644
--- a/nx-X11/programs/Xserver/GL/glx/glxutil.c
+++ b/nx-X11/programs/Xserver/GL/glx/glxutil.c
@@ -47,7 +47,6 @@
#include <windowstr.h>
#include "glxutil.h"
#include "glxbuf.h"
-#include "GL/glx_ansic.h"
#include "GL/internal/glcore.h"
#include "GL/glxint.h"
#include "glcontextmodes.h"
@@ -58,81 +57,8 @@ void __glXNop(void) {}
/************************************************************************/
-/* Memory Allocation for GLX */
-
-void *
-__glXMalloc(size_t size)
-{
- void *addr;
-
- if (size == 0) {
- return NULL;
- }
- addr = (void *) malloc(size);
- if (addr == NULL) {
- /* XXX: handle out of memory error */
- return NULL;
- }
- return addr;
-}
-
-void *
-__glXCalloc(size_t numElements, size_t elementSize)
-{
- void *addr;
- size_t size;
-
- if ((numElements == 0) || (elementSize == 0)) {
- return NULL;
- }
- size = numElements * elementSize;
- addr = (void *) malloc(size);
- if (addr == NULL) {
- /* XXX: handle out of memory error */
- return NULL;
- }
- __glXMemset(addr, 0, size);
- return addr;
-}
-
-void *
-__glXRealloc(void *addr, size_t newSize)
-{
- void *newAddr;
-
- if (addr) {
- if (newSize == 0) {
- free(addr);
- return NULL;
- } else {
- newAddr = realloc(addr, newSize);
- }
- } else {
- if (newSize == 0) {
- return NULL;
- } else {
- newAddr = malloc(newSize);
- }
- }
- if (newAddr == NULL) {
- return NULL; /* XXX: out of memory */
- }
-
- return newAddr;
-}
-
-void
-__glXFree(void *addr)
-{
- if (addr) {
- free(addr);
- }
-}
-
-/************************************************************************/
/* Context stuff */
-
/*
** associate a context with a drawable
*/
@@ -299,8 +225,8 @@ __glXCreateDrawablePrivate(DrawablePtr pDraw, XID drawId,
__GLdrawablePrivate *glPriv;
__GLXscreenInfo *pGlxScreen;
- glxPriv = (__GLXdrawablePrivate *) __glXMalloc(sizeof(*glxPriv));
- __glXMemset(glxPriv, 0, sizeof(__GLXdrawablePrivate));
+ glxPriv = (__GLXdrawablePrivate *) malloc(sizeof(*glxPriv));
+ memset(glxPriv, 0, sizeof(__GLXdrawablePrivate));
glxPriv->type = pDraw->type;
glxPriv->pDraw = pDraw;
@@ -312,18 +238,18 @@ __glXCreateDrawablePrivate(DrawablePtr pDraw, XID drawId,
/* since we are creating the drawablePrivate, drawId should be new */
if (!AddResource(drawId, __glXDrawableRes, glxPriv)) {
/* oops! */
- __glXFree(glxPriv);
+ free(glxPriv);
return NULL;
}
/* fill up glPriv */
glPriv = &glxPriv->glPriv;
- glPriv->modes = (__GLcontextModes *) __glXMalloc(sizeof(__GLcontextModes));
+ glPriv->modes = (__GLcontextModes *) malloc(sizeof(__GLcontextModes));
*glPriv->modes = *modes;
- glPriv->malloc = __glXMalloc;
- glPriv->calloc = __glXCalloc;
- glPriv->realloc = __glXRealloc;
- glPriv->free = __glXFree;
+ glPriv->malloc = malloc;
+ glPriv->calloc = calloc;
+ glPriv->realloc = realloc;
+ glPriv->free = free;
glPriv->addSwapRect = NULL;
glPriv->setClipRect = (void (*)(__GLdrawablePrivate *, GLint, GLint, GLsizei, GLsizei)) __glXNop;
glPriv->lockDP = LockDP;
@@ -334,7 +260,7 @@ __glXCreateDrawablePrivate(DrawablePtr pDraw, XID drawId,
/* allocate a one-rect ownership region */
glPriv->ownershipRegion.rects =
- (__GLregionRect *)__glXCalloc(1, sizeof(__GLregionRect));
+ (__GLregionRect *)calloc(1, sizeof(__GLregionRect));
glPriv->ownershipRegion.numRects = 1;
glxPriv->freeBuffers = __glXFreeBuffers;
@@ -377,9 +303,9 @@ __glXDestroyDrawablePrivate(__GLXdrawablePrivate *glxPriv)
}
/* Free the drawable Private */
- __glXFree(glxPriv->glPriv.modes);
- __glXFree(glxPriv->glPriv.ownershipRegion.rects);
- __glXFree(glxPriv);
+ free(glxPriv->glPriv.modes);
+ free(glxPriv->glPriv.ownershipRegion.rects);
+ free(glxPriv);
return GL_TRUE;
}
diff --git a/nx-X11/programs/Xserver/GL/glx/glxutil.h b/nx-X11/programs/Xserver/GL/glx/glxutil.h
index 7231c949f..a0a2e57b7 100644
--- a/nx-X11/programs/Xserver/GL/glx/glxutil.h
+++ b/nx-X11/programs/Xserver/GL/glx/glxutil.h
@@ -42,12 +42,6 @@
extern void __glXNop(void);
-/* memory management */
-extern void *__glXMalloc(size_t size);
-extern void *__glXCalloc(size_t numElements, size_t elementSize);
-extern void *__glXRealloc(void *addr, size_t newSize);
-extern void __glXFree(void *ptr);
-
/* relate contexts with drawables */
extern void __glXAssociateContext(__GLXcontext *glxc);
extern void __glXDeassociateContext(__GLXcontext *glxc);
diff --git a/nx-X11/programs/Xserver/GL/glx/single2.c b/nx-X11/programs/Xserver/GL/glx/single2.c
index d36e57739..47ba628af 100644
--- a/nx-X11/programs/Xserver/GL/glx/single2.c
+++ b/nx-X11/programs/Xserver/GL/glx/single2.c
@@ -46,7 +46,6 @@
#include "glxext.h"
#include "unpack.h"
#include "g_disptab.h"
-#include "GL/glx_ansic.h"
int __glXDisp_FeedbackBuffer(__GLXclientState *cl, GLbyte *pc)
{
@@ -67,7 +66,7 @@ int __glXDisp_FeedbackBuffer(__GLXclientState *cl, GLbyte *pc)
size = *(GLsizei *)(pc+0);
type = *(GLenum *)(pc+4);
if (cx->feedbackBufSize < size) {
- cx->feedbackBuf = (GLfloat *) __glXRealloc(cx->feedbackBuf,
+ cx->feedbackBuf = (GLfloat *) realloc(cx->feedbackBuf,
(size_t)size
* __GLX_SIZE_FLOAT32);
if (!cx->feedbackBuf) {
@@ -97,7 +96,7 @@ int __glXDisp_SelectBuffer(__GLXclientState *cl, GLbyte *pc)
pc += __GLX_SINGLE_HDR_SIZE;
size = *(GLsizei *)(pc+0);
if (cx->selectBufSize < size) {
- cx->selectBuf = (GLuint *) __glXRealloc(cx->selectBuf,
+ cx->selectBuf = (GLuint *) realloc(cx->selectBuf,
(size_t) size
* __GLX_SIZE_CARD32);
if (!cx->selectBuf) {
@@ -268,24 +267,30 @@ char *__glXcombine_strings(const char *cext_string, const char *sext_string)
** pull tokens out of shortest string
** include space in combo_string for final separator and null terminator
*/
- if ( (clen = __glXStrlen(cext_string)) > (slen = __glXStrlen(sext_string)) ) {
- combo_string = (char *) __glXMalloc(slen + 2);
- s1 = (char *) __glXMalloc(slen + 2); __glXStrcpy(s1, sext_string);
+ clen = strlen(cext_string);
+ slen = strlen(sext_string);
+ if (clen > slen) {
+ combo_string = (char *) malloc(slen + 2);
+ s1 = (char *) malloc(slen + 2);
+ strcpy(s1, sext_string);
s2 = cext_string;
} else {
- combo_string = (char *) __glXMalloc(clen + 2);
- s1 = (char *) __glXMalloc(clen + 2); __glXStrcpy(s1, cext_string);
+ combo_string = (char *) malloc(clen + 2);
+ s1 = (char *) malloc(clen + 2);
+ strcpy(s1, cext_string);
s2 = sext_string;
}
if (!combo_string || !s1) {
- if (combo_string) __glXFree(combo_string);
- if (s1) __glXFree(s1);
+ if (combo_string)
+ free(combo_string);
+ if (s1)
+ free(s1);
return NULL;
}
combo_string[0] = '\0';
/* Get first extension token */
- token = __glXStrtok( s1, SEPARATOR);
+ token = strtok( s1, SEPARATOR);
while ( token != NULL ) {
/*
@@ -293,20 +298,20 @@ char *__glXcombine_strings(const char *cext_string, const char *sext_string)
** beware of extension names which are prefixes of other extension names
*/
const char *p = s2;
- end = p + __glXStrlen(p);
+ end = p + strlen(p);
while (p < end) {
- size_t n = __glXStrcspn(p, SEPARATOR);
- if ((__glXStrlen(token) == n) && (__glXStrncmp(token, p, n) == 0)) {
- combo_string = __glXStrcat( combo_string, token);
- combo_string = __glXStrcat( combo_string, SEPARATOR);
+ size_t n = strcspn(p, SEPARATOR);
+ if ((strlen(token) == n) && (strncmp(token, p, n) == 0)) {
+ combo_string = strcat(combo_string, token);
+ combo_string = strcat(combo_string, SEPARATOR);
}
p += (n + 1);
}
/* Get next extension token */
- token = __glXStrtok( NULL, SEPARATOR);
+ token = strtok( NULL, SEPARATOR);
}
- __glXFree(s1);
+ free(s1);
return combo_string;
}
@@ -351,26 +356,24 @@ int DoGetString(__GLXclientState *cl, GLbyte *pc, GLboolean need_swap)
buf = __glXcombine_strings(buf1,
cx->pGlxScreen->GLextensions);
if (buf1 != NULL) {
- __glXFree(buf1);
+ free(buf1);
}
string = buf;
}
else if ( name == GL_VERSION ) {
if ( atof( string ) > atof( GLServerVersion ) ) {
- buf = __glXMalloc( __glXStrlen( string )
- + __glXStrlen( GLServerVersion )
- + 4 );
+ buf = malloc( strlen( string ) + strlen( GLServerVersion ) + 4 );
if ( buf == NULL ) {
string = GLServerVersion;
}
else {
- __glXSprintf( buf, "%s (%s)", GLServerVersion, string );
+ sprintf( buf, "%s (%s)", GLServerVersion, string );
string = buf;
}
}
}
if (string) {
- length = __glXStrlen((const char *) string) + 1;
+ length = strlen((const char *) string) + 1;
}
__GLX_BEGIN_REPLY(length);
@@ -384,7 +387,7 @@ int DoGetString(__GLXclientState *cl, GLbyte *pc, GLboolean need_swap)
__GLX_SEND_HEADER();
WriteToClient(client, length, string);
if (buf != NULL) {
- __glXFree(buf);
+ free(buf);
}
return Success;
}
diff --git a/nx-X11/programs/Xserver/GL/glx/single2swap.c b/nx-X11/programs/Xserver/GL/glx/single2swap.c
index ca8ac2a85..6fdc7e7f2 100644
--- a/nx-X11/programs/Xserver/GL/glx/single2swap.c
+++ b/nx-X11/programs/Xserver/GL/glx/single2swap.c
@@ -42,7 +42,6 @@
#include "glxext.h"
#include "unpack.h"
#include "g_disptab.h"
-#include "GL/glx_ansic.h"
int __glXDispSwap_FeedbackBuffer(__GLXclientState *cl, GLbyte *pc)
{
@@ -66,7 +65,7 @@ int __glXDispSwap_FeedbackBuffer(__GLXclientState *cl, GLbyte *pc)
size = *(GLsizei *)(pc+0);
type = *(GLenum *)(pc+4);
if (cx->feedbackBufSize < size) {
- cx->feedbackBuf = (GLfloat *) __glXRealloc(cx->feedbackBuf,
+ cx->feedbackBuf = (GLfloat *) realloc(cx->feedbackBuf,
(size_t) size
* __GLX_SIZE_FLOAT32);
if (!cx->feedbackBuf) {
@@ -99,7 +98,7 @@ int __glXDispSwap_SelectBuffer(__GLXclientState *cl, GLbyte *pc)
__GLX_SWAP_INT(pc+0);
size = *(GLsizei *)(pc+0);
if (cx->selectBufSize < size) {
- cx->selectBuf = (GLuint *) __glXRealloc(cx->selectBuf,
+ cx->selectBuf = (GLuint *) realloc(cx->selectBuf,
(size_t) size
* __GLX_SIZE_CARD32);
if (!cx->selectBuf) {
diff --git a/nx-X11/programs/Xserver/GL/glx/xfont.c b/nx-X11/programs/Xserver/GL/glx/xfont.c
index b5869cf44..581a6f22b 100644
--- a/nx-X11/programs/Xserver/GL/glx/xfont.c
+++ b/nx-X11/programs/Xserver/GL/glx/xfont.c
@@ -77,7 +77,7 @@ static int __glXMakeBitmapFromGlyph(FontPtr font, CharInfoPtr pci)
p = buf;
allocbuf = 0;
} else {
- p = (unsigned char *) __glXMalloc(allocBytes);
+ p = (unsigned char *) malloc(allocBytes);
if (!p)
return BadAlloc;
allocbuf = p;
@@ -99,7 +99,7 @@ static int __glXMakeBitmapFromGlyph(FontPtr font, CharInfoPtr pci)
pci->metrics.characterWidth, 0, allocbuf ? allocbuf : buf);
if (allocbuf) {
- __glXFree(allocbuf);
+ free(allocbuf);
}
return Success;
#undef __GL_CHAR_BUF_SIZE