[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [tor-bugs] #30935 [Core Tor/Tor]: Move variable definition code out of confparse.c, and refactor



#30935: Move variable definition code out of confparse.c, and refactor
--------------------------+------------------------------------
 Reporter:  nickm         |          Owner:  nickm
     Type:  enhancement   |         Status:  needs_review
 Priority:  Medium        |      Milestone:  Tor: 0.4.2.x-final
Component:  Core Tor/Tor  |        Version:
 Severity:  Normal        |     Resolution:
 Keywords:                |  Actual Points:  0.5
Parent ID:  #29211        |         Points:  1
 Reviewer:  catalyst      |        Sponsor:  Sponsor31-can
--------------------------+------------------------------------

Comment (by nickm):

 Here's an overview of the commits in this branch.

 >      Move config_var_t info conftypes.h

 Pure code movement.

 >      Move responsibility for config var macros

 Refactors the macros that we have used to create config_var_t, and reduces
 code duplication.

 Previously the macros used to define variables were redefined in every
 module that needed them; now they are derived from a common source.  This
 makes them easier to change and refactor.

 This commit also moves code only used for test builds into a new
 "conftesting.h" header.

 >      Add a "flags" member to config_var_t

 Add an (unused) flags member, and makes corresponding adjustments to the
 macros.

 >      Extend macros to allow flag arguments.

 Add a flags argument to the variable-definition macros.

 >      Turn several properties of types or variables into flags.
 >      Make "invisibility" and "undumpability" properties of variables.

 These two commits are the bigger refactorings of this branch: they remove
 all the places in config or confparse that had previously tried to do
 manual inspection of a variable's type or names.  To follow OO principles,
 we should turn these checks and inspections into properties of the types
 or variables themselves.

 >      Refactor handling of TestingTorNetwork

 The TestingTorNetwork option overrides the defaults for a bunch of other
 options.  Its previous implementation was a nasty kludge that included a
 bunch of duplicated code, and involved overwriting the "initval" field of
 a bunch of config_var_t objects.

 This new implementation should be much cleaner and easier to understand.
 It works by modifying the initially constructed or_options_t object
 whenever any code ask for an "initialized to defaults" object.

 >      Make config_var and config_fmt const.

 Thanks to the previous commit, we can now make more object const -- and
 should.

 >      Move confparse.ch into lib/confmgt.

 Code movement and header renaming.  Once we moved the responsibility for
 handling routerset_t out of confparse.c, we no longer need confparse.c to
 be at a higher level than src/core.  This patch lowers it.

--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/30935#comment:4>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online
_______________________________________________
tor-bugs mailing list
tor-bugs@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-bugs