Closed Bug 114166 Opened 23 years ago Closed 23 years ago

rewrite nsDeque

Categories

(Core :: XPCOM, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: akkzilla, Assigned: timeless)

References

Details

Attachments

(1 file, 9 obsolete files)

nsDeque has various repeated comments, comments that refer to functions other than the function they preceed, etc. Timeless has volunteered to clean it up. I can review.
there are 2 silly whitespaces in the license block!! I think i still plan to commit the code rewrite as a separate cvs pass.
Status: NEW → ASSIGNED
Attached patch diff against 61239 (obsolete) — Splinter Review
1. removing all @updates. cvs log/blame handle this 2. % isn't guaranteed. See long comment in patch 3. ::PopFront diffed really poorly. here's the code: void* nsDeque::PopFront() { void* result=0; if (mSize>0) { NS_ASSERTION(mOrigin < mCapacity, "Error: Bad origin"); result=mData[mOrigin]; mData[mOrigin++]=0; //zero it out for debugging purposes. mSize--; // Cycle around if we pop off the end // and reset origin if when we pop the last element if (mCapacity==mOrigin || !mSize) { mOrigin=0; } } return result; }
Attachment #61239 - Attachment is obsolete: true
Attached file mozilla/xpcom/tests/TestDeque.cpp (obsolete) —
Attached patch current patch from my tree (obsolete) — Splinter Review
I've been running with this patch for two months i guess.
Attachment #61240 - Attachment is obsolete: true
Attachment #61333 - Attachment is obsolete: true
Attached patch fix callers (obsolete) — Splinter Review
some callers do bad things, peeking empty deques, iterating past the end of their deque.
Attached patch really fix callers (obsolete) — Splinter Review
Attachment #70202 - Attachment is obsolete: true
OS: Linux → All
Hardware: PC → All
Summary: nsDeque has confusing comments → rewrite nsDeque
Attachment #70194 - Flags: superreview+
Comment on attachment 70194 [details] mozilla/xpcom/tests/TestDeque.cpp rs=alecf
Comment on attachment 70195 [details] [diff] [review] current patch from my tree I guess this looks ok - much of it is just reformatting existing code, but I think I understand the bounds issues as well. sr=alecf (I'm assuming akkana will also give this a good r=)
Attachment #70195 - Flags: superreview+
r=akkana on 70195 ("current patch from my tree") and 70205 ("really fix callers"), with a few changes that timeless and I discussed (add a few more clarifying comments, fix three lines in nsFind.cpp, remove a line from the test makefile). In addition to cleaning up and documenting the code, this also fixes a crash in the new editor find and replace dialog (it was disabled because it was crashing in nsDeque code) and so will unblock bug 80805.
Blocks: 80805
i'm changing the signature of GrowCapacity, it's only used internally and it means that I can almost return an error if GrowCapacity can't grow.
Attachment #70194 - Attachment is obsolete: true
Attachment #70195 - Attachment is obsolete: true
Attached patch fix callers (obsolete) — Splinter Review
the new find incorrectly used an iterator, fix is here and the much better comments explains what was being done wrong.
Attachment #70205 - Attachment is obsolete: true
r=akkana on the new changes -- the improved comments, the new GrowCapacity signature, and the nsFind fix.
Note that this checkin caused the regression described in bug 126797, which kin has fixed.
Keywords: mozilla1.0+
Attachment #70431 - Attachment is obsolete: true
Attachment #70433 - Attachment is obsolete: true
Comment on attachment 72500 [details] [diff] [review] last bits of cleanup (typos, one inconsistency in javadoc) sr=darin
Attachment #72500 - Flags: superreview+
Comment on attachment 72500 [details] [diff] [review] last bits of cleanup (typos, one inconsistency in javadoc) a=asa (on behalf of drivers) for checkin to the 1.0 trunk
Attachment #72500 - Flags: approval+
fixed checked into trunk
Status: ASSIGNED → RESOLVED
Closed: 23 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: