aboutsummaryrefslogtreecommitdiff
path: root/src/feature/dirparse/microdesc_parse.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2019-09-19 13:59:37 -0400
committerNick Mathewson <nickm@torproject.org>2019-09-19 14:37:24 -0400
commitc309169217eace3eaee84f3dc16347234929e4b3 (patch)
tree5bfe712faa32b7aaa8940b98633d67a6f362f167 /src/feature/dirparse/microdesc_parse.c
parent6100378c29072dda5264d9e88993133f484df168 (diff)
downloadtor-c309169217eace3eaee84f3dc16347234929e4b3.tar.gz
tor-c309169217eace3eaee84f3dc16347234929e4b3.zip
microdesc_parse: convert some ints to bools
Noted by ahf during review of #31675
Diffstat (limited to 'src/feature/dirparse/microdesc_parse.c')
-rw-r--r--src/feature/dirparse/microdesc_parse.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/feature/dirparse/microdesc_parse.c b/src/feature/dirparse/microdesc_parse.c
index 96a3454268..4bb4db7821 100644
--- a/src/feature/dirparse/microdesc_parse.c
+++ b/src/feature/dirparse/microdesc_parse.c
@@ -140,11 +140,11 @@ microdesc_extract_body(microdesc_t *md,
const char *s, const char *start_of_next_microdesc,
saved_location_t where)
{
- const int copy_body = (where != SAVED_IN_CACHE);
+ const bool copy_body = (where != SAVED_IN_CACHE);
const char *cp = tor_memstr(s, start_of_next_microdesc-s, "onion-key");
- const int no_onion_key = (cp == NULL);
+ const bool no_onion_key = (cp == NULL);
if (no_onion_key) {
cp = s; /* So that we have *some* junk to put in the body */
}
@@ -307,7 +307,7 @@ microdescs_parse_from_string(const char *s, const char *eos,
result = smartlist_new();
while (s < eos) {
- int okay = 0;
+ bool okay = false;
start_of_next_microdesc = find_start_of_next_microdesc(s, eos);
if (!start_of_next_microdesc)
@@ -316,9 +316,10 @@ microdescs_parse_from_string(const char *s, const char *eos,
md = tor_malloc_zero(sizeof(microdesc_t));
uint8_t md_digest[DIGEST256_LEN];
{
- int body_not_found = microdesc_extract_body(md, start, s,
- start_of_next_microdesc,
- where) < 0;
+ const bool body_not_found =
+ microdesc_extract_body(md, start, s,
+ start_of_next_microdesc,
+ where) < 0;
memcpy(md_digest, md->digest, DIGEST256_LEN);
if (body_not_found) {
@@ -331,7 +332,7 @@ microdescs_parse_from_string(const char *s, const char *eos,
allow_annotations, where) == 0) {
smartlist_add(result, md);
md = NULL; // prevent free
- okay = 1;
+ okay = true;
}
next: