[tor-bugs] #30914 [Core Tor/Tor]: Move struct manipulation code out of confparse.c

Tor Bug Tracker & Wiki blackhole at torproject.org
Tue Jun 25 17:13:41 UTC 2019


#30914: Move struct manipulation code out of confparse.c
--------------------------+------------------------------------
 Reporter:  nickm         |          Owner:  nickm
     Type:  defect        |         Status:  needs_review
 Priority:  Medium        |      Milestone:  Tor: 0.4.2.x-final
Component:  Core Tor/Tor  |        Version:
 Severity:  Normal        |     Resolution:
 Keywords:                |  Actual Points:  1
Parent ID:  #29211        |         Points:  1
 Reviewer:  catalyst      |        Sponsor:  Sponsor31-can
--------------------------+------------------------------------

Comment (by nickm):

 >      Partially port routerset to being a full-fledged config type again.

 This patch introduces a new "routerset_type_defn" type definition for use
 with typed_var_t, and uses it in confparse.c.  (Recall that routerset_t is
 not implemented in type_defs.c because it is defined in a higher-level
 module.)  The type is still treated as a special case in the confparse.c,
 but that will get fixed in a later commit.

 >      Add new "struct_var_" functions to manipulate struct fields.

 This is the main new abstraction of this branch.  It adds a wrapper around
 typed_var_* to work with fields within structures, rather than general
 pointers.  This new type is struct_var_t -- it can describe the type of a
 member either as a config_type_t enum, or as a var_type_def_t pointer.

 >      Port confparse to use struct_var in place of typed_var.

 This commit changes the relevant elements of config_var_t to use
 struct_var_t in place of a raw (type,offset) pair, and changes the rest of
 confparse.c to act accordingly.

 >      Use struct_magic_decl to verify magic numbers in config objects
 >      Use struct_var_{copy,eq} in confparse.c.
 >      Use structvar to find the types for config vars.

 The above three commits port confparse.c and config.c to use struct_var_t
 in more places.

 >      Add a function to make sure all values in a config object are ok
 >      A few more test cases and unreachable lines

 This improves test coverage, and exercises the new function introduced
 previously.

 >      changes file for ticket 30914

--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/30914#comment:3>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online


More information about the tor-bugs mailing list