Closed
Bug 1041822
Opened 10 years ago
Closed 10 years ago
Add a lookupOrAdd to nsClassHashtable
Categories
(Core :: XPCOM, defect)
Tracking
()
RESOLVED
FIXED
mozilla34
People
(Reporter: mrbkap, Assigned: mrbkap)
References
Details
Attachments
(1 file)
1.55 KB,
patch
|
benjamin
:
review+
|
Details | Diff | Splinter Review |
Currently, there's no way to avoid having to do two lookups when using an nsClassHashtable if I want to look up an object that may have already been created that I then want to modify. This operation is easy to do using PLDHashTable (operate using PL_DHASH_ADD and use the resulting array). For nsClassHashtable, we could add this functionality pretty easily. Its users would have to have a default constructor, but IMO we could live with that. Is there a reason that we haven't done this before?
Assignee | ||
Comment 1•10 years ago
|
||
I didn't add an infallible version of this, but one could be added pretty easily. Is there any reason not to do this?
Attachment #8459910 -
Flags: review?(benjamin)
Assignee | ||
Comment 2•10 years ago
|
||
s/infallible/fallible/
Comment 3•10 years ago
|
||
You might have better luck with a review from :froydnj, as I think bsmedberg is away for another week or so.
Comment 4•10 years ago
|
||
Comment on attachment 8459910 [details] [diff] [review] patch v1 The magic of templates means that this only has to compile if somebody uses it. This is fine. I wonder if we should do something similar for nsDataHashtable, but I guess we don't need to until somebody needs it there.
Attachment #8459910 -
Flags: review?(benjamin) → review+
Assignee | ||
Updated•10 years ago
|
Assignee: nobody → mrbkap
Assignee | ||
Comment 5•10 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/d20cfaa4220b
Comment 6•10 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/d20cfaa4220b
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla34
You need to log in
before you can comment on or make changes to this bug.
Description
•