summaryrefslogtreecommitdiff
path: root/misc/win32
diff options
context:
space:
mode:
authorWilliam A. Rowe Jr <wrowe@apache.org>2001-12-28 23:50:49 +0000
committerWilliam A. Rowe Jr <wrowe@apache.org>2001-12-28 23:50:49 +0000
commitb685ef9d365fa4c1c7c617b484009bbdcf212592 (patch)
treedb19fb3b04d25a636fb4becd5c38c8b1a47864ea /misc/win32
parent6850c69f721ffa436545d01396ccd5e5870f91b2 (diff)
downloadapr-b685ef9d365fa4c1c7c617b484009bbdcf212592.tar.gz
Substantial optimization of the os_level semantic. Since this is entirely
for internal consumption, and apr_initialize must be called, resolve the situation once and use the static, shared value for the remainder of the program execution. Next step is to allow conditional builds [excluding older 9x paths] if the user has no interest in 9x support. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@62675 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'misc/win32')
-rw-r--r--misc/win32/misc.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/misc/win32/misc.c b/misc/win32/misc.c
index a2f9a40f2..ef3cd28a2 100644
--- a/misc/win32/misc.c
+++ b/misc/win32/misc.c
@@ -59,11 +59,12 @@ apr_oslevel_e apr_os_level = APR_WIN_UNK;
apr_status_t apr_get_oslevel(apr_pool_t *cont, apr_oslevel_e *level)
{
- static OSVERSIONINFO oslev;
- static unsigned int servpack = 0;
- char *pservpack;
+ if (apr_os_level == APR_WIN_UNK)
+ {
+ static OSVERSIONINFO oslev;
+ static unsigned int servpack = 0;
+ char *pservpack;
- if (apr_os_level == APR_WIN_UNK) {
oslev.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
GetVersionEx(&oslev);
if (oslev.dwPlatformId == VER_PLATFORM_WIN32_NT) {
@@ -114,7 +115,7 @@ apr_status_t apr_get_oslevel(apr_pool_t *cont, apr_oslevel_e *level)
*level = apr_os_level;
return APR_SUCCESS;
}
- return APR_EEXIST;
+ return APR_EGENERAL;
}