Open Bug 87248 Opened 23 years ago Updated 2 years ago

Prune 662 blocks of #if 0

Categories

(Core :: General, defect)

defect

Tracking

()

People

(Reporter: jwbaker, Unassigned)

References

()

Details

There sure is a lot of $if 0 in Mozilla.  Some of these blocks contain code
which will land in the future, while others contain long since dead code.  My
intent is to prune the latter, thereby clarifying the source code a bit.  I will
produce patches for each top level source code directory.
Here's a prime candidate from nsTextHelper in widget/gtk:

186 //-------------------------------------------------------------------------
187 NS_IMETHODIMP nsTextHelper::GetSelection(PRUint32 *aStartSel, PRUint32 *aEndSel)
188 {
189 #if 0
190 XmTextPosition left;
191 XmTextPosition right;
192 
193 if (XmTextGetSelectionPosition(mTextWidget, &left, &right)) {
194 *aStartSel = (PRUint32)left;
195 *aEndSel   = (PRUint32)right;
196 } else {
197 printf("nsTextHelper::GetSelection Error getting positions\n");
198 return NS_ERROR_FAILURE;
199 }
200 #endif
201 return NS_OK;
202 }

Is that Motif?  Yes, it is!  The whole method is commented out.  It's actually
something of a shame that we even bother to push a stack frame to enter this
method.  Hopefully the compilers are optimizing this away.
before you go out and kill all of the motif code, you might want to ask the 
guy who's trying to resurrect motif if any of it is of any use to him.

I think the real answer is that most of the widgets in widget/src/* aren't 
actually used by mozilla at all (they might be used by the *embed apps). -- I 
keep running into that when i try to figure out what stuff actually needs 
implementation for BeOS.

I'm slightly wrong, as the only client in this case isn't *embed, it's viewer 
(aka the app everyone wants to kill).
After an exhaustive lxr investigation, I conclude that there are no consumers of
nsTextHelper::GetSelection() at all.  Good thing, since it doesn't fulfill its
interface.
Oh I forgot to mention that I don't condone "#if 0" as a history mechanism. 
That's why we have CVS.  For cripes sake, this same commented out block of Motif
code is even present in the Mac source.
Product: Browser → Seamonkey
Assignee: jwbaker → nobody
Product: SeaMonkey → Core
QA Contact: doronr → general
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.