Closed Bug 1475461 Opened 6 years ago Closed 6 years ago

Make PLDHashTable::Search() const

Categories

(Core :: XPCOM, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla63
Tracking Status
firefox63 --- fixed

People

(Reporter: masayuki, Assigned: masayuki)

References

Details

Attachments

(2 files)

PLDHashTable::Search() is now not marked as const.  Therefore, if its caller is marked as const, it needs to use const_cast.  So, let's mark the method (and related methods) as const.
Comment on attachment 8991871 [details]
Bug 1475461 - part 1: Mark PLDHashTable::Search() and called by it as const

https://reviewboard.mozilla.org/r/256794/#review263740

Wow, this ended up being a lot more invasive than I was hoping for...  Thanks very much for doing this!  :-)
Attachment #8991871 - Flags: review?(ehsan) → review+
Comment on attachment 8991872 [details]
Bug 1475461 - part 2: Make callers of PLDHashTable::Search() const methods if possible

https://reviewboard.mozilla.org/r/256796/#review263742

Very nice!

::: dom/commandhandler/nsCommandParams.cpp:298
(Diff revision 1)
>  }
>  
>  nsCommandParams::HashEntry*
>  nsCommandParams::GetNamedEntry(const char* aName) const
>  {
> -  return static_cast<HashEntry*>(
> +  return static_cast<HashEntry*>(mValuesHash.Search((void*)aName));

Hmm, it'd be nice if the argument type were const void*...
Attachment #8991872 - Flags: review?(ehsan) → review+
Comment on attachment 8991872 [details]
Bug 1475461 - part 2: Make callers of PLDHashTable::Search() const methods if possible

https://reviewboard.mozilla.org/r/256796/#review263742

> Hmm, it'd be nice if the argument type were const void*...

Do you think that I should change it here? (You commented this as an open issue...)
(ping for replying to the review comment)
Flags: needinfo?(ehsan)
(In reply to Masayuki Nakano [:masayuki] (JST, +0900) from comment #6)
> Comment on attachment 8991872 [details]
> Bug 1475461 - part 2: Make callers of PLDHashTable::Search() const methods
> if possible
> 
> https://reviewboard.mozilla.org/r/256796/#review263742
> 
> > Hmm, it'd be nice if the argument type were const void*...
> 
> Do you think that I should change it here? (You commented this as an open
> issue...)

Ah no, I was thinking out loud, I don't want to make you do more work here than you already did!  Thanks.  :-)

(Sorry, I keep forgetting that these comments open issues in MozReview, need to get better at noticing that...)
Flags: needinfo?(ehsan)
No, problem, thank you for your review!
Pushed by masayuki@d-toybox.com:
https://hg.mozilla.org/integration/autoland/rev/9f8a3c2f6528
part 1: Mark PLDHashTable::Search() and called by it as const r=Ehsan
https://hg.mozilla.org/integration/autoland/rev/de078de9ee98
part 2: Make callers of PLDHashTable::Search() const methods if possible r=Ehsan
https://hg.mozilla.org/mozilla-central/rev/9f8a3c2f6528
https://hg.mozilla.org/mozilla-central/rev/de078de9ee98
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla63
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: