summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/imports.c
diff options
context:
space:
mode:
authorKeith Whitwell <[email protected]>2007-01-16 11:22:57 +0000
committerKeith Whitwell <[email protected]>2007-01-16 11:22:57 +0000
commit6a3fdc3a1ea6c306d9543791bf172dd1052d7382 (patch)
treec372c6daff13e435e79914c2e40dfe9d370c337b /src/mesa/main/imports.c
parent0b412f8f156b46b0e7220a2b61e0f41781769f66 (diff)
parenta03fc8277180e2171519165a724849e2254ef0b7 (diff)
Merge branch 'master' of git+ssh://[email protected]/git/mesa/mesa into vbo-0.2
Conflicts: src/mesa/array_cache/sources src/mesa/drivers/dri/i965/brw_context.c src/mesa/drivers/dri/i965/brw_draw.c src/mesa/drivers/dri/i965/brw_fallback.c src/mesa/drivers/dri/i965/brw_vs_emit.c src/mesa/drivers/dri/i965/brw_vs_tnl.c src/mesa/drivers/dri/mach64/mach64_context.c src/mesa/main/extensions.c src/mesa/main/getstring.c src/mesa/tnl/sources src/mesa/tnl/t_save_api.c src/mesa/tnl/t_save_playback.c src/mesa/tnl/t_vtx_api.c src/mesa/tnl/t_vtx_exec.c src/mesa/vbo/vbo_attrib.h src/mesa/vbo/vbo_exec_api.c src/mesa/vbo/vbo_save_api.c src/mesa/vbo/vbo_save_draw.c
Diffstat (limited to 'src/mesa/main/imports.c')
-rw-r--r--src/mesa/main/imports.c222
1 files changed, 40 insertions, 182 deletions
diff --git a/src/mesa/main/imports.c b/src/mesa/main/imports.c
index a09c497795e..ed809acbe2a 100644
--- a/src/mesa/main/imports.c
+++ b/src/mesa/main/imports.c
@@ -24,9 +24,6 @@
* - scanf
* - qsort
* - rand and RAND_MAX
- *
- * \note When compiled into a XFree86 module these functions wrap around
- * XFree86 own wrappers.
*/
/*
@@ -71,50 +68,29 @@ extern int vsnprintf(char *str, size_t count, const char *fmt, va_list arg);
#endif
#endif
-/* If we don't actually want to use the libcwrapper junk (even though we're
- * building an Xorg server module), then just undef IN_MODULE to signal that to
- * the following code. It's left around for now to allow compiling of newish
- * Mesa with older servers, but this whole mess should go away at some point.
- */
-#ifdef NO_LIBCWRAPPER
-#undef IN_MODULE
-#endif
-
/**********************************************************************/
/** \name Memory */
/*@{*/
-/** Wrapper around either malloc() or xf86malloc() */
+/** Wrapper around malloc() */
void *
_mesa_malloc(size_t bytes)
{
-#if defined(XFree86LOADER) && defined(IN_MODULE)
- return xf86malloc(bytes);
-#else
return malloc(bytes);
-#endif
}
-/** Wrapper around either calloc() or xf86calloc() */
+/** Wrapper around calloc() */
void *
_mesa_calloc(size_t bytes)
{
-#if defined(XFree86LOADER) && defined(IN_MODULE)
- return xf86calloc(1, bytes);
-#else
return calloc(1, bytes);
-#endif
}
-/** Wrapper around either free() or xf86free() */
+/** Wrapper around free() */
void
_mesa_free(void *ptr)
{
-#if defined(XFree86LOADER) && defined(IN_MODULE)
- xf86free(ptr);
-#else
free(ptr);
-#endif
}
/**
@@ -131,7 +107,7 @@ _mesa_free(void *ptr)
void *
_mesa_align_malloc(size_t bytes, unsigned long alignment)
{
-#if defined(HAVE_POSIX_MEMALIGN) && !(defined(XFree86LOADER) && defined(IN_MODULE))
+#if defined(HAVE_POSIX_MEMALIGN)
void *mem;
(void) posix_memalign(& mem, alignment, bytes);
@@ -157,7 +133,7 @@ _mesa_align_malloc(size_t bytes, unsigned long alignment)
#endif
return (void *) buf;
-#endif /* defined(HAVE_POSIX_MEMALIGN) && !(defined(XFree86LOADER) && defined(IN_MODULE)) */
+#endif /* defined(HAVE_POSIX_MEMALIGN) */
}
/**
@@ -167,7 +143,7 @@ _mesa_align_malloc(size_t bytes, unsigned long alignment)
void *
_mesa_align_calloc(size_t bytes, unsigned long alignment)
{
-#if defined(HAVE_POSIX_MEMALIGN) && !(defined(XFree86LOADER) && defined(IN_MODULE))
+#if defined(HAVE_POSIX_MEMALIGN)
void *mem;
mem = _mesa_align_malloc(bytes, alignment);
@@ -197,7 +173,7 @@ _mesa_align_calloc(size_t bytes, unsigned long alignment)
#endif
return (void *)buf;
-#endif /* defined(HAVE_POSIX_MEMALIGN) && !(defined(XFree86LOADER) && defined(IN_MODULE)) */
+#endif /* defined(HAVE_POSIX_MEMALIGN) */
}
/**
@@ -210,13 +186,13 @@ _mesa_align_calloc(size_t bytes, unsigned long alignment)
void
_mesa_align_free(void *ptr)
{
-#if defined(HAVE_POSIX_MEMALIGN) && !(defined(XFree86LOADER) && defined(IN_MODULE))
+#if defined(HAVE_POSIX_MEMALIGN)
free(ptr);
#else
void **cubbyHole = (void **) ((char *) ptr - sizeof(void *));
void *realAddr = *cubbyHole;
_mesa_free(realAddr);
-#endif /* defined(HAVE_POSIX_MEMALIGN) && !(defined(XFree86LOADER) && defined(IN_MODULE)) */
+#endif /* defined(HAVE_POSIX_MEMALIGN) */
}
/**
@@ -255,22 +231,18 @@ _mesa_realloc(void *oldBuffer, size_t oldSize, size_t newSize)
void *
_mesa_memcpy(void *dest, const void *src, size_t n)
{
-#if defined(XFree86LOADER) && defined(IN_MODULE)
- return xf86memcpy(dest, src, n);
-#elif defined(SUNOS4)
+#if defined(SUNOS4)
return memcpy((char *) dest, (char *) src, (int) n);
#else
return memcpy(dest, src, n);
#endif
}
-/** Wrapper around either memset() or xf86memset() */
+/** Wrapper around memset() */
void
_mesa_memset( void *dst, int val, size_t n )
{
-#if defined(XFree86LOADER) && defined(IN_MODULE)
- xf86memset( dst, val, n );
-#elif defined(SUNOS4)
+#if defined(SUNOS4)
memset( (char *) dst, (int) val, (int) n );
#else
memset(dst, val, n);
@@ -290,26 +262,22 @@ _mesa_memset16( unsigned short *dst, unsigned short val, size_t n )
*dst++ = val;
}
-/** Wrapper around either memcpy() or xf86memcpy() or bzero() */
+/** Wrapper around either memcpy() or bzero() */
void
_mesa_bzero( void *dst, size_t n )
{
-#if defined(XFree86LOADER) && defined(IN_MODULE)
- xf86memset( dst, 0, n );
-#elif defined(__FreeBSD__)
+#if defined(__FreeBSD__)
bzero( dst, n );
#else
memset( dst, 0, n );
#endif
}
-/** Wrapper around either memcmp() or xf86memcmp() */
+/** Wrapper around memcmp() */
int
_mesa_memcmp( const void *s1, const void *s2, size_t n )
{
-#if defined(XFree86LOADER) && defined(IN_MODULE)
- return xf86memcmp( s1, s2, n );
-#elif defined(SUNOS4)
+#if defined(SUNOS4)
return memcmp( (char *) s1, (char *) s2, (int) n );
#else
return memcmp(s1, s2, n);
@@ -323,70 +291,46 @@ _mesa_memcmp( const void *s1, const void *s2, size_t n )
/** \name Math */
/*@{*/
-/** Wrapper around either sin() or xf86sin() */
+/** Wrapper around sin() */
double
_mesa_sin(double a)
{
-#if defined(XFree86LOADER) && defined(IN_MODULE)
- return xf86sin(a);
-#else
return sin(a);
-#endif
}
-/** Single precision wrapper around either sin() or xf86sin() */
+/** Single precision wrapper around sin() */
float
_mesa_sinf(float a)
{
-#if defined(XFree86LOADER) && defined(IN_MODULE)
- return (float) xf86sin((double) a);
-#else
return (float) sin((double) a);
-#endif
}
-/** Wrapper around either cos() or xf86cos() */
+/** Wrapper around cos() */
double
_mesa_cos(double a)
{
-#if defined(XFree86LOADER) && defined(IN_MODULE)
- return xf86cos(a);
-#else
return cos(a);
-#endif
}
-/** Single precision wrapper around either asin() or xf86asin() */
+/** Single precision wrapper around asin() */
float
_mesa_asinf(float x)
{
-#if defined(XFree86LOADER) && defined(IN_MODULE)
- return (float) xf86asin((double) x);
-#else
return (float) asin((double) x);
-#endif
}
-/** Single precision wrapper around either atan() or xf86atan() */
+/** Single precision wrapper around atan() */
float
_mesa_atanf(float x)
{
-#if defined(XFree86LOADER) && defined(IN_MODULE)
- return (float) xf86atan((double) x);
-#else
return (float) atan((double) x);
-#endif
}
-/** Wrapper around either sqrt() or xf86sqrt() */
+/** Wrapper around sqrt() */
double
_mesa_sqrtd(double x)
{
-#if defined(XFree86LOADER) && defined(IN_MODULE)
- return xf86sqrt(x);
-#else
return sqrt(x);
-#endif
}
@@ -584,25 +528,17 @@ _mesa_inv_sqrtf(float n)
return x3 * r3;
#endif
-#elif defined(XFree86LOADER) && defined(IN_MODULE)
- return 1.0F / xf86sqrt(n);
#else
return (float) (1.0 / sqrt(n));
#endif
}
-/**
- * Wrapper around either pow() or xf86pow().
- */
+/** Wrapper around pow() */
double
_mesa_pow(double x, double y)
{
-#if defined(XFree86LOADER) && defined(IN_MODULE)
- return xf86pow(x, y);
-#else
return pow(x, y);
-#endif
}
@@ -633,8 +569,6 @@ _mesa_ffs(int i)
}
}
return bit;
-#elif defined(XFree86LOADER) && defined(IN_MODULE)
- return xf86ffs(i);
#else
return ffs(i);
#endif
@@ -807,11 +741,7 @@ void *
_mesa_bsearch( const void *key, const void *base, size_t nmemb, size_t size,
int (*compar)(const void *, const void *) )
{
-#if defined(XFree86LOADER) && defined(IN_MODULE)
- return xf86bsearch(key, base, nmemb, size, compar);
-#else
return bsearch(key, base, nmemb, size, compar);
-#endif
}
/*@}*/
@@ -827,9 +757,7 @@ _mesa_bsearch( const void *key, const void *base, size_t nmemb, size_t size,
char *
_mesa_getenv( const char *var )
{
-#if defined(XFree86LOADER) && defined(IN_MODULE)
- return xf86getenv(var);
-#elif defined(_XBOX)
+#if defined(_XBOX)
return NULL;
#else
return getenv(var);
@@ -843,81 +771,53 @@ _mesa_getenv( const char *var )
/** \name String */
/*@{*/
-/** Wrapper around either strstr() or xf86strstr() */
+/** Wrapper around strstr() */
char *
_mesa_strstr( const char *haystack, const char *needle )
{
-#if defined(XFree86LOADER) && defined(IN_MODULE)
- return xf86strstr(haystack, needle);
-#else
return strstr(haystack, needle);
-#endif
}
-/** Wrapper around either strncat() or xf86strncat() */
+/** Wrapper around strncat() */
char *
_mesa_strncat( char *dest, const char *src, size_t n )
{
-#if defined(XFree86LOADER) && defined(IN_MODULE)
- return xf86strncat(dest, src, n);
-#else
return strncat(dest, src, n);
-#endif
}
-/** Wrapper around either strcpy() or xf86strcpy() */
+/** Wrapper around strcpy() */
char *
_mesa_strcpy( char *dest, const char *src )
{
-#if defined(XFree86LOADER) && defined(IN_MODULE)
- return xf86strcpy(dest, src);
-#else
return strcpy(dest, src);
-#endif
}
-/** Wrapper around either strncpy() or xf86strncpy() */
+/** Wrapper around strncpy() */
char *
_mesa_strncpy( char *dest, const char *src, size_t n )
{
-#if defined(XFree86LOADER) && defined(IN_MODULE)
- return xf86strncpy(dest, src, n);
-#else
return strncpy(dest, src, n);
-#endif
}
-/** Wrapper around either strlen() or xf86strlen() */
+/** Wrapper around strlen() */
size_t
_mesa_strlen( const char *s )
{
-#if defined(XFree86LOADER) && defined(IN_MODULE)
- return xf86strlen(s);
-#else
return strlen(s);
-#endif
}
-/** Wrapper around either strcmp() or xf86strcmp() */
+/** Wrapper around strcmp() */
int
_mesa_strcmp( const char *s1, const char *s2 )
{
-#if defined(XFree86LOADER) && defined(IN_MODULE)
- return xf86strcmp(s1, s2);
-#else
return strcmp(s1, s2);
-#endif
}
-/** Wrapper around either strncmp() or xf86strncmp() */
+/** Wrapper around strncmp() */
int
_mesa_strncmp( const char *s1, const char *s2, size_t n )
{
-#if defined(XFree86LOADER) && defined(IN_MODULE)
- return xf86strncmp(s1, s2, n);
-#else
return strncmp(s1, s2, n);
-#endif
}
/** Implemented using _mesa_malloc() and _mesa_strcpy */
@@ -931,26 +831,18 @@ _mesa_strdup( const char *s )
return s2;
}
-/** Wrapper around either atoi() or xf86atoi() */
+/** Wrapper around atoi() */
int
_mesa_atoi(const char *s)
{
-#if defined(XFree86LOADER) && defined(IN_MODULE)
- return xf86atoi(s);
-#else
return atoi(s);
-#endif
}
-/** Wrapper around either strtod() or xf86strtod() */
+/** Wrapper around strtod() */
double
_mesa_strtod( const char *s, char **end )
{
-#if defined(XFree86LOADER) && defined(IN_MODULE)
- return xf86strtod(s, end);
-#else
return strtod(s, end);
-#endif
}
/*@}*/
@@ -960,24 +852,19 @@ _mesa_strtod( const char *s, char **end )
/** \name I/O */
/*@{*/
-/** Wrapper around either vsprintf() or xf86vsprintf() */
+/** Wrapper around vsprintf() */
int
_mesa_sprintf( char *str, const char *fmt, ... )
{
int r;
va_list args;
va_start( args, fmt );
-#if defined(XFree86LOADER) && defined(IN_MODULE)
- r = xf86vsprintf( str, fmt, args );
-#else
r = vsprintf( str, fmt, args );
-#endif
va_end( args );
return r;
}
-/** Wrapper around either printf() or xf86printf(), using vsprintf() for
- * the formatting. */
+/** Wrapper around printf(), using vsprintf() for the formatting. */
void
_mesa_printf( const char *fmtString, ... )
{
@@ -986,22 +873,14 @@ _mesa_printf( const char *fmtString, ... )
va_start( args, fmtString );
vsnprintf(s, MAXSTRING, fmtString, args);
va_end( args );
-#if defined(XFree86LOADER) && defined(IN_MODULE)
- xf86printf("%s", s);
-#else
fprintf(stderr,"%s", s);
-#endif
}
-/** Wrapper around either vsprintf() or xf86vsprintf() */
+/** Wrapper around vsprintf() */
int
_mesa_vsprintf( char *str, const char *fmt, va_list args )
{
-#if defined(XFree86LOADER) && defined(IN_MODULE)
- return xf86vsprintf( str, fmt, args );
-#else
return vsprintf( str, fmt, args );
-#endif
}
/*@}*/
@@ -1019,7 +898,7 @@ _mesa_vsprintf( char *str, const char *fmt, va_list args )
*
* If debugging is enabled (either at compile-time via the DEBUG macro, or
* run-time via the MESA_DEBUG environment variable), prints the warning to
- * stderr, either via fprintf() or xf86printf().
+ * stderr via fprintf().
*/
void
_mesa_warning( GLcontext *ctx, const char *fmtString, ... )
@@ -1037,11 +916,7 @@ _mesa_warning( GLcontext *ctx, const char *fmtString, ... )
debug = _mesa_getenv("MESA_DEBUG") ? GL_TRUE : GL_FALSE;
#endif
if (debug) {
-#if defined(XFree86LOADER) && defined(IN_MODULE)
- xf86fprintf(stderr, "Mesa warning: %s\n", str);
-#else
fprintf(stderr, "Mesa warning: %s\n", str);
-#endif
}
}
@@ -1052,7 +927,7 @@ _mesa_warning( GLcontext *ctx, const char *fmtString, ... )
* \param ctx GL context.
* \param s problem description string.
*
- * Prints the message to stderr, either via fprintf() or xf86fprintf().
+ * Prints the message to stderr via fprintf().
*/
void
_mesa_problem( const GLcontext *ctx, const char *fmtString, ... )
@@ -1065,13 +940,8 @@ _mesa_problem( const GLcontext *ctx, const char *fmtString, ... )
vsnprintf( str, MAXSTRING, fmtString, args );
va_end( args );
-#if defined(XFree86LOADER) && defined(IN_MODULE)
- xf86fprintf(stderr, "Mesa %s implementation error: %s\n", MESA_VERSION_STRING, str);
- xf86fprintf(stderr, "Please report at bugzilla.freedesktop.org\n");
-#else
fprintf(stderr, "Mesa %s implementation error: %s\n", MESA_VERSION_STRING, str);
fprintf(stderr, "Please report at bugzilla.freedesktop.org\n");
-#endif
}
/**
@@ -1161,7 +1031,7 @@ _mesa_error( GLcontext *ctx, GLenum error, const char *fmtString, ... )
* \param ctx GL context.
* \param fmtString printf() alike format string.
*
- * Prints the message to stderr, either via fprintf() or xf86printf().
+ * Prints the message to stderr via fprintf().
*/
void
_mesa_debug( const GLcontext *ctx, const char *fmtString, ... )
@@ -1172,11 +1042,7 @@ _mesa_debug( const GLcontext *ctx, const char *fmtString, ... )
va_start(args, fmtString);
vsnprintf(s, MAXSTRING, fmtString, args);
va_end(args);
-#if defined(XFree86LOADER) && defined(IN_MODULE)
- xf86fprintf(stderr, "Mesa: %s", s);
-#else
fprintf(stderr, "Mesa: %s", s);
-#endif
#endif /* DEBUG */
(void) ctx;
(void) fmtString;
@@ -1195,11 +1061,7 @@ _mesa_debug( const GLcontext *ctx, const char *fmtString, ... )
void
_mesa_exit( int status )
{
-#if defined(XFree86LOADER) && defined(IN_MODULE)
- xf86exit(status);
-#else
exit(status);
-#endif
}
/*@}*/
@@ -1225,16 +1087,12 @@ default_calloc(__GLcontext *gc, size_t numElem, size_t elemSize)
return _mesa_calloc(numElem * elemSize);
}
-/** Wrapper around either realloc() or xf86realloc() */
+/** Wrapper around realloc() */
static void *
default_realloc(__GLcontext *gc, void *oldAddr, size_t newSize)
{
(void) gc;
-#if defined(XFree86LOADER) && defined(IN_MODULE)
- return xf86realloc(oldAddr, newSize);
-#else
return realloc(oldAddr, newSize);
-#endif
}
/** Wrapper around _mesa_free() */