From 508d2deae98846111299a3693033a507010e3c91 Mon Sep 17 00:00:00 2001
From: Eric Anholt <anholt@freebsd.org>
Date: Sat, 29 Oct 2016 11:28:02 +0200
Subject: Remove libcwrapper usage from xorg server modules. The libcwrapper is
 not used in nxagent.

 From c3d14036729fd186d4ec7ca1de603e1f2d174e2f Mon Sep 17 00:00:00 2001
 From: Eric Anholt <anholt@freebsd.org>
 Date: Fri, 10 Feb 2006 22:00:30 +0000
 Subject: Remove libcwrapper usage from xorg server modules. The libcwrapper is
   only of (marginal) use in the drivers, and that usage remains.

 Backported-to-NX-by: Mike Gabriel <mike.gabriel@das-netzwerkteam.de>

 Fixes ArcticaProject/nx-libs#246 (together with merge commit
 ecd335fa61551d0b86d3f075469a7743ab899d95).
---
 nx-X11/extras/Mesa/include/GL/internal/glcore.h |   2 -
 nx-X11/extras/Mesa/src/mesa/main/context.c      |   4 -
 nx-X11/extras/Mesa/src/mesa/main/glheader.h     |   6 +-
 nx-X11/extras/Mesa/src/mesa/main/imports.c      | 108 +-----------------------
 nx-X11/extras/Mesa/src/mesa/main/imports.h      |  16 +---
 5 files changed, 7 insertions(+), 129 deletions(-)

(limited to 'nx-X11/extras/Mesa')

diff --git a/nx-X11/extras/Mesa/include/GL/internal/glcore.h b/nx-X11/extras/Mesa/include/GL/internal/glcore.h
index e0b06c7ca..9a864e7f2 100644
--- a/nx-X11/extras/Mesa/include/GL/internal/glcore.h
+++ b/nx-X11/extras/Mesa/include/GL/internal/glcore.h
@@ -36,9 +36,7 @@
 **
 */
 
-#ifndef XFree86LOADER
 #include <sys/types.h>
-#endif
 
 #ifdef CAPI
 #undef CAPI
diff --git a/nx-X11/extras/Mesa/src/mesa/main/context.c b/nx-X11/extras/Mesa/src/mesa/main/context.c
index eb4b4ce4e..9e98da669 100644
--- a/nx-X11/extras/Mesa/src/mesa/main/context.c
+++ b/nx-X11/extras/Mesa/src/mesa/main/context.c
@@ -1034,11 +1034,7 @@ _mesa_init_constants( GLcontext *ctx )
    /* If we're running in the X server, do bounds checking to prevent
     * segfaults and server crashes!
     */
-#if defined(XFree86LOADER) && defined(IN_MODULE)
-   ctx->Const.CheckArrayBounds = GL_TRUE;
-#else
    ctx->Const.CheckArrayBounds = GL_FALSE;
-#endif
 
    ctx->Const.MaxDrawBuffers = MAX_DRAW_BUFFERS;
 
diff --git a/nx-X11/extras/Mesa/src/mesa/main/glheader.h b/nx-X11/extras/Mesa/src/mesa/main/glheader.h
index 90b3a81a4..31c10e3e2 100644
--- a/nx-X11/extras/Mesa/src/mesa/main/glheader.h
+++ b/nx-X11/extras/Mesa/src/mesa/main/glheader.h
@@ -47,11 +47,9 @@
 #define GLHEADER_H
 
 
-#if defined(XFree86LOADER) && defined(IN_MODULE)
-#include "xf86_ansic.h"
-#else
 #include <assert.h>
 #include <ctype.h>
+
 /* If we can use Compaq's Fast Math Library on Alpha */
 #if defined(__alpha__) && defined(CCPML)
 #include <cpml.h>
@@ -65,7 +63,7 @@
 #if defined(__linux__) && defined(__i386__)
 #include <fpu_control.h>
 #endif
-#endif
+
 #include <float.h>
 #include <stdarg.h>
 
diff --git a/nx-X11/extras/Mesa/src/mesa/main/imports.c b/nx-X11/extras/Mesa/src/mesa/main/imports.c
index 9cdf4e347..1fdfe064a 100644
--- a/nx-X11/extras/Mesa/src/mesa/main/imports.c
+++ b/nx-X11/extras/Mesa/src/mesa/main/imports.c
@@ -81,33 +81,21 @@ extern int vsnprintf(char *str, size_t count, const char *fmt, va_list arg);
 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() */
 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() */
 void
 _mesa_free(void *ptr)
 {
-#if defined(XFree86LOADER) && defined(IN_MODULE)
-   xf86free(ptr);
-#else
    free(ptr);
-#endif
 }
 
 /**
@@ -211,9 +199,7 @@ _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);
@@ -224,9 +210,7 @@ _mesa_memcpy(void *dest, const void *src, size_t n)
 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);
@@ -250,9 +234,7 @@ _mesa_memset16( unsigned short *dst, unsigned short val, size_t n )
 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 );
@@ -270,33 +252,21 @@ _mesa_bzero( void *dst, size_t n )
 double
 _mesa_sin(double a)
 {
-#if defined(XFree86LOADER) && defined(IN_MODULE)
-   return xf86sin(a);
-#else
    return sin(a);
-#endif
 }
 
 /** Wrapper around either cos() or xf86cos() */
 double
 _mesa_cos(double a)
 {
-#if defined(XFree86LOADER) && defined(IN_MODULE)
-   return xf86cos(a);
-#else
    return cos(a);
-#endif
 }
 
 /** Wrapper around either sqrt() or xf86sqrt() */
 double
 _mesa_sqrtd(double x)
 {
-#if defined(XFree86LOADER) && defined(IN_MODULE)
-   return xf86sqrt(x);
-#else
    return sqrt(x);
-#endif
 }
 
 
