summaryrefslogtreecommitdiff
path: root/src/or
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2018-07-03 10:33:50 -0400
committerNick Mathewson <nickm@torproject.org>2018-07-03 10:33:50 -0400
commit52884f56d43670f1960d9354ccc3ace9a048e283 (patch)
tree298e3f789a003cc9f08e4f8e24bf93964711b60c /src/or
parentcf0b07c2e5284325fb89f2c8ee3ad99f5ed02195 (diff)
downloadtor-52884f56d43670f1960d9354ccc3ace9a048e283.tar.gz
tor-52884f56d43670f1960d9354ccc3ace9a048e283.zip
Replace U64_LITERAL with the standard UINT64_C
Diffstat (limited to 'src/or')
-rw-r--r--src/or/config.c4
-rw-r--r--src/or/config.h4
-rw-r--r--src/or/confparse.c18
-rw-r--r--src/or/dirauth/dirvote.c12
-rw-r--r--src/or/policies.c6
-rw-r--r--src/or/routerparse.c2
6 files changed, 23 insertions, 23 deletions
diff --git a/src/or/config.c b/src/or/config.c
index e3a4faa311..c958706f4c 100644
--- a/src/or/config.c
+++ b/src/or/config.c
@@ -4581,8 +4581,8 @@ compute_real_max_mem_in_queues(const uint64_t val, int log_guess)
uint64_t result;
if (val == 0) {
-#define ONE_GIGABYTE (U64_LITERAL(1) << 30)
-#define ONE_MEGABYTE (U64_LITERAL(1) << 20)
+#define ONE_GIGABYTE (UINT64_C(1) << 30)
+#define ONE_MEGABYTE (UINT64_C(1) << 20)
/* The user didn't pick a memory limit. Choose a very large one
* that is still smaller than the system memory */
static int notice_sent = 0;
diff --git a/src/or/config.h b/src/or/config.h
index d2faf6c512..75470a9c93 100644
--- a/src/or/config.h
+++ b/src/or/config.h
@@ -24,9 +24,9 @@
/** Maximum default value for MaxMemInQueues, in bytes. */
#if SIZEOF_VOID_P >= 8
-#define MAX_DEFAULT_MEMORY_QUEUE_SIZE (U64_LITERAL(8) << 30)
+#define MAX_DEFAULT_MEMORY_QUEUE_SIZE (UINT64_C(8) << 30)
#else
-#define MAX_DEFAULT_MEMORY_QUEUE_SIZE (U64_LITERAL(2) << 30)
+#define MAX_DEFAULT_MEMORY_QUEUE_SIZE (UINT64_C(2) << 30)
#endif
MOCK_DECL(const char*, get_dirportfrontpage, (void));
diff --git a/src/or/confparse.c b/src/or/confparse.c
index b38e06c6a2..c152fb171f 100644
--- a/src/or/confparse.c
+++ b/src/or/confparse.c
@@ -1040,15 +1040,15 @@ static struct unit_table_t memory_units[] = {
{ "gigabit", 1<<27 },
{ "gbits", 1<<27 },
{ "gbit", 1<<27 },
- { "tb", U64_LITERAL(1)<<40 },
- { "tbyte", U64_LITERAL(1)<<40 },
- { "tbytes", U64_LITERAL(1)<<40 },
- { "terabyte", U64_LITERAL(1)<<40 },
- { "terabytes", U64_LITERAL(1)<<40 },
- { "terabits", U64_LITERAL(1)<<37 },
- { "terabit", U64_LITERAL(1)<<37 },
- { "tbits", U64_LITERAL(1)<<37 },
- { "tbit", U64_LITERAL(1)<<37 },
+ { "tb", UINT64_C(1)<<40 },
+ { "tbyte", UINT64_C(1)<<40 },
+ { "tbytes", UINT64_C(1)<<40 },
+ { "terabyte", UINT64_C(1)<<40 },
+ { "terabytes", UINT64_C(1)<<40 },
+ { "terabits", UINT64_C(1)<<37 },
+ { "terabit", UINT64_C(1)<<37 },
+ { "tbits", UINT64_C(1)<<37 },
+ { "tbit", UINT64_C(1)<<37 },
{ NULL, 0 },
};
diff --git a/src/or/dirauth/dirvote.c b/src/or/dirauth/dirvote.c
index 85a0d3e707..47d1ee44a2 100644
--- a/src/or/dirauth/dirvote.c
+++ b/src/or/dirauth/dirvote.c
@@ -1756,9 +1756,9 @@ networkstatus_compute_consensus(smartlist_t *votes,
/* Build the flag indexes. Note that no vote can have more than 64 members
* for known_flags, so no value will be greater than 63, so it's safe to
- * do U64_LITERAL(1) << index on these values. But note also that
+ * do UINT64_C(1) << index on these values. But note also that
* named_flag and unnamed_flag are initialized to -1, so we need to check
- * that they're actually set before doing U64_LITERAL(1) << index with
+ * that they're actually set before doing UINT64_C(1) << index with
* them.*/
SMARTLIST_FOREACH_BEGIN(votes, networkstatus_t *, v) {
flag_map[v_sl_idx] = tor_calloc(smartlist_len(v->known_flags),
@@ -1787,7 +1787,7 @@ networkstatus_compute_consensus(smartlist_t *votes,
uint64_t nf;
if (named_flag[v_sl_idx]<0)
continue;
- nf = U64_LITERAL(1) << named_flag[v_sl_idx];
+ nf = UINT64_C(1) << named_flag[v_sl_idx];
SMARTLIST_FOREACH_BEGIN(v->routerstatus_list,
vote_routerstatus_t *, rs) {
@@ -1812,7 +1812,7 @@ networkstatus_compute_consensus(smartlist_t *votes,
uint64_t uf;
if (unnamed_flag[v_sl_idx]<0)
continue;
- uf = U64_LITERAL(1) << unnamed_flag[v_sl_idx];
+ uf = UINT64_C(1) << unnamed_flag[v_sl_idx];
SMARTLIST_FOREACH_BEGIN(v->routerstatus_list,
vote_routerstatus_t *, rs) {
if ((rs->flags & uf) != 0) {
@@ -1902,11 +1902,11 @@ networkstatus_compute_consensus(smartlist_t *votes,
/* Tally up all the flags. */
for (int flag = 0; flag < n_voter_flags[voter_idx]; ++flag) {
- if (rs->flags & (U64_LITERAL(1) << flag))
+ if (rs->flags & (UINT64_C(1) << flag))
++flag_counts[flag_map[voter_idx][flag]];
}
if (named_flag[voter_idx] >= 0 &&
- (rs->flags & (U64_LITERAL(1) << named_flag[voter_idx]))) {
+ (rs->flags & (UINT64_C(1) << named_flag[voter_idx]))) {
if (chosen_name && strcmp(chosen_name, rs->status.nickname)) {
log_notice(LD_DIR, "Conflict on naming for router: %s vs %s",
chosen_name, rs->status.nickname);
diff --git a/src/or/policies.c b/src/or/policies.c
index 0f52d6bf15..ee1f3afe62 100644
--- a/src/or/policies.c
+++ b/src/or/policies.c
@@ -2408,7 +2408,7 @@ policy_summary_item_split(policy_summary_item_t* old, uint16_t new_starts)
#define REJECT_CUTOFF_SCALE_IPV4 (0)
/* Ports are rejected in an IPv4 summary if they are rejected in more than two
* IPv4 /8 address blocks */
-#define REJECT_CUTOFF_COUNT_IPV4 (U64_LITERAL(1) << \
+#define REJECT_CUTOFF_COUNT_IPV4 (UINT64_C(1) << \
(IPV4_BITS - REJECT_CUTOFF_SCALE_IPV4 - 7))
#define IPV6_BITS (128)
@@ -2420,7 +2420,7 @@ policy_summary_item_split(policy_summary_item_t* old, uint16_t new_starts)
* some scattered smaller blocks) have been allocated to the RIRs.
* Network providers are typically allocated one or more IPv6 /32s.
*/
-#define REJECT_CUTOFF_COUNT_IPV6 (U64_LITERAL(1) << \
+#define REJECT_CUTOFF_COUNT_IPV6 (UINT64_C(1) << \
(IPV6_BITS - REJECT_CUTOFF_SCALE_IPV6 - 16))
/** Split an exit policy summary so that prt_min and prt_max
@@ -2515,7 +2515,7 @@ policy_summary_reject(smartlist_t *summary,
* in the range. */
count = UINT64_MAX;
} else {
- count = (U64_LITERAL(1) << (addrbits - scale - maskbits));
+ count = (UINT64_C(1) << (addrbits - scale - maskbits));
}
tor_assert_nonfatal_once(count > 0);
while (i < smartlist_len(summary) &&
diff --git a/src/or/routerparse.c b/src/or/routerparse.c
index dfc298286b..9f3072bc32 100644
--- a/src/or/routerparse.c
+++ b/src/or/routerparse.c
@@ -2724,7 +2724,7 @@ routerstatus_parse_entry_from_string(memarea_t *area,
for (i=0; i < tok->n_args; ++i) {
int p = smartlist_string_pos(vote->known_flags, tok->args[i]);
if (p >= 0) {
- vote_rs->flags |= (U64_LITERAL(1)<<p);
+ vote_rs->flags |= (UINT64_C(1)<<p);
} else {
log_warn(LD_DIR, "Flags line had a flag %s not listed in known_flags.",
escaped(tok->args[i]));