Check for glproto when building GLX and make sure we have at least 1.4.6.
Drop glx_ansic.h wrapper and call xalloc, xrealloc, xfree and str-funcs
    directly.
			
			
This commit is contained in:
		
							parent
							
								
									2c11cde336
								
							
						
					
					
						commit
						2d2d38d17c
					
				
							
								
								
									
										10
									
								
								ChangeLog
								
								
								
								
							
							
						
						
									
										10
									
								
								ChangeLog
								
								
								
								
							|  | @ -1,3 +1,13 @@ | ||||||
|  | 2006-03-16  Kristian Høgsberg  <krh@redhat.com> | ||||||
|  | 
 | ||||||
|  | 	* configure.ac: Check for glproto when building GLX and make sure | ||||||
|  | 	we have at least 1.4.6. | ||||||
|  | 
 | ||||||
|  | 	* GL/glx/*.c: Drop glx_ansic.h wrapper and call xalloc, xrealloc, | ||||||
|  | 	xfree and str-funcs directly. | ||||||
|  | 	 | ||||||
|  | 	* GL/glx/glxcmds.c (GlxSetRenderTables): Really add this. | ||||||
|  | 
 | ||||||
| 2006-03-16  Kristian Høgsberg  <krh@redhat.com> | 2006-03-16  Kristian Høgsberg  <krh@redhat.com> | ||||||
| 
 | 
 | ||||||
| 	More patches from David Reveman: | 	More patches from David Reveman: | ||||||
|  |  | ||||||
|  | @ -22,7 +22,6 @@ AM_CFLAGS = \ | ||||||
| #sdk_HEADERS =
 | #sdk_HEADERS =
 | ||||||
| 
 | 
 | ||||||
| INCLUDES = \
 | INCLUDES = \
 | ||||||
| 	-I$(top_srcdir)/GL/include \
 |  | ||||||
| 	-I$(top_srcdir)/hw/xfree86/os-support \
 | 	-I$(top_srcdir)/hw/xfree86/os-support \
 | ||||||
| 	-I$(top_srcdir)/hw/xfree86/os-support/bus \
 | 	-I$(top_srcdir)/hw/xfree86/os-support/bus \
 | ||||||
| 	-I$(top_srcdir)/hw/xfree86/common \
 | 	-I$(top_srcdir)/hw/xfree86/common \
 | ||||||
|  |  | ||||||
|  | @ -41,6 +41,7 @@ | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
| #include <string.h> | #include <string.h> | ||||||
|  | #include <assert.h> | ||||||
| 
 | 
 | ||||||
| #include "glxserver.h" | #include "glxserver.h" | ||||||
| #include <GL/glxtokens.h> | #include <GL/glxtokens.h> | ||||||
|  | @ -51,7 +52,6 @@ | ||||||
| #include "g_disptab_EXT.h" | #include "g_disptab_EXT.h" | ||||||
| #include "glxutil.h" | #include "glxutil.h" | ||||||
| #include "glxext.h" | #include "glxext.h" | ||||||
| #include "GL/glx_ansic.h" |  | ||||||
| #include "glcontextmodes.h" | #include "glcontextmodes.h" | ||||||
| #include "glapitable.h" | #include "glapitable.h" | ||||||
| #include "glapi.h" | #include "glapi.h" | ||||||
|  | @ -99,7 +99,7 @@ __glXContextDestroy(__GLXcontext *context) | ||||||
| static void __glXdirectContextDestroy(__GLXcontext *context) | static void __glXdirectContextDestroy(__GLXcontext *context) | ||||||
| { | { | ||||||
|     __glXContextDestroy(context); |     __glXContextDestroy(context); | ||||||
|     __glXFree(context); |     xfree(context); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static __GLXcontext *__glXdirectContextCreate(__GLXscreen *screen, | static __GLXcontext *__glXdirectContextCreate(__GLXscreen *screen, | ||||||
|  | @ -108,7 +108,7 @@ static __GLXcontext *__glXdirectContextCreate(__GLXscreen *screen, | ||||||
| { | { | ||||||
|     __GLXcontext *context; |     __GLXcontext *context; | ||||||
| 
 | 
 | ||||||
|     context = __glXMalloc (sizeof (__GLXcontext)); |     context = xalloc (sizeof (__GLXcontext)); | ||||||
|     if (context == NULL) |     if (context == NULL) | ||||||
| 	return NULL; | 	return NULL; | ||||||
| 
 | 
 | ||||||
|  | @ -344,9 +344,9 @@ static int AddCurrentContext(__GLXclientState *cl, __GLXcontext *glxc) | ||||||
|     ** Didn't find a free slot, so we'll have to grow the table. |     ** Didn't find a free slot, so we'll have to grow the table. | ||||||
|     */ |     */ | ||||||
|     if (!num) { |     if (!num) { | ||||||
| 	table = (__GLXcontext **) __glXMalloc(sizeof(__GLXcontext *)); | 	table = (__GLXcontext **) xalloc(sizeof(__GLXcontext *)); | ||||||
|     } else { |     } else { | ||||||
| 	table = (__GLXcontext **) __glXRealloc(table, | 	table = (__GLXcontext **) xrealloc(table, | ||||||
| 					   (num+1)*sizeof(__GLXcontext *)); | 					   (num+1)*sizeof(__GLXcontext *)); | ||||||
|     } |     } | ||||||
|     table[num] = glxc; |     table[num] = glxc; | ||||||
|  | @ -688,7 +688,7 @@ int DoMakeCurrent( __GLXclientState *cl, | ||||||
| 		    ** refcount of the X pixmap and free only if it's zero. | 		    ** refcount of the X pixmap and free only if it's zero. | ||||||
| 		    */ | 		    */ | ||||||
| 		    (*prevglxc->readPixmap->pScreen->DestroyPixmap)(pPixmap); | 		    (*prevglxc->readPixmap->pScreen->DestroyPixmap)(pPixmap); | ||||||
| 		    __glXFree(prevglxc->readPixmap); | 		    xfree(prevglxc->readPixmap); | ||||||
| 		} | 		} | ||||||
| 	    } | 	    } | ||||||
| 
 | 
 | ||||||
|  | @ -704,7 +704,7 @@ int DoMakeCurrent( __GLXclientState *cl, | ||||||
| 		** refcount of the X pixmap and free only if it's zero. | 		** refcount of the X pixmap and free only if it's zero. | ||||||
| 		*/ | 		*/ | ||||||
| 		(*prevglxc->drawPixmap->pScreen->DestroyPixmap)(pPixmap); | 		(*prevglxc->drawPixmap->pScreen->DestroyPixmap)(pPixmap); | ||||||
| 		__glXFree(prevglxc->drawPixmap); | 		xfree(prevglxc->drawPixmap); | ||||||
| 	    } | 	    } | ||||||
| 
 | 
 | ||||||
