From: Matt Turner Date: Mon, 22 Sep 2014 05:53:04 +0000 (-0700) Subject: mesa: Drop _mesa_getenv() wrapper. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=5980fc35c9e2e25a5a53cb1b38245ad763885cca;p=mesa.git mesa: Drop _mesa_getenv() wrapper. Reviewed-by: Ian Romanick Reviewed-by: Jose Fonseca Reviewed-by: Emil Velikov --- diff --git a/src/gallium/state_trackers/glx/xlib/glx_api.c b/src/gallium/state_trackers/glx/xlib/glx_api.c index 84b605a0b41..976791b5ea7 100644 --- a/src/gallium/state_trackers/glx/xlib/glx_api.c +++ b/src/gallium/state_trackers/glx/xlib/glx_api.c @@ -176,7 +176,7 @@ save_glx_visual( Display *dpy, XVisualInfo *vinfo, if (dbFlag) { /* Check if the MESA_BACK_BUFFER env var is set */ - char *backbuffer = _mesa_getenv("MESA_BACK_BUFFER"); + char *backbuffer = getenv("MESA_BACK_BUFFER"); if (backbuffer) { if (backbuffer[0]=='p' || backbuffer[0]=='P') { ximageFlag = GL_FALSE; @@ -200,13 +200,13 @@ save_glx_visual( Display *dpy, XVisualInfo *vinfo, /* Comparing IDs uses less memory but sometimes fails. */ /* XXX revisit this after 3.0 is finished. */ - if (_mesa_getenv("MESA_GLX_VISUAL_HACK")) + if (getenv("MESA_GLX_VISUAL_HACK")) comparePointers = GL_TRUE; else comparePointers = GL_FALSE; /* Force the visual to have an alpha channel */ - if (rgbFlag && _mesa_getenv("MESA_GLX_FORCE_ALPHA")) + if (rgbFlag && getenv("MESA_GLX_FORCE_ALPHA")) alphaFlag = GL_TRUE; /* First check if a matching visual is already in the list */ @@ -272,7 +272,7 @@ static GLint default_depth_bits(void) { int zBits; - const char *zEnv = _mesa_getenv("MESA_GLX_DEPTH_BITS"); + const char *zEnv = getenv("MESA_GLX_DEPTH_BITS"); if (zEnv) zBits = atoi(zEnv); else @@ -284,7 +284,7 @@ static GLint default_alpha_bits(void) { int aBits; - const char *aEnv = _mesa_getenv("MESA_GLX_ALPHA_BITS"); + const char *aEnv = getenv("MESA_GLX_ALPHA_BITS"); if (aEnv) aBits = atoi(aEnv); else @@ -432,11 +432,11 @@ get_env_visual(Display *dpy, int scr, const char *varname) int depth, xclass = -1; XVisualInfo *vis; - if (!_mesa_getenv( varname )) { + if (!getenv( varname )) { return NULL; } - strncpy( value, _mesa_getenv(varname), 100 ); + strncpy( value, getenv(varname), 100 ); value[99] = 0; sscanf( value, "%s %d", type, &depth ); @@ -1313,7 +1313,7 @@ glXDestroyGLXPixmap( Display *dpy, GLXPixmap pixmap ) if (b) { XMesaDestroyBuffer(b); } - else if (_mesa_getenv("MESA_DEBUG")) { + else if (getenv("MESA_DEBUG")) { _mesa_warning(NULL, "Mesa: glXDestroyGLXPixmap: invalid pixmap\n"); } } @@ -1391,7 +1391,7 @@ glXSwapBuffers( Display *dpy, GLXDrawable drawable ) if (buffer) { XMesaSwapBuffers(buffer); } - else if (_mesa_getenv("MESA_DEBUG")) { + else if (getenv("MESA_DEBUG")) { _mesa_warning(NULL, "glXSwapBuffers: invalid drawable 0x%x\n", (int) drawable); } @@ -1409,7 +1409,7 @@ glXCopySubBufferMESA(Display *dpy, GLXDrawable drawable, if (buffer) { XMesaCopySubBuffer(buffer, x, y, width, height); } - else if (_mesa_getenv("MESA_DEBUG")) { + else if (getenv("MESA_DEBUG")) { _mesa_warning(NULL, "Mesa: glXCopySubBufferMESA: invalid drawable\n"); } } diff --git a/src/gallium/state_trackers/glx/xlib/xm_api.c b/src/gallium/state_trackers/glx/xlib/xm_api.c index 7836c6174c2..1b77729fc48 100644 --- a/src/gallium/state_trackers/glx/xlib/xm_api.c +++ b/src/gallium/state_trackers/glx/xlib/xm_api.c @@ -592,7 +592,7 @@ initialize_visual_and_buffer(XMesaVisual v, XMesaBuffer b, * which can help Brian figure out what's going on when a user * reports bugs. */ - if (_mesa_getenv("MESA_INFO")) { + if (getenv("MESA_INFO")) { printf("X/Mesa visual = %p\n", (void *) v); printf("X/Mesa level = %d\n", v->mesa_visual.level); printf("X/Mesa depth = %d\n", v->visinfo->depth); @@ -686,7 +686,7 @@ XMesaVisual XMesaCreateVisual( Display *display, return NULL; /* For debugging only */ - if (_mesa_getenv("MESA_XSYNC")) { + if (getenv("MESA_XSYNC")) { /* This makes debugging X easier. * In your debugger, set a breakpoint on _XError to stop when an * X protocol error is generated. diff --git a/src/mesa/drivers/x11/fakeglx.c b/src/mesa/drivers/x11/fakeglx.c index a47ad741420..ee05f8aaa3d 100644 --- a/src/mesa/drivers/x11/fakeglx.c +++ b/src/mesa/drivers/x11/fakeglx.c @@ -258,7 +258,7 @@ save_glx_visual( Display *dpy, XVisualInfo *vinfo, if (dbFlag) { /* Check if the MESA_BACK_BUFFER env var is set */ - char *backbuffer = _mesa_getenv("MESA_BACK_BUFFER"); + char *backbuffer = getenv("MESA_BACK_BUFFER"); if (backbuffer) { if (backbuffer[0]=='p' || backbuffer[0]=='P') { ximageFlag = GL_FALSE; @@ -279,13 +279,13 @@ save_glx_visual( Display *dpy, XVisualInfo *vinfo, /* Comparing IDs uses less memory but sometimes fails. */ /* XXX revisit this after 3.0 is finished. */ - if (_mesa_getenv("MESA_GLX_VISUAL_HACK")) + if (getenv("MESA_GLX_VISUAL_HACK")) comparePointers = GL_TRUE; else comparePointers = GL_FALSE; /* Force the visual to have an alpha channel */ - if (_mesa_getenv("MESA_GLX_FORCE_ALPHA")) + if (getenv("MESA_GLX_FORCE_ALPHA")) alphaFlag = GL_TRUE; /* First check if a matching visual is already in the list */ @@ -350,7 +350,7 @@ static GLint default_depth_bits(void) { int zBits; - const char *zEnv = _mesa_getenv("MESA_GLX_DEPTH_BITS"); + const char *zEnv = getenv("MESA_GLX_DEPTH_BITS"); if (zEnv) zBits = atoi(zEnv); else @@ -362,7 +362,7 @@ static GLint default_alpha_bits(void) { int aBits; - const char *aEnv = _mesa_getenv("MESA_GLX_ALPHA_BITS"); + const char *aEnv = getenv("MESA_GLX_ALPHA_BITS"); if (aEnv) aBits = atoi(aEnv); else @@ -559,11 +559,11 @@ get_env_visual(Display *dpy, int scr, const char *varname) int depth, xclass = -1; XVisualInfo *vis; - if (!_mesa_getenv( varname )) { + if (!getenv( varname )) { return NULL; } - strncpy( value, _mesa_getenv(varname), 100 ); + strncpy( value, getenv(varname), 100 ); value[99] = 0; sscanf( value, "%s %d", type, &depth ); @@ -1428,7 +1428,7 @@ Fake_glXDestroyGLXPixmap( Display *dpy, GLXPixmap pixmap ) if (b) { XMesaDestroyBuffer(b); } - else if (_mesa_getenv("MESA_DEBUG")) { + else if (getenv("MESA_DEBUG")) { _mesa_warning(NULL, "Mesa: glXDestroyGLXPixmap: invalid pixmap\n"); } } @@ -1504,7 +1504,7 @@ Fake_glXSwapBuffers( Display *dpy, GLXDrawable drawable ) if (buffer) { XMesaSwapBuffers(buffer); } - else if (_mesa_getenv("MESA_DEBUG")) { + else if (getenv("MESA_DEBUG")) { _mesa_warning(NULL, "glXSwapBuffers: invalid drawable 0x%x\n", (int) drawable); } @@ -1522,7 +1522,7 @@ Fake_glXCopySubBufferMESA( Display *dpy, GLXDrawable drawable, if (buffer) { XMesaCopySubBuffer(buffer, x, y, width, height); } - else if (_mesa_getenv("MESA_DEBUG")) { + else if (getenv("MESA_DEBUG")) { _mesa_warning(NULL, "Mesa: glXCopySubBufferMESA: invalid drawable\n"); } } diff --git a/src/mesa/drivers/x11/xm_api.c b/src/mesa/drivers/x11/xm_api.c index d860569eccc..2d66dbdcdf1 100644 --- a/src/mesa/drivers/x11/xm_api.c +++ b/src/mesa/drivers/x11/xm_api.c @@ -582,7 +582,7 @@ initialize_visual_and_buffer(XMesaVisual v, XMesaBuffer b, } v->mesa_visual.indexBits = 0; - if (_mesa_getenv("MESA_NO_DITHER")) { + if (getenv("MESA_NO_DITHER")) { v->dithered_pf = v->undithered_pf; } @@ -592,7 +592,7 @@ initialize_visual_and_buffer(XMesaVisual v, XMesaBuffer b, * which can help Brian figure out what's going on when a user * reports bugs. */ - if (_mesa_getenv("MESA_INFO")) { + if (getenv("MESA_INFO")) { printf("X/Mesa visual = %p\n", (void *) v); printf("X/Mesa dithered pf = %u\n", v->dithered_pf); printf("X/Mesa undithered pf = %u\n", v->undithered_pf); @@ -760,7 +760,7 @@ XMesaVisual XMesaCreateVisual( XMesaDisplay *display, GLint red_bits, green_bits, blue_bits, alpha_bits; /* For debugging only */ - if (_mesa_getenv("MESA_XSYNC")) { + if (getenv("MESA_XSYNC")) { /* This makes debugging X easier. * In your debugger, set a breakpoint on _XError to stop when an * X protocol error is generated. @@ -791,7 +791,7 @@ XMesaVisual XMesaCreateVisual( XMesaDisplay *display, memcpy(v->visinfo, visinfo, sizeof(*visinfo)); /* check for MESA_GAMMA environment variable */ - gamma = _mesa_getenv("MESA_GAMMA"); + gamma = getenv("MESA_GAMMA"); if (gamma) { v->RedGamma = v->GreenGamma = v->BlueGamma = 0.0; sscanf( gamma, "%f %f %f", &v->RedGamma, &v->GreenGamma, &v->BlueGamma ); diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index 53fb9c6e5f9..9cca39e5060 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -1090,10 +1090,10 @@ _mesa_initialize_context(struct gl_context *ctx, ctx->CurrentDispatch = ctx->OutsideBeginEnd; ctx->FragmentProgram._MaintainTexEnvProgram - = (_mesa_getenv("MESA_TEX_PROG") != NULL); + = (getenv("MESA_TEX_PROG") != NULL); ctx->VertexProgram._MaintainTnlProgram - = (_mesa_getenv("MESA_TNL_PROG") != NULL); + = (getenv("MESA_TNL_PROG") != NULL); if (ctx->VertexProgram._MaintainTnlProgram) { /* this is required... */ ctx->FragmentProgram._MaintainTexEnvProgram = GL_TRUE; @@ -1537,7 +1537,7 @@ handle_first_current(struct gl_context *ctx) * first time each context is made current we'll print some useful * information. */ - if (_mesa_getenv("MESA_INFO")) { + if (getenv("MESA_INFO")) { _mesa_print_info(ctx); } } diff --git a/src/mesa/main/debug.c b/src/mesa/main/debug.c index a5b40b4b560..089ce8987ae 100644 --- a/src/mesa/main/debug.c +++ b/src/mesa/main/debug.c @@ -215,8 +215,8 @@ set_debug_flags(const char *str) void _mesa_init_debug( struct gl_context *ctx ) { - set_debug_flags(_mesa_getenv("MESA_DEBUG")); - set_verbose_flags(_mesa_getenv("MESA_VERBOSE")); + set_debug_flags(getenv("MESA_DEBUG")); + set_verbose_flags(getenv("MESA_VERBOSE")); } diff --git a/src/mesa/main/errors.c b/src/mesa/main/errors.c index 995fc820506..25171f0ee27 100644 --- a/src/mesa/main/errors.c +++ b/src/mesa/main/errors.c @@ -1170,7 +1170,7 @@ output_if_debug(const char *prefixString, const char *outputString, /* If MESA_LOG_FILE env var is set, log Mesa errors, warnings, * etc to the named file. Otherwise, output to stderr. */ - const char *logFile = _mesa_getenv("MESA_LOG_FILE"); + const char *logFile = getenv("MESA_LOG_FILE"); if (logFile) fout = fopen(logFile, "w"); if (!fout) @@ -1183,7 +1183,7 @@ output_if_debug(const char *prefixString, const char *outputString, debug = 1; #else /* in release builds, be silent unless MESA_DEBUG is set */ - debug = _mesa_getenv("MESA_DEBUG") != NULL; + debug = getenv("MESA_DEBUG") != NULL; #endif } @@ -1288,7 +1288,7 @@ should_output(struct gl_context *ctx, GLenum error, const char *fmtString) /* Check debug environment variable only once: */ if (debug == -1) { - const char *debugEnv = _mesa_getenv("MESA_DEBUG"); + const char *debugEnv = getenv("MESA_DEBUG"); #ifdef DEBUG if (debugEnv && strstr(debugEnv, "silent")) diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c index 43f0e8dd0cc..f0e2f89e494 100644 --- a/src/mesa/main/extensions.c +++ b/src/mesa/main/extensions.c @@ -588,7 +588,7 @@ free_unknown_extensions_strings(void) void _mesa_one_time_init_extension_overrides(void) { - const char *env_const = _mesa_getenv("MESA_EXTENSION_OVERRIDE"); + const char *env_const = getenv("MESA_EXTENSION_OVERRIDE"); char *env; char *ext; int len; diff --git a/src/mesa/main/imports.c b/src/mesa/main/imports.c index 2c5f20d02ec..2c2d11e35ac 100644 --- a/src/mesa/main/imports.c +++ b/src/mesa/main/imports.c @@ -474,22 +474,6 @@ _mesa_half_to_float(GLhalfARB val) /*@}*/ -/**********************************************************************/ -/** \name Environment vars */ -/*@{*/ - -/** - * Wrapper for getenv(). - */ -char * -_mesa_getenv( const char *var ) -{ - return getenv(var); -} - -/*@}*/ - - /**********************************************************************/ /** \name String */ /*@{*/ diff --git a/src/mesa/main/imports.h b/src/mesa/main/imports.h index 8f8bcafcc57..4cd2f3f3172 100644 --- a/src/mesa/main/imports.h +++ b/src/mesa/main/imports.h @@ -534,9 +534,6 @@ _mesa_half_is_negative(GLhalfARB h) return h & 0x8000; } -extern char * -_mesa_getenv( const char *var ); - extern char * _mesa_strdup( const char *s ); diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c index dc8b255d179..30a75191897 100644 --- a/src/mesa/main/shaderapi.c +++ b/src/mesa/main/shaderapi.c @@ -70,7 +70,7 @@ GLbitfield _mesa_get_shader_flags(void) { GLbitfield flags = 0x0; - const char *env = _mesa_getenv("MESA_GLSL"); + const char *env = getenv("MESA_GLSL"); if (env) { if (strstr(env, "dump_on_error")) diff --git a/src/mesa/math/m_debug_clip.c b/src/mesa/math/m_debug_clip.c index cd8a90d4d56..044768dbdd2 100644 --- a/src/mesa/math/m_debug_clip.c +++ b/src/mesa/math/m_debug_clip.c @@ -355,7 +355,7 @@ void _math_test_all_cliptest_functions( char *description ) if ( first_time ) { first_time = 0; - mesa_profile = _mesa_getenv( "MESA_PROFILE" ); + mesa_profile = getenv( "MESA_PROFILE" ); } #ifdef RUN_DEBUG_BENCHMARK diff --git a/src/mesa/math/m_debug_norm.c b/src/mesa/math/m_debug_norm.c index db71ebef0c6..00e72be54e9 100644 --- a/src/mesa/math/m_debug_norm.c +++ b/src/mesa/math/m_debug_norm.c @@ -339,7 +339,7 @@ void _math_test_all_normal_transform_functions( char *description ) if ( first_time ) { first_time = 0; - mesa_profile = _mesa_getenv( "MESA_PROFILE" ); + mesa_profile = getenv( "MESA_PROFILE" ); } #ifdef RUN_DEBUG_BENCHMARK diff --git a/src/mesa/math/m_debug_xform.c b/src/mesa/math/m_debug_xform.c index fbfa9b28a70..f56b4cfc7f1 100644 --- a/src/mesa/math/m_debug_xform.c +++ b/src/mesa/math/m_debug_xform.c @@ -285,7 +285,7 @@ void _math_test_all_transform_functions( char *description ) if ( first_time ) { first_time = 0; - mesa_profile = _mesa_getenv( "MESA_PROFILE" ); + mesa_profile = getenv( "MESA_PROFILE" ); } #ifdef RUN_DEBUG_BENCHMARK diff --git a/src/mesa/tnl/t_vertex.c b/src/mesa/tnl/t_vertex.c index 421bae2b818..90b97a092ba 100644 --- a/src/mesa/tnl/t_vertex.c +++ b/src/mesa/tnl/t_vertex.c @@ -543,7 +543,7 @@ void _tnl_init_vertices( struct gl_context *ctx, vtx->codegen_emit = NULL; #ifdef USE_SSE_ASM - if (!_mesa_getenv("MESA_NO_CODEGEN")) + if (!getenv("MESA_NO_CODEGEN")) vtx->codegen_emit = _tnl_generate_sse_emit; #endif } diff --git a/src/mesa/x86-64/x86-64.c b/src/mesa/x86-64/x86-64.c index 49cbaf99be9..d484038ee78 100644 --- a/src/mesa/x86-64/x86-64.c +++ b/src/mesa/x86-64/x86-64.c @@ -64,7 +64,7 @@ extern void _mesa_x86_64_transform_points4_2d( XFORM_ARGS ); #ifdef USE_X86_64_ASM static void message( const char *msg ) { - if (_mesa_getenv("MESA_DEBUG")) { + if (getenv("MESA_DEBUG")) { _mesa_debug( NULL, "%s", msg ); } } @@ -76,7 +76,7 @@ void _mesa_init_all_x86_64_transform_asm(void) #ifdef USE_X86_64_ASM unsigned int regs[4]; - if ( _mesa_getenv( "MESA_NO_ASM" ) ) { + if ( getenv( "MESA_NO_ASM" ) ) { return; } diff --git a/src/mesa/x86/common_x86.c b/src/mesa/x86/common_x86.c index 2a936a473ef..25f5c40e21c 100644 --- a/src/mesa/x86/common_x86.c +++ b/src/mesa/x86/common_x86.c @@ -224,7 +224,7 @@ _mesa_get_x86_features(void) #ifdef USE_X86_ASM _mesa_x86_cpu_features = 0x0; - if (_mesa_getenv( "MESA_NO_ASM")) { + if (getenv( "MESA_NO_ASM")) { return; } @@ -307,7 +307,7 @@ _mesa_get_x86_features(void) #ifdef USE_MMX_ASM if ( cpu_has_mmx ) { - if ( _mesa_getenv( "MESA_NO_MMX" ) == 0 ) { + if ( getenv( "MESA_NO_MMX" ) == 0 ) { if (detection_debug) _mesa_debug(NULL, "MMX cpu detected.\n"); } else { @@ -318,7 +318,7 @@ _mesa_get_x86_features(void) #ifdef USE_3DNOW_ASM if ( cpu_has_3dnow ) { - if ( _mesa_getenv( "MESA_NO_3DNOW" ) == 0 ) { + if ( getenv( "MESA_NO_3DNOW" ) == 0 ) { if (detection_debug) _mesa_debug(NULL, "3DNow! cpu detected.\n"); } else { @@ -329,10 +329,10 @@ _mesa_get_x86_features(void) #ifdef USE_SSE_ASM if ( cpu_has_xmm ) { - if ( _mesa_getenv( "MESA_NO_SSE" ) == 0 ) { + if ( getenv( "MESA_NO_SSE" ) == 0 ) { if (detection_debug) _mesa_debug(NULL, "SSE cpu detected.\n"); - if ( _mesa_getenv( "MESA_FORCE_SSE" ) == 0 ) { + if ( getenv( "MESA_FORCE_SSE" ) == 0 ) { _mesa_check_os_sse_support(); } } else {