mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-24 12:23:32 +01:00
microdesc_parse: convert some ints to bools
Noted by ahf during review of #31675
This commit is contained in:
parent
6100378c29
commit
c309169217
@ -140,11 +140,11 @@ microdesc_extract_body(microdesc_t *md,
|
|||||||
const char *s, const char *start_of_next_microdesc,
|
const char *s, const char *start_of_next_microdesc,
|
||||||
saved_location_t where)
|
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 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) {
|
if (no_onion_key) {
|
||||||
cp = s; /* So that we have *some* junk to put in the body */
|
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();
|
result = smartlist_new();
|
||||||
|
|
||||||
while (s < eos) {
|
while (s < eos) {
|
||||||
int okay = 0;
|
bool okay = false;
|
||||||
|
|
||||||
start_of_next_microdesc = find_start_of_next_microdesc(s, eos);
|
start_of_next_microdesc = find_start_of_next_microdesc(s, eos);
|
||||||
if (!start_of_next_microdesc)
|
if (!start_of_next_microdesc)
|
||||||
@ -316,7 +316,8 @@ microdescs_parse_from_string(const char *s, const char *eos,
|
|||||||
md = tor_malloc_zero(sizeof(microdesc_t));
|
md = tor_malloc_zero(sizeof(microdesc_t));
|
||||||
uint8_t md_digest[DIGEST256_LEN];
|
uint8_t md_digest[DIGEST256_LEN];
|
||||||
{
|
{
|
||||||
int body_not_found = microdesc_extract_body(md, start, s,
|
const bool body_not_found =
|
||||||
|
microdesc_extract_body(md, start, s,
|
||||||
start_of_next_microdesc,
|
start_of_next_microdesc,
|
||||||
where) < 0;
|
where) < 0;
|
||||||
|
|
||||||
@ -331,7 +332,7 @@ microdescs_parse_from_string(const char *s, const char *eos,
|
|||||||
allow_annotations, where) == 0) {
|
allow_annotations, where) == 0) {
|
||||||
smartlist_add(result, md);
|
smartlist_add(result, md);
|
||||||
md = NULL; // prevent free
|
md = NULL; // prevent free
|
||||||
okay = 1;
|
okay = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
next:
|
next:
|
||||||
|
Loading…
Reference in New Issue
Block a user