| 	    prevglxc->drawPixmap = NULL; | 	    prevglxc->drawPixmap = NULL; | ||||||
|  | @ -1257,7 +1257,7 @@ int DoCreateGLXPixmap(__GLXclientState *cl, VisualID visual, | ||||||
| 	return BadValue; | 	return BadValue; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     pGlxPixmap = (__GLXpixmap *) __glXMalloc(sizeof(__GLXpixmap)); |     pGlxPixmap = (__GLXpixmap *) xalloc(sizeof(__GLXpixmap)); | ||||||
|     if (!pGlxPixmap) { |     if (!pGlxPixmap) { | ||||||
| 	return BadAlloc; | 	return BadAlloc; | ||||||
|     } |     } | ||||||
|  | @ -1447,7 +1447,7 @@ int __glXQueryContextInfoEXT(__GLXclientState *cl, GLbyte *pc) | ||||||
|     reply.n = nProps; |     reply.n = nProps; | ||||||
| 
 | 
 | ||||||
|     nReplyBytes = reply.length << 2; |     nReplyBytes = reply.length << 2; | ||||||
|     sendBuf = (int *)__glXMalloc((size_t)nReplyBytes); |     sendBuf = (int *)xalloc((size_t)nReplyBytes); | ||||||
|     if (sendBuf == NULL) { |     if (sendBuf == NULL) { | ||||||
| 	return __glXBadContext;	/* XXX: Is this correct? */ | 	return __glXBadContext;	/* XXX: Is this correct? */ | ||||||
|     } |     } | ||||||
|  | @ -1465,7 +1465,7 @@ int __glXQueryContextInfoEXT(__GLXclientState *cl, GLbyte *pc) | ||||||
| 	WriteToClient(client, sz_xGLXQueryContextInfoEXTReply, (char *)&reply); | 	WriteToClient(client, sz_xGLXQueryContextInfoEXTReply, (char *)&reply); | ||||||
| 	WriteToClient(client, nReplyBytes, (char *)sendBuf); | 	WriteToClient(client, nReplyBytes, (char *)sendBuf); | ||||||
|     } |     } | ||||||
|     __glXFree((char *)sendBuf); |     xfree((char *)sendBuf); | ||||||
| 
 | 
 | ||||||
|     return Success; |     return Success; | ||||||
| } | } | ||||||
|  | @ -1805,17 +1805,17 @@ int __glXRenderLarge(__GLXclientState *cl, GLbyte *pc) | ||||||
| 	*/ | 	*/ | ||||||
| 	if (cl->largeCmdBufSize < cmdlen) { | 	if (cl->largeCmdBufSize < cmdlen) { | ||||||
| 	    if (!cl->largeCmdBuf) { | 	    if (!cl->largeCmdBuf) { | ||||||
| 		cl->largeCmdBuf = (GLbyte *) __glXMalloc((size_t)cmdlen); | 		cl->largeCmdBuf = (GLbyte *) xalloc((size_t)cmdlen); | ||||||
| 	    } else { | 	    } else { | ||||||
| 		cl->largeCmdBuf = (GLbyte *) __glXRealloc(cl->largeCmdBuf,  | 		cl->largeCmdBuf = (GLbyte *) xrealloc(cl->largeCmdBuf,  | ||||||
| 							  (size_t)cmdlen); | 						      (size_t)cmdlen); | ||||||
| 	    } | 	    } | ||||||
| 	    if (!cl->largeCmdBuf) { | 	    if (!cl->largeCmdBuf) { | ||||||
| 		return BadAlloc; | 		return BadAlloc; | ||||||
| 	    } | 	    } | ||||||
| 	    cl->largeCmdBufSize = cmdlen; | 	    cl->largeCmdBufSize = cmdlen; | ||||||
| 	} | 	} | ||||||
| 	__glXMemcpy(cl->largeCmdBuf, pc, dataBytes); | 	memcpy(cl->largeCmdBuf, pc, dataBytes); | ||||||
| 
 | 
 | ||||||
| 	cl->largeCmdBytesSoFar = dataBytes; | 	cl->largeCmdBytesSoFar = dataBytes; | ||||||
| 	cl->largeCmdBytesTotal = cmdlen; | 	cl->largeCmdBytesTotal = cmdlen; | ||||||
|  | @ -1851,7 +1851,7 @@ int __glXRenderLarge(__GLXclientState *cl, GLbyte *pc) | ||||||
| 	    __glXResetLargeCommandStatus(cl); | 	    __glXResetLargeCommandStatus(cl); | ||||||
| 	    return __glXBadLargeRequest; | 	    return __glXBadLargeRequest; | ||||||
| 	} | 	} | ||||||
| 	__glXMemcpy(cl->largeCmdBuf + cl->largeCmdBytesSoFar, pc, dataBytes); | 	memcpy(cl->largeCmdBuf + cl->largeCmdBytesSoFar, pc, dataBytes); | ||||||
| 	cl->largeCmdBytesSoFar += dataBytes; | 	cl->largeCmdBytesSoFar += dataBytes; | ||||||
| 	cl->largeCmdRequestsSoFar++; | 	cl->largeCmdRequestsSoFar++; | ||||||
| 
 | 
 | ||||||
|  | @ -2267,17 +2267,18 @@ int __glXQueryExtensionsString(__GLXclientState *cl, GLbyte *pc) | ||||||
| 
 | 
 | ||||||
|     ptr = __glXActiveScreens[screen]->GLXextensions; |     ptr = __glXActiveScreens[screen]->GLXextensions; | ||||||
| 
 | 
 | ||||||
|     n = __glXStrlen(ptr) + 1; |     n = strlen(ptr) + 1; | ||||||
|     length = __GLX_PAD(n) >> 2; |     length = __GLX_PAD(n) >> 2; | ||||||
|     reply.type = X_Reply; |     reply.type = X_Reply; | ||||||
|     reply.sequenceNumber = client->sequence; |     reply.sequenceNumber = client->sequence; | ||||||
|     reply.length = length; |     reply.length = length; | ||||||
|     reply.n = n; |     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 *) xalloc(length << 2); | ||||||
|  |     if (buf == NULL) | ||||||
|         return BadAlloc; |         return BadAlloc; | ||||||
|     } |     memcpy(buf, ptr, n); | ||||||
|     __glXStrncpy(buf, ptr, n); |  | ||||||
| 
 | 
 | ||||||
