Closed
Bug 163696
Opened 23 years ago
Closed 23 years ago
rename PR_FREEIF to PR_DELETEIF
Categories
(NSPR :: NSPR, defect)
Tracking
(Not tracked)
RESOLVED
WONTFIX
Future
People
(Reporter: timeless, Assigned: wtc)
References
()
Details
i know bug 39110 won't be fixed before nspr5, but i'd like to propose renaming
PR_FREEIF to PR_DELETEIF. At the very least, this bug will serve as a human
readable explanation of why PR_FREEIF(foo) isn't if (foo) PR_Free(foo) and
therefore how it can be slightly more expensive. I've actually run into a bunch
of places where PR_FREEIF is being used on local variables right before a return
(where it really doesn't make sense to null out the variable).
NSPR_API(void) PR_Free(void *ptr);
#define PR_DELETE(_ptr) { PR_Free(_ptr); (_ptr) = NULL; }
#define PR_FREEIF(_ptr) if (_ptr) PR_DELETE(_ptr)
in the interim, people who just need to see if a variable is non null before
freeing it should use |if (foo) PR_Free(foo);|
Assignee | ||
Comment 1•23 years ago
|
||
We can't rename a macro in NSPR 4.x. What we can
do is to add the PR_DELETEIF macro. But the benefit
is small and having both PR_FREEIF and PR_DELETEIF
is confusing.
Therefore I am marking this bug WONTFIX.
Status: NEW → RESOLVED
Closed: 23 years ago
Resolution: --- → WONTFIX
Target Milestone: --- → Future
You need to log in
before you can comment on or make changes to this bug.
Description
•