summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Engestrom <eric.engestrom@imgtec.com>2016-07-06 14:31:31 +0100
committerChad Versace <chad.versace@intel.com>2016-07-07 11:13:13 -0700
commit7adb9b094894a512c019b3378eb9e3c69d830edc (patch)
tree77b76d2d4a9c99bb266cd136648a25e66e4ee711
parent2e6d35809bf4ef60af62f9c84d394e97d5bbe2a7 (diff)
egl/display: remove unnecessary code and make it easier to read
Remove the two first level `if` as they will always be true, and flatten the two remaining `if`. No functional change. Signed-off-by: Eric Engestrom <eric.engestrom@imgtec.com> Reviewed-by: Chad Versace <chad.versace@intel.com>
-rw-r--r--src/egl/main/egldisplay.c29
1 files changed, 14 insertions, 15 deletions
diff --git a/src/egl/main/egldisplay.c b/src/egl/main/egldisplay.c
index f6db03ab50c..bbc306337ed 100644
--- a/src/egl/main/egldisplay.c
+++ b/src/egl/main/egldisplay.c
@@ -178,25 +178,24 @@ _eglNativePlatformDetectNativeDisplay(void *nativeDisplay)
_EGLPlatformType
_eglGetNativePlatform(void *nativeDisplay)
{
- static _EGLPlatformType native_platform = _EGL_INVALID_PLATFORM;
- char *detection_method = NULL;
+ static _EGLPlatformType native_platform;
+ char *detection_method;
+
+ native_platform = _eglGetNativePlatformFromEnv();
+ detection_method = "environment overwrite";
if (native_platform == _EGL_INVALID_PLATFORM) {
- native_platform = _eglGetNativePlatformFromEnv();
- detection_method = "environment overwrite";
- if (native_platform == _EGL_INVALID_PLATFORM) {
- native_platform = _eglNativePlatformDetectNativeDisplay(nativeDisplay);
- detection_method = "autodetected";
- if (native_platform == _EGL_INVALID_PLATFORM) {
- native_platform = _EGL_NATIVE_PLATFORM;
- detection_method = "build-time configuration";
- }
- }
+ native_platform = _eglNativePlatformDetectNativeDisplay(nativeDisplay);
+ detection_method = "autodetected";
+ }
+
+ if (native_platform == _EGL_INVALID_PLATFORM) {
+ native_platform = _EGL_NATIVE_PLATFORM;
+ detection_method = "build-time configuration";
}
- if (detection_method != NULL)
- _eglLog(_EGL_DEBUG, "Native platform type: %s (%s)",
- egl_platforms[native_platform].name, detection_method);
+ _eglLog(_EGL_DEBUG, "Native platform type: %s (%s)",
+ egl_platforms[native_platform].name, detection_method);
return native_platform;
}