Skip to content

Commit 25ca0a0

Browse files
committed
[mU] API_CALL更名为OS_API_CALL,意义更明确些
1 parent 4eef2c6 commit 25ca0a0

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

Include/mU/Exceptions.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,17 +86,17 @@ namespace mU
8686
};
8787

8888
#ifdef _WIN32
89-
#define API_CALL(api_func, ...) \
89+
#define OS_API_CALL(api_func, ...) \
9090
if (!api_func(__VA_ARGS__)) \
9191
throw SystemError();
92-
#define API_CALL_R(r, api_func, ...) \
92+
#define OS_API_CALL_R(r, api_func, ...) \
9393
if (!(r = api_func(__VA_ARGS__))) \
9494
throw SystemError();
9595
#else
96-
#define API_CALL(api_func, ...) \
96+
#define OS_API_CALL(api_func, ...) \
9797
if (api_func(__VA_ARGS__) == -1) \
9898
throw SystemError();
99-
#define API_CALL_R(r, api_func, ...) \
99+
#define OS_API_CALL_R(r, api_func, ...) \
100100
if ((r = api_func(__VA_ARGS__)) == -1) \
101101
throw SystemError();
102102
#endif

Kernel/path.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,23 +18,23 @@ struct cmodule_t : obj_t
1818
wstring Path() // FIXME: behavior change, now may throw, check callers
1919
{
2020
static wchar buf[MAX_PATH];
21-
API_CALL(GetModuleFileNameW,NULL,buf,MAX_PATH);
21+
OS_API_CALL(GetModuleFileNameW,NULL,buf,MAX_PATH);
2222
wcsrchr(buf,L'\\')[1] = 0;
2323
return buf; // TODO: cache this result
2424
}
2525

2626
var Install(const wstring &x) // FIXME: behavior change, now may throw, check callers
2727
{
2828
auto_ptr<cmodule_t> r (new cmodule_t);
29-
API_CALL_R(r->rep, LoadLibraryW, x.c_str());
29+
OS_API_CALL_R(r->rep, LoadLibraryW, x.c_str());
3030
if(r->rep) return r.release();
3131
return 0;
3232
}
3333

3434
bool Uninstall(Var x) // FIXME: behavior change, now may throw, check callers
3535
{
3636
BOOL r;
37-
API_CALL_R(r,FreeLibrary,dynamic_cast<cmodule_t*>(x)->rep);
37+
OS_API_CALL_R(r,FreeLibrary,dynamic_cast<cmodule_t*>(x)->rep);
3838
return r == TRUE;
3939
}
4040

@@ -48,7 +48,7 @@ bool Run(const wstring &x) // FIXME: behavior change, now may throw, check call
4848
ZeroMemory( &pi, sizeof(pi) );
4949

5050
// Start the child process.
51-
API_CALL(CreateProcessW,
51+
OS_API_CALL(CreateProcessW,
5252
NULL, // No module name (use command line)
5353
// FIXME: 应该创建一个长为32768的buffer来转储,而不是使用const_cast
5454
const_cast<wchar*>(x.c_str()), // Command line
@@ -63,11 +63,11 @@ bool Run(const wstring &x) // FIXME: behavior change, now may throw, check call
6363
);
6464

6565
// Wait until child process exits.
66-
API_CALL(WaitForSingleObject, pi.hProcess, INFINITE );
66+
OS_API_CALL(WaitForSingleObject, pi.hProcess, INFINITE );
6767

6868
// Close process and thread handles.
69-
API_CALL(CloseHandle, pi.hProcess );
70-
API_CALL(CloseHandle, pi.hThread );
69+
OS_API_CALL(CloseHandle, pi.hProcess );
70+
OS_API_CALL(CloseHandle, pi.hThread );
7171
return true;
7272
}
7373

0 commit comments

Comments
 (0)