@@ -494,9 +464,6 @@ _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
 }
@@ -508,11 +475,7 @@ _mesa_inv_sqrtf(float n)
 double
 _mesa_pow(double x, double y)
 {
-#if defined(XFree86LOADER) && defined(IN_MODULE)
-   return xf86pow(x, y);
-#else
    return pow(x, y);
-#endif
 }
 
 
@@ -681,9 +644,7 @@ _mesa_half_to_float(GLhalfARB val)
 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);
@@ -701,77 +662,49 @@ _mesa_getenv( const char *var )
 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() */
 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() */
 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() */
 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() */
 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() */
 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() */
 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 */
@@ -789,22 +722,14 @@ _mesa_strdup( const char *s )
 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() */
 double
 _mesa_strtod( const char *s, char **end )
 {
-#if defined(XFree86LOADER) && defined(IN_MODULE)
-   return xf86strtod(s, end);
-#else
    return strtod(s, end);
-#endif
 }
 
 /*@}*/
@@ -822,11 +747,7 @@ _mesa_sprintf( char *str, const char *fmt, ... )
    va_list args;
    va_start( args, fmt );  
    va_end( args );
-#if defined(XFree86LOADER) && defined(IN_MODULE)
-   r = xf86vsprintf( str, fmt, args );
-#else
    r = vsprintf( str, fmt, args );
-#endif
    return r;
 }
 
@@ -840,11 +761,7 @@ _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
 }
 
 /*@}*/
@@ -880,11 +797,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", str);
-#else
       fprintf(stderr, "Mesa warning: %s", str);
-#endif
    }
 }
 
@@ -908,13 +821,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
 }
 
 /**
@@ -1015,11 +923,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
 }
 
 /*@}*/
@@ -1050,11 +954,7 @@ 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() */
diff --git a/nx-X11/extras/Mesa/src/mesa/main/imports.h b/nx-X11/extras/Mesa/src/mesa/main/imports.h
index 37e808fc4..7c7a90a74 100644
--- a/nx-X11/extras/Mesa/src/mesa/main/imports.h
+++ b/nx-X11/extras/Mesa/src/mesa/main/imports.h
@@ -217,8 +217,6 @@ typedef union { GLfloat f; GLint i; } fi_type;
  ***/
 #if 0 /* _mesa_sqrtf() not accurate enough - temporarily disabled */
 #  define SQRTF(X)  _mesa_sqrtf(X)
-#elif defined(XFree86LOADER) && defined(IN_MODULE)
-#  define SQRTF(X)  (float) xf86sqrt((float) (X))
 #else
 #  define SQRTF(X)  (float) sqrt((float) (X))
 #endif
@@ -265,9 +263,6 @@ static INLINE GLfloat LOG2(GLfloat val)
    num.f = ((-1.0f/3) * num.f + 2) * num.f - 2.0f/3;
    return num.f + log_2;
 }
-#elif defined(XFree86LOADER) && defined(IN_MODULE)
-#define LOG2(x) ((GLfloat) (xf86log(x) * 1.442695))
-#else
 /*
  * NOTE: log_base_2(x) = log(x) / log(2)
  * NOTE: 1.442695 = 1/log(2).
@@ -275,7 +270,6 @@ static INLINE GLfloat LOG2(GLfloat val)
 #define LOG2(x)  ((GLfloat) (log(x) * 1.442695F))
 #endif
 
-
 /***
  *** IS_INF_OR_NAN: test if float is infinite or NaN
  ***/
@@ -337,15 +331,7 @@ static INLINE int GET_FLOAT_BITS( float x )
  *** LDEXPF: multiply value by an integral power of two
  *** FREXPF: extract mantissa and exponent from value
  ***/
-#if defined(XFree86LOADER) && defined(IN_MODULE)
-#define CEILF(x)   ((GLfloat) xf86ceil(x))
-#define FLOORF(x)  ((GLfloat) xf86floor(x))
-#define FABSF(x)   ((GLfloat) xf86fabs(x))
-#define LOGF(x)    ((GLfloat) xf86log(x))
-#define EXPF(x)    ((GLfloat) xf86exp(x))
-#define LDEXPF(x,y)   ((GLfloat) xf86ldexp(x,y))
-#define FREXPF(x,y)   ((GLfloat) xf86frexp(x,y))
-#elif defined(__gnu_linux__)
+#if defined(__gnu_linux__)
 /* C99 functions */
 #define CEILF(x)   ceilf(x)
 #define FLOORF(x)  floorf(x)
-- 
cgit v1.2.3