[tor-bugs] #17794 [Tor]: Decrease casting in rendcache functions

Tor Bug Tracker & Wiki blackhole at torproject.org
Wed Dec 9 13:03:09 UTC 2015


#17794: Decrease casting in rendcache functions
-----------------------------+------------------------------
     Reporter:  cypherpunks  |      Owner:
         Type:  defect       |     Status:  new
     Priority:  Low          |  Milestone:
    Component:  Tor          |    Version:  Tor: unspecified
     Severity:  Minor        |   Keywords:
Actual Points:               |  Parent ID:
       Points:               |    Sponsor:
-----------------------------+------------------------------
 During work on #17776 i have identified three functions which could, with
 a type signature change, save some casting throughout the Tor code base.
 These functions are

 {{{
 void rend_cache_intro_failure_note(rend_intro_point_failure_t failure,
                                    const uint8_t *identity,
                                    const char *service_id);
 STATIC int cache_failure_intro_lookup(const uint8_t *identity,
                                       const char *service_id,
                                       rend_cache_failure_intro_t
                                       **intro_entry);
 STATIC void cache_failure_intro_add(const uint8_t *identity,
                                     const char *service_id,
                                     rend_intro_point_failure_t failure);
 }}}

 The identity pointers to uint8_t are internally cast to pointers to char
 for further processing. Meanwhile the callers of these functions cast the
 identity pointer from pointer to char to pointer to uint8_t to conform to
 its type signature.

 Changing the type of the identity pointer from uint8_t to char would
 remove the need for casting back and forth.

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


More information about the tor-bugs mailing list