Closed Bug 305278 Opened 20 years ago Closed 19 years ago

plevent.h gives bad advice

Categories

(Core :: XPCOM, defect, P2)

defect

Tracking

()

RESOLVED FIXED
mozilla1.9alpha1

People

(Reporter: dbaron, Assigned: dbaron)

Details

(Whiteboard: [patch])

Attachments

(2 files)

The comment in plevent.h gives bad advice in two ways: * it recommends using casts when none should be needed, and the habit of using them can cover up real bugs * it omits PR_CALLBACK in the example handlers, which would break any build that defines it to something interesting (e.g., the OS/2 VisualAge build) I'm more concerned about the first, really.
Severity: normal → trivial
Status: NEW → ASSIGNED
Priority: -- → P2
Whiteboard: [patch]
Target Milestone: --- → mozilla1.9alpha
Comment on attachment 193237 [details] [diff] [review] patch the change to the example is that you are now droping the |static| keyword (that is what PR_STATIC_CALLBACK gave you). Do you want to run through the tree and try to remove the casts?
Attachment #193237 - Flags: review?(dougt) → review+
Actually, I'm more concerned that the example never had the static keyword. I'll remove some of the casts and see what it does to the OS/2 build. Note we don't build VisualAge Mozilla anymore - we are GCC only.
Having static is nice, but not important -- it just makes the function have internal linkage, so the name isn't exposed to anything outside the file in which it lives.
So I missed one thing in the comment -- the argument type. I still think it's far better this way. Note the number of callers who passed a function returning void in place of one returning void* (not harmful in this case, but a very bad habit).
Attachment #202839 - Flags: superreview?(darin)
Attachment #202839 - Flags: review?(dougt)
Comment on attachment 202839 [details] [diff] [review] patch to correct callers (and re-correct comment) sr=darin
Attachment #202839 - Flags: superreview?(darin) → superreview+
Attachment #202839 - Flags: review?(dougt) → review+
Fix checked in to trunk.
Status: ASSIGNED → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: