diff options
author | Nick Mathewson <nickm@torproject.org> | 2014-09-23 08:46:35 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2014-09-29 09:05:11 -0400 |
commit | 4903ab1caaf0b2631e6091b58b31eaff0c9f8424 (patch) | |
tree | bfd51b9ea637076a90f331e02c2367a18ee23ac2 /src/or/status.c | |
parent | 8527a2996675d9502551ccdd4224036a45aae47b (diff) | |
download | tor-4903ab1caaf0b2631e6091b58b31eaff0c9f8424.tar.gz tor-4903ab1caaf0b2631e6091b58b31eaff0c9f8424.zip |
Avoid frequent strcmp() calls for AccountingRule
Generally, we don't like to parse the same thing over and over; it's
best IMO to do it once at the start of the code.
Diffstat (limited to 'src/or/status.c')
-rw-r--r-- | src/or/status.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/src/or/status.c b/src/or/status.c index 4158df5ad5..daae1d71c6 100644 --- a/src/or/status.c +++ b/src/or/status.c @@ -145,13 +145,12 @@ log_accounting(const time_t now, const or_options_t *options) or_state_t *state = get_or_state(); char *acc_rcvd = bytes_to_usage(state->AccountingBytesReadInInterval); char *acc_sent = bytes_to_usage(state->AccountingBytesWrittenInInterval); - const char *acc_rule = options->AccountingRule; uint64_t acc_bytes = options->AccountingMax; char *acc_max; time_t interval_end = accounting_get_end_time(); char end_buf[ISO_TIME_LEN + 1]; char *remaining = NULL; - if (strcmp(acc_rule, "sum") == 0) + if (options->AccountingRule == ACCT_SUM) acc_bytes *= 2; acc_max = bytes_to_usage(acc_bytes); format_local_iso_time(end_buf, interval_end); |