Unverified Commit c893ad65 authored by Mike Gabriel's avatar Mike Gabriel

Merge branch 'sunweaver-pr/drop-glx-ansic' into 3.6.x

parents b38d5b97 4e33fd4b
......@@ -31,31 +31,17 @@
* \author Ian Romanick <idr@us.ibm.com>
*/
#if defined(IN_MINI_GLX)
# include <stdlib.h>
# include <string.h>
#if defined(IN_MINI_GLX)
# include <GL/gl.h>
# include "GL/internal/dri_interface.h"
# include "imports.h"
# define __glXMemset memset
#else
# include <nx-X11/X.h>
# include <GL/glx.h>
# include "GL/glxint.h"
# ifdef XFree86Server
void *memset( void * ptr, int val, size_t size);
# include "GL/glx_ansic.h"
extern void * __glXMalloc( size_t size );
extern void __glXFree( void * ptr );
# define _mesa_malloc(b) __glXMalloc(b)
# define _mesa_free(m) __glXFree(m)
# else
# include <nx-X11/Xlibint.h>
# define __glXMemset memset
# define _mesa_malloc(b) Xmalloc(b)
# define _mesa_free(m) Xfree(m)
# endif /* XFree86Server */
#endif /* !defined(IN_MINI_GLX) */
#include "glcontextmodes.h"
......@@ -127,7 +113,7 @@ _gl_copy_visual_to_context_mode( __GLcontextModes * mode,
{
__GLcontextModes * const next = mode->next;
(void) __glXMemset( mode, 0, sizeof( __GLcontextModes ) );
(void) memset( mode, 0, sizeof( __GLcontextModes ) );
mode->next = next;
mode->visualID = config->vid;
......@@ -361,14 +347,14 @@ _gl_context_modes_create( unsigned count, size_t minimum_size )
next = & base;
for ( i = 0 ; i < count ; i++ ) {
*next = (__GLcontextModes *) _mesa_malloc( size );
*next = (__GLcontextModes *) malloc( size );
if ( *next == NULL ) {
_gl_context_modes_destroy( base );
base = NULL;
break;
}
(void) __glXMemset( *next, 0, size );
(void) memset( *next, 0, size );
(*next)->visualID = GLX_DONT_CARE;
(*next)->visualType = GLX_DONT_CARE;
(*next)->visualRating = GLX_NONE;
......@@ -402,7 +388,7 @@ _gl_context_modes_destroy( __GLcontextModes * modes )
while ( modes != NULL ) {
__GLcontextModes * const next = modes->next;
_mesa_free( modes );
free( modes );
modes = next;
}
}
......
......@@ -38,7 +38,6 @@
# include "resource.h"
# include "windowstr.h"
# include "gcstruct.h"
# include "GL/xf86glx.h"
# include "xf86glx_util.h"
#else
......
......@@ -28,7 +28,6 @@
#ifdef XFree86Server
# include "GL/xf86glx.h"
# include "xf86glx_util.h"
#elif defined(USE_XSHM)
# include <X11/extensions/XShm.h>
......
......@@ -195,10 +195,10 @@ int _slang_execute (const slang_assembly_file *file)
/* XXX why???, disabling the pointer size assertions here.
* See bug 4021.
*/
static_assert(sizeof (GLfloat) == 4);
/*static_assert(sizeof (GLfloat *) == 4);*/
static_assert(sizeof (GLuint) == 4);
/*static_assert(sizeof (GLuint *) == 4);*/
_static_assert(sizeof (GLfloat) == 4);
/*_static_assert(sizeof (GLfloat *) == 4);*/
_static_assert(sizeof (GLuint) == 4);
/*_static_assert(sizeof (GLuint *) == 4);*/
dump (file);
......
......@@ -32,7 +32,7 @@ extern "C" {
/* Compile-time assertions. If the expression is zero, try to declare an
* array of size [-1] to cause compilation error.
*/
#define static_assert(expr) do { int _array[(expr) ? 1 : -1]; _array[0]; } while (0)
#define _static_assert(expr) do { int _array[(expr) ? 1 : -1]; _array[0]; } while (0)
void slang_alloc_free (void *);
void *slang_alloc_malloc (unsigned int);
......
......@@ -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,9 +1626,9 @@ 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,
cl->largeCmdBuf = (GLbyte *) realloc(cl->largeCmdBuf,
(size_t)cmdlen);
}
if (!cl->largeCmdBuf) {
......@@ -1636,7 +1636,7 @@ int __glXRenderLarge(__GLXclientState *cl, GLbyte *pc)
}
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;
}
......
......@@ -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++;
......
......@@ -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) {
......
......@@ -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,
......
......@@ -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;
......
......@@ -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,
......
......@@ -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);
......
......@@ -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>
......
......@@ -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;
}
......
......@@ -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);
......
......@@ -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;
}
......
......@@ -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) {
......
......@@ -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
......
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#ifndef _glx_ansic_h_
#define _glx_ansic_h_
/*
** License Applicability. Except to the extent portions of this file are
** made subject to an alternative license as permitted in the SGI Free
** Software License B, Version 1.1 (the "License"), the contents of this
** file are subject only to the provisions of the License. You may not use
** this file except in compliance with the License. You may obtain a copy
** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
**
** http://oss.sgi.com/projects/FreeB
**
** Note that, as provided in the License, the Software is distributed on an
** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
** PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
**
** Original Code. The Original Code is: OpenGL Sample Implementation,
** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
** Copyright in any portions created by third parties is as indicated
** elsewhere herein. All Rights Reserved.
**
** Additional Notice Provisions: The application programming interfaces
** established by SGI in conjunction with the Original Code are The
** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version
** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X
** Window System(R) (Version 1.3), released October 19, 1998. This software
** was created using the OpenGL(R) version 1.2.1 Sample Implementation
** published by SGI, but has not been independently verified as being
** compliant with the OpenGL(R) version 1.2.1 Specification.
*/
/*
** this needs to check whether we're using XFree86 at all, and then
** which version we're using. Use these macros if version is 3.9+, else
** use normal commands below.
*/
/*
** turns out this include file only exists for XFree86 3.9+
** I notice that not having it is not an error and does not stop the build,
** but having it will allow opengl and glx to be built for 3.9+. We no longer
** need an explicit define in the Makefile, just point to the correct X source
** tree and all should be taken care of.
*/
#ifdef XFree86Server
#ifndef assert
#define assert(a)
#endif
#else
#if defined(Lynx) && defined(__assert_h)
#undef __assert_h
#endif
#ifdef assert
#undef assert
#endif
#include <assert.h>
#endif
#define GLX_STDOUT stdout
#define GLX_STDERR stderr
#define __glXPrintf printf
#define __glXFprintf fprintf
#define __glXSprintf sprintf
#define __glXVfprintf vfprintf
#define __glXVsprintf vsprintf
#define __glXFopen fopen
#define __glXFclose fclose
#define __glXCos(x) cos(x)
#define __glXSin(x) sin(x)
#define __glXAtan(x) atan(x)
#define __glXAbs(x) abs(x)
#define __glXLog(x) log(x)
#define __glXCeil(x) ceil(x)
#define __glXFloor(x) floor(x)
#define __glXSqrt(x) sqrt(x)
#define __glXPow(x, y) pow(x, y)
#define __glXMemmove(dest, src, n) memmove(dest, src, n)
#define __glXMemcpy(dest, src, n) memcpy(dest, src, n)
#define __glXMemset(s, c, n) memset(s, c, n)
#define __glXStrdup(str) xstrdup(str)
#define __glXStrcpy(dest, src) strcpy(dest, src)
#define __glXStrncpy(dest, src, n) strncpy(dest, src, n)
#define __glXStrcat(dest, src) strcat(dest, src)
#define __glXStrncat(dest, src, n) strncat(dest, src, n)
#define __glXStrcmp(s1, s2) strcmp(s1, s2)
#define __glXStrncmp(s1, s2, n) strncmp(s1, s2, n)
#define __glXStrlen(str) strlen(str)
#define __glXAbort() abort()
#define __glXStrtok(s, delim) strtok(s, delim)
#define __glXStrcspn(s, reject) strcspn(s, reject)
#define __glXGetenv(a) getenv(a)
#define __glXAtoi(a) atoi(a)
#endif /* _glx_ansic_h_ */
/**************************************************************************
Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
All Rights Reserved.
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sub license, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice (including the
next paragraph) shall be included in all copies or substantial portions
of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
**************************************************************************/
/*
* Authors:
* Kevin E. Martin <kevin@precisioninsight.com>
*
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include "miscstruct.h"
......@@ -52,7 +52,6 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "xf86glxint.h"
#include "context.h"
#include "xmesaP.h"
#include <GL/xf86glx.h>
#include "context.h"
/*
......@@ -319,15 +318,15 @@ static Bool init_visuals(int *nvisualp, VisualPtr *visualp,
/* Alloc space for the list of new GLX visuals */
pNewVisualConfigs = (__GLXvisualConfig *)
__glXMalloc(numNewConfigs * sizeof(__GLXvisualConfig));
malloc(numNewConfigs * sizeof(__GLXvisualConfig));
if (!pNewVisualConfigs) {
return FALSE;
}
/* Alloc space for the list of new GLX visual privates */
pNewVisualPriv = (void **) __glXMalloc(numNewConfigs * sizeof(void *));
pNewVisualPriv = (void **) malloc(numNewConfigs * sizeof(void *));
if (!pNewVisualPriv) {
__glXFree(pNewVisualConfigs);
free(pNewVisualConfigs);
return FALSE;
}
......@@ -371,40 +370,40 @@ static Bool init_visuals(int *nvisualp, VisualPtr *visualp,
numConfigs = 0;
/* Alloc temp space for the list of orig VisualIDs for each new visual */
orig_vid = (VisualID *)__glXMalloc(numNewVisuals * sizeof(VisualID));
orig_vid = (VisualID *)malloc(numNewVisuals * sizeof(VisualID));
if (!orig_vid) {
__glXFree(pNewVisualPriv);
__glXFree(pNewVisualConfigs);
free(pNewVisualPriv);
free(pNewVisualConfigs);
return FALSE;
}
/* Alloc space for the list of glXVisuals */
modes = _gl_context_modes_create(numNewVisuals, sizeof(__GLcontextModes));
if (modes == NULL) {
__glXFree(orig_vid);
__glXFree(pNewVisualPriv);
__glXFree(pNewVisualConfigs);
free(orig_vid);
free(pNewVisualPriv);
free(pNewVisualConfigs);
return FALSE;
}
/* Alloc space for the list of glXVisualPrivates */
glXVisualPriv = (void **)__glXMalloc(numNewVisuals * sizeof(void *));
glXVisualPriv = (void **)malloc(numNewVisuals * sizeof(void *));
if (!glXVisualPriv) {
_gl_context_modes_destroy( modes );
__glXFree(orig_vid);
__glXFree(pNewVisualPriv);
__glXFree(pNewVisualConfigs);
free(orig_vid);
free(pNewVisualPriv);
free(pNewVisualConfigs);
return FALSE;
}
/* Alloc space for the new list of the X server's visuals */
pVisualNew = (VisualPtr)__glXMalloc(numNewVisuals * sizeof(VisualRec));
pVisualNew = (VisualPtr)malloc(numNewVisuals * sizeof(VisualRec));
if (!pVisualNew) {
__glXFree(glXVisualPriv);
free(glXVisualPriv);
_gl_context_modes_destroy( modes );
__glXFree(orig_vid);
__glXFree(pNewVisualPriv);
__glXFree(pNewVisualConfigs);
free(orig_vid);
free(pNewVisualPriv);
free(pNewVisualConfigs);
return FALSE;
}
......@@ -487,7 +486,7 @@ static Bool init_visuals(int *nvisualp, VisualPtr *visualp,
numVids++;
/* Allocate a new list of VisualIDs for this depth */
pVids = (VisualID *)__glXMalloc(numVids * sizeof(VisualID));
pVids = (VisualID *)malloc(numVids * sizeof(VisualID));
/* Initialize the new list of VisualIDs for this depth */
for (j = 0; j < pdepth[i].numVids; j++)
......@@ -496,7 +495,7 @@ static Bool init_visuals(int *nvisualp, VisualPtr *visualp,
pVids[n++] = pVisualNew[k].vid;
/* Update this depth's list of VisualIDs */
__glXFree(pdepth[i].vids);
free(pdepth[i].vids);
pdepth[i].vids = pVids;
pdepth[i].numVids = numVids;
}
......@@ -506,12 +505,12 @@ static Bool init_visuals(int *nvisualp, VisualPtr *visualp,
*visualp = pVisualNew;
/* Free the old list of the X server's visuals */
__glXFree(pVisual);
free(pVisual);
/* Clean up temporary allocations */
__glXFree(orig_vid);
__glXFree(pNewVisualPriv);
__glXFree(pNewVisualConfigs);
free(orig_vid);
free(pNewVisualPriv);
free(pNewVisualConfigs);
/* Free the private list created by DDX HW driver */
if (visualPrivates)
......@@ -581,19 +580,19 @@ static void init_screen_visuals(int screen)
int i, j;
/* Alloc space for the list of XMesa visuals */
pXMesaVisual = (XMesaVisual *)__glXMalloc(MESAScreens[screen].num_vis *
pXMesaVisual = (XMesaVisual *)malloc(MESAScreens[screen].num_vis *
sizeof(XMesaVisual));
__glXMemset(pXMesaVisual, 0,
memset(pXMesaVisual, 0,
MESAScreens[screen].num_vis * sizeof(XMesaVisual));
/* FIXME: Change 'used' to be a array of bits (rather than of ints),
* FIXME: create a stack array of 8 or 16 bytes. If 'numVisuals' is less
* FIXME: than 64 or 128 the stack array can be used instead of calling
* FIXME: __glXMalloc / __glXFree. If nothing else, convert 'used' to
* FIXME: malloc / free. If nothing else, convert 'used' to
* FIXME: array of bytes instead of ints!
*/
used = (int *)__glXMalloc(pScreen->numVisuals * sizeof(int));
__glXMemset(used, 0, pScreen->numVisuals * sizeof(int));
used = (int *)malloc(pScreen->numVisuals * sizeof(int));
memset(used, 0, pScreen->numVisuals * sizeof(int));
i = 0;
for ( modes = MESAScreens[screen].modes
......@@ -652,7 +651,7 @@ static void init_screen_visuals(int screen)
i++;
}
__glXFree(used);
free(used);
MESAScreens[screen].xm_vis = pXMesaVisual;
}
......@@ -703,9 +702,9 @@ extern void __MESA_resetExtension(void)
}
_gl_context_modes_destroy( MESAScreens[i].modes );
MESAScreens[i].modes = NULL;
__glXFree(MESAScreens[i].private);
free(MESAScreens[i].private);
MESAScreens[i].private = NULL;
__glXFree(MESAScreens[i].xm_vis);
free(MESAScreens[i].xm_vis);
MESAScreens[i].xm_vis = NULL;
MESAScreens[i].num_vis = 0;
}
......@@ -725,7 +724,7 @@ void __MESA_createBuffer(__GLXdrawablePrivate *glxPriv)
ErrorF("find_mesa_visual returned NULL for visualID = 0x%04x\n",
glxPriv->modes->visualID);
}
buf = (__MESA_buffer)__glXMalloc(sizeof(struct __MESA_bufferRec));
buf = (__MESA_buffer)malloc(sizeof(struct __MESA_bufferRec));
/* Create Mesa's buffers */
if (glxPriv->type == DRAWABLE_WINDOW) {
......@@ -793,7 +792,7 @@ void __MESA_destroyBuffer(__GLdrawablePrivate *glPriv)
glxPriv->swapBuffers = buf->fbswap;
glPriv->frontBuffer.resize = buf->fbresize;
__glXFree(glPriv->private);
free(glPriv->private);
glPriv->private = NULL;
}
......
......@@ -41,7 +41,6 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "pixmapstr.h"
#include "xf86glx_util.h"
#include <nx-X11/Xmd.h>
#include "GL/xf86glx.h"
#ifdef ROUNDUP
#undef ROUNDUP
......
......@@ -67,12 +67,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) {
......@@ -145,12 +145,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) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment