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
errno_error::try_code (int code)
{
if (code != 0)
if (__builtin_expect (code != 0, false))
throw errno_error(code);
}
@ -117,10 +117,8 @@ win32_error::try_code (void)
void
win32_error::try_code (DWORD id)
{
if (id == ERROR_SUCCESS)
return;
throw_code (id);
if (__builtin_expect (id != ERROR_SUCCESS, false))
throw_code (id);
}

View File

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