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>
This commit is contained in:
Eric Engestrom
2016-07-06 14:31:31 +01:00
committed by Chad Versace
parent 2e6d35809b
commit 7adb9b0948

View File

@@ -178,25 +178,24 @@ _eglNativePlatformDetectNativeDisplay(void *nativeDisplay)
_EGLPlatformType _EGLPlatformType
_eglGetNativePlatform(void *nativeDisplay) _eglGetNativePlatform(void *nativeDisplay)
{ {
static _EGLPlatformType native_platform = _EGL_INVALID_PLATFORM; static _EGLPlatformType native_platform;
char *detection_method = NULL; char *detection_method;
native_platform = _eglGetNativePlatformFromEnv();
detection_method = "environment overwrite";
if (native_platform == _EGL_INVALID_PLATFORM) { if (native_platform == _EGL_INVALID_PLATFORM) {
native_platform = _eglGetNativePlatformFromEnv(); native_platform = _eglNativePlatformDetectNativeDisplay(nativeDisplay);
detection_method = "environment overwrite"; detection_method = "autodetected";
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";
}
}
} }
if (detection_method != NULL) if (native_platform == _EGL_INVALID_PLATFORM) {
_eglLog(_EGL_DEBUG, "Native platform type: %s (%s)", native_platform = _EGL_NATIVE_PLATFORM;
egl_platforms[native_platform].name, detection_method); detection_method = "build-time configuration";
}
_eglLog(_EGL_DEBUG, "Native platform type: %s (%s)",
egl_platforms[native_platform].name, detection_method);
return native_platform; return native_platform;
} }