except: add expect conditions for try_code

This commit is contained in:
Danny Robson 2015-09-09 18:39:36 +10:00
parent 9445b29bd3
commit 07885819e3
2 changed files with 5 additions and 9 deletions

View File

@ -60,7 +60,7 @@ errno_error::try_code (void)
void void
errno_error::try_code (int code) errno_error::try_code (int code)
{ {
if (code != 0) if (__builtin_expect (code != 0, false))
throw errno_error(code); throw errno_error(code);
} }
@ -117,9 +117,7 @@ win32_error::try_code (void)
void void
win32_error::try_code (DWORD id) win32_error::try_code (DWORD id)
{ {
if (id == ERROR_SUCCESS) if (__builtin_expect (id != ERROR_SUCCESS, false))
return;
throw_code (id); throw_code (id);
} }

View File

@ -89,9 +89,7 @@ net::error::throw_code (void)
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void void
net::error::try_code (int err) { net::error::try_code (int err) {
if (err == 0) if (__builtin_expect (err != 0, false))
return;
throw_code (err); throw_code (err);
} }