[Mesa-dev] [RFC PATCH 4/4] mesa: Drop _mesa_getenv() wrapper.
Matt Turner
mattst88 at gmail.com
Mon Sep 22 11:22:43 PDT 2014
---
src/gallium/state_trackers/glx/xlib/glx_api.c | 20 ++++++++++----------
src/gallium/state_trackers/glx/xlib/xm_api.c | 4 ++--
src/mesa/drivers/x11/fakeglx.c | 20 ++++++++++----------
src/mesa/drivers/x11/xm_api.c | 8 ++++----
src/mesa/main/context.c | 6 +++---
src/mesa/main/debug.c | 4 ++--
src/mesa/main/errors.c | 6 +++---
src/mesa/main/extensions.c | 2 +-
src/mesa/main/imports.c | 16 ----------------
src/mesa/main/imports.h | 3 ---
src/mesa/main/shaderapi.c | 2 +-
src/mesa/math/m_debug_clip.c | 2 +-
src/mesa/math/m_debug_norm.c | 2 +-
src/mesa/math/m_debug_xform.c | 2 +-
src/mesa/tnl/t_vertex.c | 2 +-
src/mesa/x86-64/x86-64.c | 4 ++--
src/mesa/x86/common_x86.c | 10 +++++-----
17 files changed, 47 insertions(+), 66 deletions(-)
diff --git a/src/gallium/state_trackers/glx/xlib/glx_api.c b/src/gallium/state_trackers/glx/xlib/glx_api.c
index d97cbd7..a4ed2c1 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 */
@@ -273,7 +273,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
@@ -285,7 +285,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
@@ -433,11 +433,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 );
@@ -1314,7 +1314,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");
}
}
@@ -1392,7 +1392,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);
}
@@ -1410,7 +1410,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 7836c61..1b77729 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 eba13ac..08371ee 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 */
@@ -351,7 +351,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
@@ -363,7 +363,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
@@ -560,11 +560,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 );
@@ -1429,7 +1429,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");
}
}
@@ -1505,7 +1505,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);
}
@@ -1523,7 +1523,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 d860569..2d66dbd 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 682b9c7..66be6fb 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -1098,10 +1098,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;
@@ -1545,7 +1545,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 a5b40b4..089ce89 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 995fc82..25171f0 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 553c01e..4ceb210 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 281fe25..b596f7a 100644
--- a/src/mesa/main/imports.c
+++ b/src/mesa/main/imports.c
@@ -489,22 +489,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 bd44525..17e07dc 100644
--- a/src/mesa/main/imports.h
+++ b/src/mesa/main/imports.h
@@ -538,9 +538,6 @@ _mesa_half_is_negative(GLhalfARB h)
}
extern char *
-_mesa_getenv( const char *var );
-
-extern char *
_mesa_strdup( const char *s );
extern float
diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c
index 620cab3..d3fc552 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 cd8a90d..044768d 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 db71ebe..00e72be 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 fbfa9b2..f56b4cf 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 421bae2..90b97a0 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 49cbaf9..d484038 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 2a936a4..25f5c40 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 {
--
1.8.5.5
More information about the mesa-dev
mailing list