Skip to content

Commit

Permalink
Reduce the number of __WINDOWS__ preprocessor checks
Browse files Browse the repository at this point in the history
No real changes, just repeat the loop line to separate non-Windows code
more clearly from the rest.
  • Loading branch information
vadz committed Nov 29, 2023
1 parent d4484c4 commit 1d13433
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/common/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -216,12 +216,18 @@ void wxInitData::InitIfNecessary(int argcIn, wchar_t** argvIn)
return;
}

argc = argcIn;

// For simplicity, make a copy of the arguments, even though we could avoid
// it -- but this would complicate the cleanup.
argc = argcIn;
argv = new wchar_t*[argc + 1];
argv[argc] = nullptr;

for ( int i = 0; i < argc; i++ )
{
argv[i] = wxCRT_StrdupW(argvIn[i]);
}

#ifdef __WINDOWS__
// Not used in this case and shouldn't be passed to LocalFree().
argvMSW = nullptr;
Expand All @@ -231,16 +237,12 @@ void wxInitData::InitIfNecessary(int argcIn, wchar_t** argvIn)
argvA[argc] = nullptr;

ownsArgvA = true;
#endif // __WINDOWS__/!__WINDOWS__

for ( int i = 0; i < argc; i++ )
{
argv[i] = wxCRT_StrdupW(argvIn[i]);

#ifndef __WINDOWS__
argvA[i] = wxStrdup(wxConvUTF8.cWC2MB(argv[i]));
#endif // !__WINDOWS__
}
#endif // __WINDOWS__/!__WINDOWS__
}

void wxInitData::Free()
Expand Down

0 comments on commit 1d13433

Please sign in to comment.