Closed
Bug 1245673
Opened 10 years ago
Closed 10 years ago
Remove useless NS_INT32_TO_PTR from nsTraceRefCnt
Categories
(Core :: XPCOM, defect)
Core
XPCOM
Tracking
()
RESOLVED
FIXED
mozilla47
| Tracking | Status | |
|---|---|---|
| firefox47 | --- | fixed |
People
(Reporter: mccr8, Assigned: mccr8)
Details
Attachments
(1 file)
|
1.30 KB,
patch
|
froydnj
:
review+
|
Details | Diff | Splinter Review |
DumpSerialNumbers contains this code:
fprintf(outputFile, "%" PRIdPTR
" @%p (%d references)\n",
record->serialNumber,
NS_INT32_TO_PTR(aHashEntry->key),
record->refCount);
aHashEntry is a PLHashEntry, so key has type |const void*|.
The key is set in this line:
PL_HashTableRawAdd(gSerialNumbers, hep, HashNumber(aPtr),
aPtr, static_cast<void*>(record));
The key is |aPtr|, which has type |void*|. Thus the NS_INT32_TO_PTR() call is unnecessary. It converts from void* to intptr_t to void*.
| Assignee | ||
Comment 1•10 years ago
|
||
I did some light local testing and it seems okay. I didn't test the dynamic casting part but whatever.
Attachment #8715546 -
Flags: review?(nfroyd)
Comment 2•10 years ago
|
||
NS_INT32_TO_PTR should be strongly typed (at least when using C++) to avoid similar problems in the future...
Comment 3•10 years ago
|
||
Comment on attachment 8715546 [details] [diff] [review]
Remove useless NS_INT32_TO_PTR from DumpSerialNumbers.
Review of attachment 8715546 [details] [diff] [review]:
-----------------------------------------------------------------
r=me assuming gcc/clang don't choke on passing |const void*| to %p. (They shouldn't, but you never know...)
Attachment #8715546 -
Flags: review?(nfroyd) → review+
Comment 5•10 years ago
|
||
| bugherder | ||
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla47
You need to log in
before you can comment on or make changes to this bug.
Description
•