Should there be an ability to drop a specific guard?
Right now, if you call this command with arguments, they all get ignored. That can't be right.
The loop is strangely structured, given that "i" is never incremented. Perhaps it would make more sense to do while (smartlist_len(entryguards) { entryguard = smartlist_get(entryguards, 0); ... }?
Remember that in C, "void fn()" is a function that takes an unspecified number of arguments. If you need to write a function that takes no arguments, you have to say "void fn(void)".
Every function should be documented.
Perhaps we should explain briefly what the intended use case of this command is.
Trac: Keywords: N/Adeleted, tor-client guards controller added Status: new to needs_revision Milestone: N/Ato Tor: 0.2.5.x-final
Right now, if you call this command with arguments, they all get ignored. That can't be right.
The loop is strangely structured, given that "i" is never incremented. Perhaps it would make more sense to do while (smartlist_len(entryguards) { entryguard = smartlist_get(entryguards, 0); ... }?
Remember that in C, "void fn()" is a function that takes an unspecified number of arguments. If you need to write a function that takes no arguments, you have to say "void fn(void)".
I will rewrite and resubmit the patch.
Every function should be documented.
I though that documenting "remove_all_entry_guards" is superfluous but I will add a short documentation to it.
Perhaps we should explain briefly what the intended use case of this command is.
Almost: that one is doing a string length comparison, so it will reject the command if there's space after it which probably isn't what we wanted. (Other commands allow additional space.)
I'll see if it's easy to just tweak that up and merge it.
The smartlist solution seems cleaner than the string length comparison. I tried but couldn't figure how to do it in a short time. Anyways, the branch looks perfectly fine to me.
I also renamed the command to DROPGUARDS, since "dump" in programmerese can mean either "discard" or "print".
Ack.
Please let me know if you like this version of the patch, and whether I should credit the patch to "ra" or to some longer name.