[tor-bugs] #3876 [Tor Relay]: Simplify format_win_commandline_argument() implementation.
Tor Bug Tracker & Wiki
torproject-admin at torproject.org
Wed Aug 31 00:27:03 UTC 2011
#3876: Simplify format_win_commandline_argument() implementation.
-----------------------+----------------------------------------------------
Reporter: nickm | Owner: sjmurdoch
Type: defect | Status: new
Priority: normal | Milestone: Tor: 0.2.3.x-final
Component: Tor Relay | Version:
Keywords: | Parent:
Points: | Actualpoints:
-----------------------+----------------------------------------------------
In format_win_commandline_argument(), it would be neat to skip the
business of building a smartlist of char*, and just pre-allocate a
guaranteed-to-be-long-enough string -- I think that strlen(arg)*2 + 3
would be long enough, since each character in the input turns into at most
2 characters in the output, and there are at most 3 characters of
overhead: 1 for the nul-terminator, 2 for quotes.
This would actually use less RAM, since it only needs to allocate ~2 bytes
per character, as opposed to 4 or 8 bytes per char*. Not that it matters
-- we don't allocate a lot of these.
--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/3876>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online
More information about the tor-bugs
mailing list