summaryrefslogtreecommitdiff
path: root/accel-pppd/lua/session.c
diff options
context:
space:
mode:
authorxebd <xeb@mail.ru>2018-03-04 08:29:27 +0300
committerGitHub <noreply@github.com>2018-03-04 08:29:27 +0300
commit746438111a78e9a88b604eeac71bdbc62ff29ab7 (patch)
tree9b7d0fdc157a59a0b241320ef3b5ace597d23aea /accel-pppd/lua/session.c
parent5ccf2f0409c18e216c4da5c7cce5e9fcf14ebf54 (diff)
parentca152efa0c0b1a3a2cecfcdc0a72959e670b9f45 (diff)
downloadaccel-ppp-746438111a78e9a88b604eeac71bdbc62ff29ab7.tar.gz
accel-ppp-746438111a78e9a88b604eeac71bdbc62ff29ab7.zip
Merge pull request #45 from themiron/cppcheck-fixes
cppcheck fixes
Diffstat (limited to 'accel-pppd/lua/session.c')
-rw-r--r--accel-pppd/lua/session.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/accel-pppd/lua/session.c b/accel-pppd/lua/session.c
index d65a67b..277b299 100644
--- a/accel-pppd/lua/session.c
+++ b/accel-pppd/lua/session.c
@@ -217,11 +217,12 @@ static int session_rx_bytes(lua_State *L)
{
struct ap_session *ses = luaL_checkudata(L, 1, LUA_AP_SESSION);
uint64_t gword_sz = (uint64_t)UINT32_MAX + 1;
- uint64_t bytes = gword_sz*ses->acct_input_gigawords + ses->acct_rx_bytes;
+ uint64_t bytes;
if (!ses)
return 0;
+ bytes = gword_sz*ses->acct_input_gigawords + ses->acct_rx_bytes;
lua_pushnumber(L, bytes);
return 1;
@@ -231,11 +232,12 @@ static int session_tx_bytes(lua_State *L)
{
struct ap_session *ses = luaL_checkudata(L, 1, LUA_AP_SESSION);
uint64_t gword_sz = (uint64_t)UINT32_MAX + 1;
- uint64_t bytes = gword_sz*ses->acct_output_gigawords + ses->acct_tx_bytes;
+ uint64_t bytes;
if (!ses)
return 0;
+ bytes = gword_sz*ses->acct_output_gigawords + ses->acct_tx_bytes;
lua_pushnumber(L, bytes);
return 1;