|     if (client->swapped) { |     if (client->swapped) { | ||||||
|         glxSwapQueryExtensionsStringReply(client, &reply, buf); |         glxSwapQueryExtensionsStringReply(client, &reply, buf); | ||||||
|  | @ -2286,7 +2287,7 @@ int __glXQueryExtensionsString(__GLXclientState *cl, GLbyte *pc) | ||||||
|         WriteToClient(client, (int)(length << 2), (char *)buf); |         WriteToClient(client, (int)(length << 2), (char *)buf); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     __glXFree(buf); |     xfree(buf); | ||||||
|     return Success; |     return Success; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | @ -2324,17 +2325,18 @@ int __glXQueryServerString(__GLXclientState *cl, GLbyte *pc) | ||||||
| 	    return BadValue;  | 	    return BadValue;  | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     n = __glXStrlen(ptr) + 1; |     n = strlen(ptr) + 1; | ||||||
|     length = __GLX_PAD(n) >> 2; |     length = __GLX_PAD(n) >> 2; | ||||||
|     reply.type = X_Reply; |     reply.type = X_Reply; | ||||||
|     reply.sequenceNumber = client->sequence; |     reply.sequenceNumber = client->sequence; | ||||||
|     reply.length = length; |     reply.length = length; | ||||||
|     reply.n = n; |     reply.n = n; | ||||||
| 
 | 
 | ||||||
|     if ((buf = (char *) Xalloc(length << 2)) == NULL) { |     buf = (char *) xalloc(length << 2); | ||||||
|  |     if (buf == NULL) { | ||||||
|         return BadAlloc; |         return BadAlloc; | ||||||
|     } |     } | ||||||
|     __glXStrncpy(buf, ptr, n); |     memcpy(buf, ptr, n); | ||||||
| 
 | 
 | ||||||
|     if (client->swapped) { |     if (client->swapped) { | ||||||
|         glxSwapQueryServerStringReply(client, &reply, buf); |         glxSwapQueryServerStringReply(client, &reply, buf); | ||||||
|  | @ -2343,7 +2345,7 @@ int __glXQueryServerString(__GLXclientState *cl, GLbyte *pc) | ||||||
|         WriteToClient(client, (int)(length << 2), buf); |         WriteToClient(client, (int)(length << 2), buf); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     __glXFree(buf); |     xfree(buf); | ||||||
|     return Success; |     return Success; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | @ -2354,9 +2356,10 @@ int __glXClientInfo(__GLXclientState *cl, GLbyte *pc) | ||||||
|     |     | ||||||
|     cl->GLClientmajorVersion = req->major; |     cl->GLClientmajorVersion = req->major; | ||||||
|     cl->GLClientminorVersion = req->minor; |     cl->GLClientminorVersion = req->minor; | ||||||
|     if (cl->GLClientextensions) __glXFree(cl->GLClientextensions); |     if (cl->GLClientextensions) | ||||||
|  | 	xfree(cl->GLClientextensions); | ||||||
|     buf = (const char *)(req+1); |     buf = (const char *)(req+1); | ||||||
|     cl->GLClientextensions = __glXStrdup(buf); |     cl->GLClientextensions = xstrdup(buf); | ||||||
| 
 | 
 | ||||||
|     return Success; |     return Success; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -50,7 +50,6 @@ | ||||||
| #include <pixmapstr.h> | #include <pixmapstr.h> | ||||||
| #include <windowstr.h> | #include <windowstr.h> | ||||||
| #include "glxext.h" | #include "glxext.h" | ||||||
| #include "GL/glx_ansic.h" |  | ||||||
| #include "glapitable.h" | #include "glapitable.h" | ||||||
| #include "glapi.h" | #include "glapi.h" | ||||||
| #include "glthread.h" | #include "glthread.h" | ||||||
|  | @ -752,16 +751,16 @@ int __glXSwapRenderLarge(__GLXclientState *cl, GLbyte *pc) | ||||||
| 	*/ | 	*/ | ||||||
| 	if (cl->largeCmdBufSize < cmdlen) { | 	if (cl->largeCmdBufSize < cmdlen) { | ||||||
| 	    if (!cl->largeCmdBuf) { | 	    if (!cl->largeCmdBuf) { | ||||||
| 		cl->largeCmdBuf = (GLbyte *) __glXMalloc(cmdlen); | 		cl->largeCmdBuf = (GLbyte *) xalloc(cmdlen); | ||||||
| 	    } else { | 	    } else { | ||||||
| 		cl->largeCmdBuf = (GLbyte *) __glXRealloc(cl->largeCmdBuf, cmdlen); | 		cl->largeCmdBuf = (GLbyte *) xrealloc(cl->largeCmdBuf, cmdlen); | ||||||
| 	    } | 	    } | ||||||
| 	    if (!cl->largeCmdBuf) { | 	    if (!cl->largeCmdBuf) { | ||||||
| 		return BadAlloc; | 		return BadAlloc; | ||||||
| 	    } | 	    } | ||||||
| 	    cl->largeCmdBufSize = cmdlen; | 	    cl->largeCmdBufSize = cmdlen; | ||||||
| 	} | 	} | ||||||
| 	__glXMemcpy(cl->largeCmdBuf, pc, dataBytes); | 	memcpy(cl->largeCmdBuf, pc, dataBytes); | ||||||
| 
 | 
 | ||||||
| 	cl->largeCmdBytesSoFar = dataBytes; | 	cl->largeCmdBytesSoFar = dataBytes; | ||||||
| 	cl->largeCmdBytesTotal = cmdlen; | 	cl->largeCmdBytesTotal = cmdlen; | ||||||
|  | @ -797,7 +796,7 @@ int __glXSwapRenderLarge(__GLXclientState *cl, GLbyte *pc) | ||||||
| 	    __glXResetLargeCommandStatus(cl); | 	    __glXResetLargeCommandStatus(cl); | ||||||
| 	    return __glXBadLargeRequest; | 	    return __glXBadLargeRequest; | ||||||
| 	} | 	} | ||||||
| 	__glXMemcpy(cl->largeCmdBuf + cl->largeCmdBytesSoFar, pc, dataBytes); | 	memcpy(cl->largeCmdBuf + cl->largeCmdBytesSoFar, pc, dataBytes); | ||||||
| 	cl->largeCmdBytesSoFar += dataBytes; | 	cl->largeCmdBytesSoFar += dataBytes; | ||||||
| 	cl->largeCmdRequestsSoFar++; | 	cl->largeCmdRequestsSoFar++; | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -144,7 +144,7 @@ __glXDRIdrawableDestroy(__GLXdrawable *private) | ||||||
| 					    glxPriv->driDrawable.private); | 					    glxPriv->driDrawable.private); | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
|     __glXFree(private); |     xfree(private); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static GLboolean | static GLboolean | ||||||
|  | @ -184,14 +184,14 @@ __glXDRIcontextCreateDrawable(__GLXcontext *context, | ||||||
| { | { | ||||||
|     __GLXDRIdrawable *private; |     __GLXDRIdrawable *private; | ||||||
| 
 | 
 | ||||||
|     private = __glXMalloc(sizeof *private); |     private = xalloc(sizeof *private); | ||||||
|     if (private == NULL) |     if (private == NULL) | ||||||
| 	return NULL; | 	return NULL; | ||||||
| 
 | 
 | ||||||
|     memset(private, 0, sizeof *private); |     memset(private, 0, sizeof *private); | ||||||
| 
 | 
 | ||||||
|     if (!__glXDrawableInit(&private->base, context, pDraw, drawId)) { |     if (!__glXDrawableInit(&private->base, context, pDraw, drawId)) { | ||||||
|         __glXFree(private); |         xfree(private); | ||||||
| 	return NULL; | 	return NULL; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  | @ -228,7 +228,7 @@ __glXDRIcontextDestroy(__GLXcontext *baseContext) | ||||||
| 				       context->base.pScreen->myNum, | 				       context->base.pScreen->myNum, | ||||||
| 				       context->driContext.private); | 				       context->driContext.private); | ||||||
|     __glXContextDestroy(context); |     __glXContextDestroy(context); | ||||||
|     __glXFree(context); |     xfree(context); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static int | static int | ||||||
|  | @ -397,7 +397,7 @@ __glXDRIscreenDestroy(__GLXscreen *baseScreen) | ||||||
| 
 | 
 | ||||||
|     __glXScreenDestroy(baseScreen); |     __glXScreenDestroy(baseScreen); | ||||||
| 
 | 
 | ||||||
|     __glXFree(screen); |     xfree(screen); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static __GLXcontext * | static __GLXcontext * | ||||||
|  | @ -415,7 +415,7 @@ __glXDRIscreenCreateContext(__GLXscreen *baseScreen, | ||||||
|     else |     else | ||||||
| 	sharePrivate = NULL; | 	sharePrivate = NULL; | ||||||
| 
 | 
 | ||||||
|     context = __glXMalloc(sizeof *context); |     context = xalloc(sizeof *context); | ||||||
|     if (context == NULL) |     if (context == NULL) | ||||||
| 	return NULL; | 	return NULL; | ||||||
| 
 | 
 | ||||||
|  | @ -639,7 +639,7 @@ getDrawableInfo(__DRInativeDisplay *dpy, int screen, | ||||||
| 
 | 
 | ||||||
|     if (*numClipRects > 0) { |     if (*numClipRects > 0) { | ||||||
| 	size = sizeof (drm_clip_rect_t) * *numClipRects; | 	size = sizeof (drm_clip_rect_t) * *numClipRects; | ||||||
| 	*ppClipRects = __glXMalloc (size); | 	*ppClipRects = xalloc (size); | ||||||
| 	if (*ppClipRects != NULL) | 	if (*ppClipRects != NULL) | ||||||
| 	    memcpy (*ppClipRects, pClipRects, size); | 	    memcpy (*ppClipRects, pClipRects, size); | ||||||
|     } |     } | ||||||
|  | @ -649,7 +649,7 @@ getDrawableInfo(__DRInativeDisplay *dpy, int screen, | ||||||
|        |        | ||||||
|     if (*numBackClipRects > 0) { |     if (*numBackClipRects > 0) { | ||||||
| 	size = sizeof (drm_clip_rect_t) * *numBackClipRects; | 	size = sizeof (drm_clip_rect_t) * *numBackClipRects; | ||||||
| 	*ppBackClipRects = __glXMalloc (size); | 	*ppBackClipRects = xalloc (size); | ||||||
| 	if (*ppBackClipRects != NULL) | 	if (*ppBackClipRects != NULL) | ||||||
| 	    memcpy (*ppBackClipRects, pBackClipRects, size); | 	    memcpy (*ppBackClipRects, pBackClipRects, size); | ||||||
|     } |     } | ||||||
|  | @ -732,7 +732,7 @@ __glXDRIscreenProbe(ScreenPtr pScreen) | ||||||
| 	return NULL; | 	return NULL; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     screen = __glXMalloc(sizeof *screen); |     screen = xalloc(sizeof *screen); | ||||||
|     if (screen == NULL) |     if (screen == NULL) | ||||||
|       return NULL; |       return NULL; | ||||||
|     memset(screen, 0, sizeof *screen); |     memset(screen, 0, sizeof *screen); | ||||||
|  | @ -833,7 +833,7 @@ __glXDRIscreenProbe(ScreenPtr pScreen) | ||||||
|      * but we can't use _mesa_malloc() here.  In fact, the DRI driver |      * but we can't use _mesa_malloc() here.  In fact, the DRI driver | ||||||
|      * shouldn't free data it didn't allocate itself, but what can you |      * shouldn't free data it didn't allocate itself, but what can you | ||||||
|      * do... */ |      * do... */ | ||||||
|     dev_priv = __glXMalloc(framebuffer.dev_priv_size); |     dev_priv = xalloc(framebuffer.dev_priv_size); | ||||||
|     if (dev_priv == NULL) { |     if (dev_priv == NULL) { | ||||||
| 	err_msg = "dev_priv allocation"; | 	err_msg = "dev_priv allocation"; | ||||||
| 	goto handle_error; | 	goto handle_error; | ||||||
|  | @ -904,7 +904,7 @@ __glXDRIscreenProbe(ScreenPtr pScreen) | ||||||
| 	drmUnmap((drmAddress)framebuffer.base, framebuffer.size); | 	drmUnmap((drmAddress)framebuffer.base, framebuffer.size); | ||||||
| 
 | 
 | ||||||
|     if (dev_priv != NULL) |     if (dev_priv != NULL) | ||||||
| 	__glXFree(dev_priv); | 	xfree(dev_priv); | ||||||
| 
 | 
 | ||||||
|     if (fd >= 0) |     if (fd >= 0) | ||||||
| 	drmClose(fd); | 	drmClose(fd); | ||||||
|  |  | ||||||
|  | @ -56,17 +56,18 @@ static void ResetClientState(int clientIndex) | ||||||
| { | { | ||||||
|     __GLXclientState *cl = __glXClients[clientIndex]; |     __GLXclientState *cl = __glXClients[clientIndex]; | ||||||
| 
 | 
 | ||||||
|     if (cl->returnBuf) __glXFree(cl->returnBuf); |     if (cl->returnBuf) xfree(cl->returnBuf); | ||||||
|     if (cl->largeCmdBuf) __glXFree(cl->largeCmdBuf); |     if (cl->largeCmdBuf) xfree(cl->largeCmdBuf); | ||||||
|     if (cl->currentContexts) __glXFree(cl->currentContexts); |     if (cl->currentContexts) xfree(cl->currentContexts); | ||||||
|     __glXMemset(cl, 0, sizeof(__GLXclientState)); |     memset(cl, 0, sizeof(__GLXclientState)); | ||||||
|     /*
 |     /*
 | ||||||
|     ** By default, assume that the client supports |     ** By default, assume that the client supports | ||||||
|     ** GLX major version 1 minor version 0 protocol. |     ** GLX major version 1 minor version 0 protocol. | ||||||
|     */ |     */ | ||||||
|     cl->GLClientmajorVersion = 1; |     cl->GLClientmajorVersion = 1; | ||||||
|     cl->GLClientminorVersion = 0; |     cl->GLClientminorVersion = 0; | ||||||
|     if (cl->GLClientextensions) __glXFree(cl->GLClientextensions); |     if (cl->GLClientextensions) | ||||||
|  | 	xfree(cl->GLClientextensions); | ||||||
| 
 | 
 | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | @ -145,7 +146,7 @@ static int PixmapGone(__GLXpixmap *pGlxPixmap, XID id) | ||||||
| 	** only if it's zero. | 	** only if it's zero. | ||||||
| 	*/ | 	*/ | ||||||
| 	(*pGlxPixmap->pScreen->DestroyPixmap)(pPixmap); | 	(*pGlxPixmap->pScreen->DestroyPixmap)(pPixmap); | ||||||
| 	__glXFree(pGlxPixmap); | 	xfree(pGlxPixmap); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     return True; |     return True; | ||||||
|  | @ -192,8 +193,8 @@ GLboolean __glXFreeContext(__GLXcontext *cx) | ||||||
| { | { | ||||||
|     if (cx->idExists || cx->isCurrent) return GL_FALSE; |     if (cx->idExists || cx->isCurrent) return GL_FALSE; | ||||||
|      |      | ||||||
|     if (cx->feedbackBuf) __glXFree(cx->feedbackBuf); |     if (cx->feedbackBuf) xfree(cx->feedbackBuf); | ||||||
|     if (cx->selectBuf) __glXFree(cx->selectBuf); |     if (cx->selectBuf) xfree(cx->selectBuf); | ||||||
|     if (cx == __glXLastContext) { |     if (cx == __glXLastContext) { | ||||||
| 	__glXFlushContextCache(); | 	__glXFlushContextCache(); | ||||||
|     } |     } | ||||||
|  | @ -430,12 +431,12 @@ static int __glXDispatch(ClientPtr client) | ||||||
|     opcode = stuff->glxCode; |     opcode = stuff->glxCode; | ||||||
|     cl = __glXClients[client->index]; |     cl = __glXClients[client->index]; | ||||||
|     if (!cl) { |     if (!cl) { | ||||||
| 	cl = (__GLXclientState *) __glXMalloc(sizeof(__GLXclientState)); | 	cl = (__GLXclientState *) xalloc(sizeof(__GLXclientState)); | ||||||
| 	 __glXClients[client->index] = cl; | 	 __glXClients[client->index] = cl; | ||||||
| 	if (!cl) { | 	if (!cl) { | ||||||
| 	    return BadAlloc; | 	    return BadAlloc; | ||||||
| 	} | 	} | ||||||
| 	__glXMemset(cl, 0, sizeof(__GLXclientState)); | 	memset(cl, 0, sizeof(__GLXclientState)); | ||||||
|     } |     } | ||||||
|      |      | ||||||
|     if (!cl->inUse) { |     if (!cl->inUse) { | ||||||
|  |  | ||||||
|  | @ -262,10 +262,10 @@ void GlxPushProvider(__GLXprovider *provider) | ||||||
| void __glXScreenInit(__GLXscreen *screen, ScreenPtr pScreen) | void __glXScreenInit(__GLXscreen *screen, ScreenPtr pScreen) | ||||||
| { | { | ||||||
|     screen->pScreen       = pScreen; |     screen->pScreen       = pScreen; | ||||||
|     screen->GLextensions  = __glXStrdup(GLServerExtensions); |     screen->GLextensions  = xstrdup(GLServerExtensions); | ||||||
|     screen->GLXvendor     = __glXStrdup(GLXServerVendorName); |     screen->GLXvendor     = xstrdup(GLXServerVendorName); | ||||||
|     screen->GLXversion    = __glXStrdup(GLXServerVersion); |     screen->GLXversion    = xstrdup(GLXServerVersion); | ||||||
|     screen->GLXextensions = __glXStrdup(GLXServerExtensions); |     screen->GLXextensions = xstrdup(GLXServerExtensions); | ||||||
| 
 | 
 | ||||||
|     screen->WrappedPositionWindow = pScreen->PositionWindow; |     screen->WrappedPositionWindow = pScreen->PositionWindow; | ||||||
|     pScreen->PositionWindow = PositionWindow; |     pScreen->PositionWindow = PositionWindow; | ||||||
|  | @ -276,10 +276,10 @@ void __glXScreenInit(__GLXscreen *screen, ScreenPtr pScreen) | ||||||
| void | void | ||||||
| __glXScreenDestroy(__GLXscreen *screen) | __glXScreenDestroy(__GLXscreen *screen) | ||||||
| { | { | ||||||
|     __glXFree(screen->GLXvendor); |     xfree(screen->GLXvendor); | ||||||
|     __glXFree(screen->GLXversion); |     xfree(screen->GLXversion); | ||||||
|     __glXFree(screen->GLXextensions); |     xfree(screen->GLXextensions); | ||||||
|     __glXFree(screen->GLextensions); |     xfree(screen->GLextensions); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void __glXInitScreens(void) | void __glXInitScreens(void) | ||||||
|  | @ -293,8 +293,8 @@ void __glXInitScreens(void) | ||||||
|     ** This alloc has to work or else the server might as well core dump. |     ** This alloc has to work or else the server might as well core dump. | ||||||
|     */ |     */ | ||||||
|     size = screenInfo.numScreens * sizeof(__GLXscreen *); |     size = screenInfo.numScreens * sizeof(__GLXscreen *); | ||||||
|     __glXActiveScreens =__glXMalloc(size); |     __glXActiveScreens = xalloc(size); | ||||||
|     __glXMemset(__glXActiveScreens, 0, size); |     memset(__glXActiveScreens, 0, size); | ||||||
|      |      | ||||||
|     for (i = 0; i < screenInfo.numScreens; i++) { |     for (i = 0; i < screenInfo.numScreens; i++) { | ||||||
| 	pScreen = screenInfo.screens[i]; | 	pScreen = screenInfo.screens[i]; | ||||||
|  | @ -319,9 +319,9 @@ void __glXResetScreens(void) | ||||||
|       if (__glXActiveScreens[i]) |       if (__glXActiveScreens[i]) | ||||||
| 	  __glXActiveScreens[i]->destroy(__glXActiveScreens[i]); | 	  __glXActiveScreens[i]->destroy(__glXActiveScreens[i]); | ||||||
| 
 | 
 | ||||||
|     __glXFree(__glXActiveScreens); |     xfree(__glXActiveScreens); | ||||||
|     __glXFree(__glXHyperpipeFuncs); |     xfree(__glXHyperpipeFuncs); | ||||||
|     __glXFree(__glXSwapBarrierFuncs); |     xfree(__glXSwapBarrierFuncs); | ||||||
|     __glXNumHyperpipeFuncs = 0; |     __glXNumHyperpipeFuncs = 0; | ||||||
|     __glXNumSwapBarrierFuncs = 0; |     __glXNumSwapBarrierFuncs = 0; | ||||||
|     __glXHyperpipeFuncs = NULL; |     __glXHyperpipeFuncs = NULL; | ||||||
|  |  | ||||||
|  | @ -51,7 +51,6 @@ | ||||||
| #include <extnsionst.h> | #include <extnsionst.h> | ||||||
| #include <resource.h> | #include <resource.h> | ||||||
| #include <scrnintstr.h> | #include <scrnintstr.h> | ||||||
| #include "GL/glx_ansic.h" |  | ||||||
| 
 | 
 | ||||||
| /*
 | /*
 | ||||||
| ** The X header misc.h defines these math functions. | ** The X header misc.h defines these math functions. | ||||||
|  |  | ||||||
|  | @ -48,84 +48,10 @@ | ||||||
| #include <pixmapstr.h> | #include <pixmapstr.h> | ||||||
| #include <windowstr.h> | #include <windowstr.h> | ||||||
| #include "glxutil.h" | #include "glxutil.h" | ||||||
| #include "GL/glx_ansic.h" |  | ||||||
| #include "GL/internal/glcore.h" | #include "GL/internal/glcore.h" | ||||||
| #include "GL/glxint.h" | #include "GL/glxint.h" | ||||||
| #include "glcontextmodes.h" | #include "glcontextmodes.h" | ||||||
| 
 | 
 | ||||||
| /************************************************************************/ |  | ||||||
| 
 |  | ||||||
| /* Memory Allocation for GLX */ |  | ||||||
| 
 |  | ||||||
| void * |  | ||||||
| __glXMalloc(size_t size) |  | ||||||
| { |  | ||||||
|     void *addr; |  | ||||||
| 
 |  | ||||||
|     if (size == 0) { |  | ||||||
| 	return NULL; |  | ||||||
|     } |  | ||||||
|     addr = (void *) xalloc(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 *) xalloc(size); |  | ||||||
|     if (addr == NULL) { |  | ||||||
| 	/* XXX: handle out of memory error */ |  | ||||||
| 	return NULL; |  | ||||||
|     } |  | ||||||
|     memset(addr, 0, size); |  | ||||||
|     return addr; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| void * |  | ||||||
| __glXRealloc(void *addr, size_t newSize) |  | ||||||
| { |  | ||||||
|     void *newAddr; |  | ||||||
| 
 |  | ||||||
|     if (addr) { |  | ||||||
| 	if (newSize == 0) { |  | ||||||
| 	    xfree(addr); |  | ||||||
| 	    return NULL; |  | ||||||
| 	} else { |  | ||||||
| 	    newAddr = xrealloc(addr, newSize); |  | ||||||
| 	} |  | ||||||
|     } else { |  | ||||||
| 	if (newSize == 0) { |  | ||||||
| 	    return NULL; |  | ||||||
| 	} else { |  | ||||||
| 	    newAddr = xalloc(newSize); |  | ||||||
| 	} |  | ||||||
|     } |  | ||||||
|     if (newAddr == NULL) { |  | ||||||
| 	return NULL;	/* XXX: out of memory */ |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     return newAddr; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| void |  | ||||||
| __glXFree(void *addr) |  | ||||||
| { |  | ||||||
|     if (addr) { |  | ||||||
| 	xfree(addr); |  | ||||||
|     } |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| /************************************************************************/ | /************************************************************************/ | ||||||
| /* Context stuff */ | /* Context stuff */ | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -35,6 +35,7 @@ | ||||||
| #include <dix-config.h> | #include <dix-config.h> | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
|  | #include <assert.h> | ||||||
| #include <string.h> | #include <string.h> | ||||||
| #include <regionstr.h> | #include <regionstr.h> | ||||||
| #include <resource.h> | #include <resource.h> | ||||||
|  | @ -218,15 +219,15 @@ static Bool init_visuals(int *nvisualp, VisualPtr *visualp, | ||||||
| 
 | 
 | ||||||
|     /* Alloc space for the list of new GLX visuals */ |     /* Alloc space for the list of new GLX visuals */ | ||||||
|     pNewVisualConfigs = (__GLXvisualConfig *) |     pNewVisualConfigs = (__GLXvisualConfig *) | ||||||
| 	__glXMalloc(numNewConfigs * sizeof(__GLXvisualConfig)); | 	xalloc(numNewConfigs * sizeof(__GLXvisualConfig)); | ||||||
|     if (!pNewVisualConfigs) { |     if (!pNewVisualConfigs) { | ||||||
| 	return FALSE; | 	return FALSE; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     /* Alloc space for the list of new GLX visual privates */ |     /* Alloc space for the list of new GLX visual privates */ | ||||||
|     pNewVisualPriv = (void **) __glXMalloc(numNewConfigs * sizeof(void *)); |     pNewVisualPriv = (void **) xalloc(numNewConfigs * sizeof(void *)); | ||||||
|     if (!pNewVisualPriv) { |     if (!pNewVisualPriv) { | ||||||
| 	__glXFree(pNewVisualConfigs); | 	xfree(pNewVisualConfigs); | ||||||
| 	return FALSE; | 	return FALSE; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  | @ -270,40 +271,40 @@ static Bool init_visuals(int *nvisualp, VisualPtr *visualp, | ||||||
|     numConfigs = 0; |     numConfigs = 0; | ||||||
| 
 | 
 | ||||||
|     /* Alloc temp space for the list of orig VisualIDs for each new visual */ |     /* Alloc temp space for the list of orig VisualIDs for each new visual */ | ||||||
|     orig_vid = (VisualID *) __glXMalloc(numNewVisuals * sizeof(VisualID)); |     orig_vid = (VisualID *) xalloc(numNewVisuals * sizeof(VisualID)); | ||||||
|     if (!orig_vid) { |     if (!orig_vid) { | ||||||
| 	__glXFree(pNewVisualPriv); | 	xfree(pNewVisualPriv); | ||||||
| 	__glXFree(pNewVisualConfigs); | 	xfree(pNewVisualConfigs); | ||||||
| 	return FALSE; | 	return FALSE; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     /* Alloc space for the list of glXVisuals */ |     /* Alloc space for the list of glXVisuals */ | ||||||
|     modes = _gl_context_modes_create(numNewVisuals, sizeof(__GLcontextModes)); |     modes = _gl_context_modes_create(numNewVisuals, sizeof(__GLcontextModes)); | ||||||
|     if (modes == NULL) { |     if (modes == NULL) { | ||||||
| 	__glXFree(orig_vid); | 	xfree(orig_vid); | ||||||
| 	__glXFree(pNewVisualPriv); | 	xfree(pNewVisualPriv); | ||||||
| 	__glXFree(pNewVisualConfigs); | 	xfree(pNewVisualConfigs); | ||||||
| 	return FALSE; | 	return FALSE; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     /* Alloc space for the list of glXVisualPrivates */ |     /* Alloc space for the list of glXVisualPrivates */ | ||||||
|     glXVisualPriv = (void **)__glXMalloc(numNewVisuals * sizeof(void *)); |     glXVisualPriv = (void **)xalloc(numNewVisuals * sizeof(void *)); | ||||||
|     if (!glXVisualPriv) { |     if (!glXVisualPriv) { | ||||||
| 	_gl_context_modes_destroy( modes ); | 	_gl_context_modes_destroy( modes ); | ||||||
| 	__glXFree(orig_vid); | 	xfree(orig_vid); | ||||||
| 	__glXFree(pNewVisualPriv); | 	xfree(pNewVisualPriv); | ||||||
| 	__glXFree(pNewVisualConfigs); | 	xfree(pNewVisualConfigs); | ||||||
| 	return FALSE; | 	return FALSE; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     /* Alloc space for the new list of the X server's visuals */ |     /* Alloc space for the new list of the X server's visuals */ | ||||||
|     pVisualNew = (VisualPtr)__glXMalloc(numNewVisuals * sizeof(VisualRec)); |     pVisualNew = (VisualPtr)xalloc(numNewVisuals * sizeof(VisualRec)); | ||||||
|     if (!pVisualNew) { |     if (!pVisualNew) { | ||||||
| 	__glXFree(glXVisualPriv); | 	xfree(glXVisualPriv); | ||||||
| 	_gl_context_modes_destroy( modes ); | 	_gl_context_modes_destroy( modes ); | ||||||
| 	__glXFree(orig_vid); | 	xfree(orig_vid); | ||||||
| 	__glXFree(pNewVisualPriv); | 	xfree(pNewVisualPriv); | ||||||
| 	__glXFree(pNewVisualConfigs); | 	xfree(pNewVisualConfigs); | ||||||
| 	return FALSE; | 	return FALSE; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  | @ -388,7 +389,7 @@ static Bool init_visuals(int *nvisualp, VisualPtr *visualp, | ||||||
| 		    numVids++; | 		    numVids++; | ||||||
| 
 | 
 | ||||||
| 	/* Allocate a new list of VisualIDs for this depth */ | 	/* Allocate a new list of VisualIDs for this depth */ | ||||||
| 	pVids = (VisualID *)__glXMalloc(numVids * sizeof(VisualID)); | 	pVids = (VisualID *)xalloc(numVids * sizeof(VisualID)); | ||||||
| 
 | 
 | ||||||
| 	/* Initialize the new list of VisualIDs for this depth */ | 	/* Initialize the new list of VisualIDs for this depth */ | ||||||
| 	for (j = 0; j < pdepth[i].numVids; j++) | 	for (j = 0; j < pdepth[i].numVids; j++) | ||||||
|  | @ -397,7 +398,7 @@ static Bool init_visuals(int *nvisualp, VisualPtr *visualp, | ||||||
| 		    pVids[n++] = pVisualNew[k].vid; | 		    pVids[n++] = pVisualNew[k].vid; | ||||||
| 
 | 
 | ||||||
| 	/* Update this depth's list of VisualIDs */ | 	/* Update this depth's list of VisualIDs */ | ||||||
| 	__glXFree(pdepth[i].vids); | 	xfree(pdepth[i].vids); | ||||||
| 	pdepth[i].vids = pVids; | 	pdepth[i].vids = pVids; | ||||||
| 	pdepth[i].numVids = numVids; | 	pdepth[i].numVids = numVids; | ||||||
|     } |     } | ||||||
|  | @ -407,16 +408,16 @@ static Bool init_visuals(int *nvisualp, VisualPtr *visualp, | ||||||
|     *visualp = pVisualNew; |     *visualp = pVisualNew; | ||||||
| 
 | 
 | ||||||
|     /* Free the old list of the X server's visuals */ |     /* Free the old list of the X server's visuals */ | ||||||
|     __glXFree(pVisual); |     xfree(pVisual); | ||||||
| 
 | 
 | ||||||
|     /* Clean up temporary allocations */ |     /* Clean up temporary allocations */ | ||||||
|     __glXFree(orig_vid); |     xfree(orig_vid); | ||||||
|     __glXFree(pNewVisualPriv); |     xfree(pNewVisualPriv); | ||||||
|     __glXFree(pNewVisualConfigs); |     xfree(pNewVisualConfigs); | ||||||
| 
 | 
 | ||||||
|     /* Free the private list created by DDX HW driver */ |     /* Free the private list created by DDX HW driver */ | ||||||
|     if (visualPrivates) |     if (visualPrivates) | ||||||
|         __glXFree(visualPrivates); |         xfree(visualPrivates); | ||||||
|     visualPrivates = NULL; |     visualPrivates = NULL; | ||||||
| 
 | 
 | ||||||
|     return TRUE; |     return TRUE; | ||||||
|  |  | ||||||
|  | @ -48,7 +48,6 @@ | ||||||
| #include "glxext.h" | #include "glxext.h" | ||||||
| #include "indirect_dispatch.h" | #include "indirect_dispatch.h" | ||||||
| #include "unpack.h" | #include "unpack.h" | ||||||
| #include "GL/glx_ansic.h" |  | ||||||
| #include "glapitable.h" | #include "glapitable.h" | ||||||
| #include "glapi.h" | #include "glapi.h" | ||||||
| #include "glthread.h" | #include "glthread.h" | ||||||
|  | @ -266,24 +265,30 @@ char *__glXcombine_strings(const char *cext_string, const char *sext_string) | ||||||
|    ** pull tokens out of shortest string |    ** pull tokens out of shortest string | ||||||
|    ** include space in combo_string for final separator and null terminator |    ** include space in combo_string for final separator and null terminator | ||||||
|    */ |    */ | ||||||
|    if ( (clen = __glXStrlen(cext_string)) > (slen = __glXStrlen(sext_string)) ) { |    clen = strlen(cext_string); | ||||||
| 	combo_string = (char *) __glXMalloc(slen + 2); |    slen = strlen(sext_string); | ||||||
| 	s1 = (char *) __glXMalloc(slen + 2); __glXStrcpy(s1, sext_string); |    if (clen > slen) { | ||||||
|  | 	combo_string = (char *) xalloc(slen + 2); | ||||||
|  | 	s1 = (char *) xalloc(slen + 2); | ||||||
|  | 	strcpy(s1, sext_string); | ||||||
| 	s2 = cext_string; | 	s2 = cext_string; | ||||||
|    } else { |    } else { | ||||||
| 	combo_string = (char *) __glXMalloc(clen + 2); | 	combo_string = (char *) xalloc(clen + 2); | ||||||
| 	s1 = (char *) __glXMalloc(clen + 2); __glXStrcpy(s1, cext_string); | 	s1 = (char *) xalloc(clen + 2); | ||||||
|  | 	strcpy(s1, cext_string); | ||||||
| 	s2 = sext_string; | 	s2 = sext_string; | ||||||
|    } |    } | ||||||
|    if (!combo_string || !s1) { |    if (!combo_string || !s1) { | ||||||
| 	if (combo_string) __glXFree(combo_string); | 	if (combo_string) | ||||||
| 	if (s1) __glXFree(s1); | 	    xfree(combo_string); | ||||||
|  | 	if (s1) | ||||||
|  | 	    xfree(s1); | ||||||
| 	return NULL; | 	return NULL; | ||||||
|    } |    } | ||||||
|    combo_string[0] = '\0'; |    combo_string[0] = '\0'; | ||||||
| 
 | 
 | ||||||
|    /* Get first extension token */ |    /* Get first extension token */ | ||||||
|    token = __glXStrtok( s1, SEPARATOR); |    token = strtok( s1, SEPARATOR); | ||||||
|    while ( token != NULL ) { |    while ( token != NULL ) { | ||||||
| 
 | 
 | ||||||
| 	/*
 | 	/*
 | ||||||
|  | @ -291,20 +296,20 @@ char *__glXcombine_strings(const char *cext_string, const char *sext_string) | ||||||
| 	** beware of extension names which are prefixes of other extension names | 	** beware of extension names which are prefixes of other extension names | ||||||
| 	*/ | 	*/ | ||||||
| 	const char *p = s2; | 	const char *p = s2; | ||||||
| 	end = p + __glXStrlen(p); | 	end = p + strlen(p); | ||||||
| 	while (p < end) { | 	while (p < end) { | ||||||
| 	    size_t n = __glXStrcspn(p, SEPARATOR); | 	    size_t n = strcspn(p, SEPARATOR); | ||||||
| 	    if ((__glXStrlen(token) == n) && (__glXStrncmp(token, p, n) == 0)) { | 	    if ((strlen(token) == n) && (strncmp(token, p, n) == 0)) { | ||||||
| 		combo_string = __glXStrcat( combo_string, token); | 		combo_string = strcat(combo_string, token); | ||||||
| 		combo_string = __glXStrcat( combo_string, SEPARATOR); | 		combo_string = strcat(combo_string, SEPARATOR); | ||||||
| 	    } | 	    } | ||||||
| 	    p += (n + 1); | 	    p += (n + 1); | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	/* Get next extension token */ | 	/* Get next extension token */ | ||||||
| 	token = __glXStrtok( NULL, SEPARATOR); | 	token = strtok( NULL, SEPARATOR); | ||||||
|    } |    } | ||||||
|    __glXFree(s1); |    xfree(s1); | ||||||
|    return combo_string; |    return combo_string; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | @ -348,26 +353,24 @@ int DoGetString(__GLXclientState *cl, GLbyte *pc, GLboolean need_swap) | ||||||
| 	buf = __glXcombine_strings(buf1, | 	buf = __glXcombine_strings(buf1, | ||||||
| 				      cx->pGlxScreen->GLextensions); | 				      cx->pGlxScreen->GLextensions); | ||||||
| 	if (buf1 != NULL) { | 	if (buf1 != NULL) { | ||||||
| 	    __glXFree(buf1); | 	    xfree(buf1); | ||||||
| 	} | 	} | ||||||
| 	string = buf; | 	string = buf; | ||||||
|     } |     } | ||||||
|     else if ( name == GL_VERSION ) { |     else if ( name == GL_VERSION ) { | ||||||
| 	if ( atof( string ) > atof( GLServerVersion ) ) { | 	if ( atof( string ) > atof( GLServerVersion ) ) { | ||||||
| 	    buf = __glXMalloc( __glXStrlen( string )  | 	    buf = xalloc( strlen( string ) + strlen( GLServerVersion ) + 4 ); | ||||||
| 			       + __glXStrlen( GLServerVersion ) |  | ||||||
| 			       + 4 ); |  | ||||||
| 	    if ( buf == NULL ) { | 	    if ( buf == NULL ) { | ||||||
| 		string = GLServerVersion; | 		string = GLServerVersion; | ||||||
| 	    } | 	    } | ||||||
| 	    else { | 	    else { | ||||||
| 		__glXSprintf( buf, "%s (%s)", GLServerVersion, string ); | 		sprintf( buf, "%s (%s)", GLServerVersion, string ); | ||||||
| 		string = buf; | 		string = buf; | ||||||
| 	    } | 	    } | ||||||
| 	} | 	} | ||||||
|     } |     } | ||||||
|     if (string) { |     if (string) { | ||||||
| 	length = __glXStrlen((const char *) string) + 1; | 	length = strlen((const char *) string) + 1; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     __GLX_BEGIN_REPLY(length); |     __GLX_BEGIN_REPLY(length); | ||||||
|  | @ -380,9 +383,9 @@ int DoGetString(__GLXclientState *cl, GLbyte *pc, GLboolean need_swap) | ||||||
| 
 | 
 | ||||||
|     __GLX_SEND_HEADER(); |     __GLX_SEND_HEADER(); | ||||||
|     WriteToClient(client, length, (char *) string);  |     WriteToClient(client, length, (char *) string);  | ||||||
|     if (buf != NULL) { |     if (buf != NULL) | ||||||
| 	__glXFree(buf); | 	xfree(buf); | ||||||
|     } | 
 | ||||||
|     return Success; |     return Success; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -44,7 +44,6 @@ | ||||||
| #include "glxext.h" | #include "glxext.h" | ||||||
| #include "indirect_dispatch.h" | #include "indirect_dispatch.h" | ||||||
| #include "unpack.h" | #include "unpack.h" | ||||||
| #include "GL/glx_ansic.h" |  | ||||||
| #include "glapitable.h" | #include "glapitable.h" | ||||||
| #include "glapi.h" | #include "glapi.h" | ||||||
| #include "glthread.h" | #include "glthread.h" | ||||||
|  |  | ||||||
|  | @ -82,7 +82,7 @@ static int __glXMakeBitmapFromGlyph(FontPtr font, CharInfoPtr pci) | ||||||
| 	p = buf; | 	p = buf; | ||||||
| 	allocbuf = 0; | 	allocbuf = 0; | ||||||
|     } else { |     } else { | ||||||
| 	p = (unsigned char *) __glXMalloc(allocBytes); | 	p = (unsigned char *) xalloc(allocBytes); | ||||||
| 	if (!p) | 	if (!p) | ||||||
| 	    return BadAlloc; | 	    return BadAlloc; | ||||||
| 	allocbuf = p; | 	allocbuf = p; | ||||||
|  | @ -106,7 +106,7 @@ static int __glXMakeBitmapFromGlyph(FontPtr font, CharInfoPtr pci) | ||||||
| 				  allocbuf ? allocbuf : buf) ); | 				  allocbuf ? allocbuf : buf) ); | ||||||
| 
 | 
 | ||||||
|     if (allocbuf) { |     if (allocbuf) { | ||||||
| 	__glXFree(allocbuf); | 	xfree(allocbuf); | ||||||
|     } |     } | ||||||
|     return Success; |     return Success; | ||||||
| #undef __GL_CHAR_BUF_SIZE | #undef __GL_CHAR_BUF_SIZE | ||||||
|  |  | ||||||
|  | @ -400,7 +400,7 @@ static void init_screen_visuals(__GLXMESAscreen *screen) | ||||||
| 	i++; | 	i++; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     __glXFree(used); |     xfree(used); | ||||||
| 
 | 
 | ||||||
|     screen->xm_vis = pXMesaVisual; |     screen->xm_vis = pXMesaVisual; | ||||||
| } | } | ||||||
|  | @ -440,9 +440,3 @@ GlxGetMesaProvider (void) | ||||||
| { | { | ||||||
|     return &__glXMesaProvider; |     return &__glXMesaProvider; | ||||||
| } | } | ||||||
| 
 |  | ||||||
| __GLXprovider * |  | ||||||
| GlxGetMesaProvider (void) |  | ||||||
| { |  | ||||||
|     return &__glXMesaProvider; |  | ||||||
| } |  | ||||||
|  |  | ||||||
|  | @ -554,6 +554,7 @@ fi | ||||||
| 
 | 
 | ||||||
| if test "x$GLX" = xyes && ! test "x$MESA_SOURCE" = x; then | if test "x$GLX" = xyes && ! test "x$MESA_SOURCE" = x; then | ||||||
| 	PKG_CHECK_MODULES([XLIB], [x11]) | 	PKG_CHECK_MODULES([XLIB], [x11]) | ||||||
|  | 	PKG_CHECK_MODULES([GL], [glproto >= 1.4.6]) | ||||||
| 	AC_SUBST(XLIB_CFLAGS) | 	AC_SUBST(XLIB_CFLAGS) | ||||||
| 	AC_DEFINE(GLXEXT, 1, [Build GLX extension]) | 	AC_DEFINE(GLXEXT, 1, [Build GLX extension]) | ||||||
| 	GLX_LIBS='$(top_builddir)/GL/glx/libglx.la $(top_builddir)/GL/mesa/libGLcore.la' | 	GLX_LIBS='$(top_builddir)/GL/glx/libglx.la $(top_builddir)/GL/mesa/libGLcore.la' | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue