[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [tor-bugs] #24337 [Core Tor/Tor]: Every _free() function should be a macro that sets the corresponding pointer to NULL.
#24337: Every _free() function should be a macro that sets the corresponding
pointer to NULL.
-----------------------------+------------------------------------
Reporter: nickm | Owner: nickm
Type: enhancement | Status: needs_review
Priority: Medium | Milestone: Tor: 0.3.3.x-final
Component: Core Tor/Tor | Version:
Severity: Normal | Resolution:
Keywords: review-group-26 | Actual Points:
Parent ID: | Points:
Reviewer: | Sponsor: Sponsor8-can
-----------------------------+------------------------------------
Comment (by nickm):
So, I had originally left all these macros in lowercase, until someone
(Taylor, I think?) asked me "so, what problems have we run into with
`tor_free()` so far?" And the biggest problems I could think of is that
people are confused because `tor_free()` does not actually behave like a
function.
In C, if you call `foo(ptr)`, and foo is a function, then the value of
`ptr` cannot change. But `tor_free(ptr)` does change the value of `ptr`
to NULL, which is something that tor_free() could not do if it were a
function. New developers on Tor often don't expect this to happen.
That said, it is usually a pretty short learning curve, so it might be
okay to leave everything as it is.
--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/24337#comment:8>
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