Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Tor Trac 34238]: Space out some function calls in parse_short_policy() #1896

Closed
wants to merge 1 commit into from

Conversation

Labels
None yet
Projects
None yet
3 participants
@neelchauhan
Copy link
Contributor

@neelchauhan neelchauhan commented May 17, 2020

Ticket: https://trac.torproject.org/projects/tor/ticket/34238

@coveralls
Copy link

@coveralls coveralls commented May 17, 2020

Pull Request Test Coverage Report for Build 8949

  • 4 of 4 (100.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.0005%) to 64.202%

Totals Coverage Status
Change from base Build 8936: 0.0005%
Covered Lines: 50933
Relevant Lines: 79333

💛 - Coveralls

@@ -2780,7 +2780,8 @@ parse_short_policy(const char *summary)
high = low;
break;
case '-':
high = (unsigned) tor_parse_ulong(next+1, 10, low, 65535, &ok, &next);
high = (unsigned)
tor_parse_ulong(next + 1, 10, low, 65535, &ok, &next);
Copy link
Member

@ahf ahf May 17, 2020

This looks odd to me. Unless we are low on horizontal space, then I see no need to do something like this. Getting rid of the space between (unsigned) and the function is fine IMO.

@@ -2817,12 +2818,13 @@ parse_short_policy(const char *summary)
sizeof(short_policy_entry_t)*(n_entries);
result = tor_malloc_zero(size);

tor_assert( (char*)&result->entries[n_entries-1] < ((char*)result)+size);
tor_assert((char *) &result->entries[n_entries - 1] <
((char *) result) + size);
Copy link
Member

@ahf ahf May 17, 2020

Same as above. This shouldn't be split on multiple lines, and I don't think we should have a space between the type-cast and the variables.

}

result->is_accept = is_accept;
result->n_entries = n_entries;
memcpy(result->entries, entries, sizeof(short_policy_entry_t)*n_entries);
memcpy(result->entries, entries, sizeof(short_policy_entry_t) * n_entries);
Copy link
Member

@ahf ahf May 17, 2020

Seems fine. This is the multiply operator and not a cast.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment