1
0
mirror of https://github.com/facebook/proxygen.git synced 2025-08-08 18:02:05 +03:00

Enable CLANGFORMAT

Reviewed By: zertosh

Differential Revision: D31753624

fbshipit-source-id: cebadddc83af19739a0ada00cb4bbfde0d640213
This commit is contained in:
Shashank Chaudhry
2021-10-19 14:33:50 -07:00
committed by Facebook GitHub Bot
parent 67b0716b5b
commit 72e642be7d

View File

@@ -3,8 +3,8 @@
#define WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN
#include <Windows.h> #include <Windows.h>
#include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h>
#define PATH_SIZE 32768 #define PATH_SIZE 32768
@@ -18,19 +18,27 @@ void add_search_path(const wchar_t* path) {
wchar_t** lppPart = NULL; wchar_t** lppPart = NULL;
if (!GetFullPathNameW(path, PATH_SIZE, buffer, lppPart)) { if (!GetFullPathNameW(path, PATH_SIZE, buffer, lppPart)) {
fwprintf(stderr, L"warning: %d unable to expand path %s\n", GetLastError(), path); fwprintf(
stderr,
L"warning: %d unable to expand path %s\n",
GetLastError(),
path);
return; return;
} }
if (!AddDllDirectory(buffer)) { if (!AddDllDirectory(buffer)) {
DWORD error = GetLastError(); DWORD error = GetLastError();
if (error != ERROR_FILE_NOT_FOUND) { if (error != ERROR_FILE_NOT_FOUND) {
fwprintf(stderr, L"warning: %d unable to set DLL search path for %s\n", GetLastError(), path); fwprintf(
stderr,
L"warning: %d unable to set DLL search path for %s\n",
GetLastError(),
path);
} }
} }
} }
int locate_py_main(int argc, wchar_t **argv) { int locate_py_main(int argc, wchar_t** argv) {
/* /*
* We have to dynamically locate Python3.dll because we may be loading a * We have to dynamically locate Python3.dll because we may be loading a
* Python native module while running. If that module is built with a * Python native module while running. If that module is built with a
@@ -48,11 +56,12 @@ int locate_py_main(int argc, wchar_t **argv) {
add_search_path(L"C:\\Python37\\"); add_search_path(L"C:\\Python37\\");
add_search_path(L"C:\\Python38\\"); add_search_path(L"C:\\Python38\\");
python_dll = LoadLibraryExW(L"python3.dll", NULL, LOAD_LIBRARY_SEARCH_DEFAULT_DIRS); python_dll =
LoadLibraryExW(L"python3.dll", NULL, LOAD_LIBRARY_SEARCH_DEFAULT_DIRS);
int returncode = 0; int returncode = 0;
if (python_dll != NULL) { if (python_dll != NULL) {
pymain = (Py_Main) GetProcAddress(python_dll, "Py_Main"); pymain = (Py_Main)GetProcAddress(python_dll, "Py_Main");
if (pymain != NULL) { if (pymain != NULL) {
returncode = (pymain)(argc, argv); returncode = (pymain)(argc, argv);