summaryrefslogtreecommitdiff
path: root/misc
diff options
context:
space:
mode:
authorMladen Turk <mturk@apache.org>2021-12-02 22:09:53 +0000
committerMladen Turk <mturk@apache.org>2021-12-02 22:09:53 +0000
commitfd59a4a0747cf5895c21481acb67f1519b11802a (patch)
tree52e43979463cd86b92971dff2bea3a358168abcf /misc
parent62285e4db364a86e99699b0a1d13a2f2f3bae49f (diff)
downloadapr-fd59a4a0747cf5895c21481acb67f1519b11802a.tar.gz
Stage 3 in cleaning win95 code ... cleanup headers
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1895511 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'misc')
-rw-r--r--misc/win32/start.c95
1 files changed, 44 insertions, 51 deletions
diff --git a/misc/win32/start.c b/misc/win32/start.c
index 1def000ae..c60a650fe 100644
--- a/misc/win32/start.c
+++ b/misc/win32/start.c
@@ -98,63 +98,56 @@ APR_DECLARE(apr_status_t) apr_app_initialize(int *argc,
const char * const * *argv,
const char * const * *env)
{
+ apr_wchar_t **wstrs;
+ apr_wchar_t *sysstr;
+ int wstrc;
+ int dupenv;
apr_status_t rv = apr_initialize();
if (rv != APR_SUCCESS) {
return rv;
}
-#if APR_HAS_UNICODE_FS
- IF_WIN_OS_IS_UNICODE
- {
- apr_wchar_t **wstrs;
- apr_wchar_t *sysstr;
- int wstrc;
- int dupenv;
-
- if (apr_app_init_complete) {
- return rv;
- }
-
- apr_app_init_complete = 1;
-
- sysstr = GetCommandLineW();
- if (sysstr) {
- wstrs = apr_winapi_CommandLineToArgvW(sysstr, &wstrc);
- if (wstrs) {
- *argc = apr_wastrtoastr(argv, wstrs, wstrc);
- LocalFree(wstrs);
- }
- }
-
- sysstr = GetEnvironmentStringsW();
- dupenv = warrsztoastr(&_environ, sysstr);
-
- if (env) {
- *env = apr_malloc_dbg((dupenv + 1) * sizeof (char *),
- __FILE__, __LINE__ );
- memcpy((void*)*env, _environ, (dupenv + 1) * sizeof (char *));
- }
- else {
- }
-
- FreeEnvironmentStringsW(sysstr);
-
- /* MSVCRT will attempt to maintain the wide environment calls
- * on _putenv(), which is bogus if we've passed a non-ascii
- * string to _putenv(), since they use MultiByteToWideChar
- * and breaking the implicit utf-8 assumption we've built.
- *
- * Reset _wenviron for good measure.
- */
- if (_wenviron) {
- apr_wchar_t **wenv = _wenviron;
- _wenviron = NULL;
- free(wenv);
- }
-
- }
-#endif
+ if (apr_app_init_complete) {
+ return rv;
+ }
+
+ apr_app_init_complete = 1;
+
+ sysstr = GetCommandLineW();
+ if (sysstr) {
+ wstrs = apr_winapi_CommandLineToArgvW(sysstr, &wstrc);
+ if (wstrs) {
+ *argc = apr_wastrtoastr(argv, wstrs, wstrc);
+ LocalFree(wstrs);
+ }
+ }
+
+ sysstr = GetEnvironmentStringsW();
+ dupenv = warrsztoastr(&_environ, sysstr);
+
+ if (env) {
+ *env = apr_malloc_dbg((dupenv + 1) * sizeof (char *),
+ __FILE__, __LINE__ );
+ memcpy((void*)*env, _environ, (dupenv + 1) * sizeof (char *));
+ }
+ else {
+ }
+
+ FreeEnvironmentStringsW(sysstr);
+
+ /* MSVCRT will attempt to maintain the wide environment calls
+ * on _putenv(), which is bogus if we've passed a non-ascii
+ * string to _putenv(), since they use MultiByteToWideChar
+ * and breaking the implicit utf-8 assumption we've built.
+ *
+ * Reset _wenviron for good measure.
+ */
+ if (_wenviron) {
+ apr_wchar_t **wenv = _wenviron;
+ _wenviron = NULL;
+ free(wenv);
+ }
return rv;
}