Closed Bug 334288 Opened 18 years ago Closed 12 years ago

use early returns in nsObjectLoadingContent::IsSupportedDocument

Categories

(Core Graveyard :: Plug-ins, enhancement)

enhancement
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
mozilla17

People

(Reporter: timeless, Assigned: johns)

References

()

Details

Attachments

(1 file, 2 obsolete files)

coverity doesn't like this code, but it's wrong in claiming that it's dangerous.

i don't like this code either, so this bug is a request for:

if (!info)
  return PR_FALSE;

it simplifies the code and happens to quiet coverity (which complains that supported is used uninitialized - in the impossible case of do_GetService setting info to null and rv to ns_ok).
Attached patch use early returns (obsolete) — Splinter Review
Assignee: nobody → timeless
Status: NEW → ASSIGNED
Attachment #218659 - Flags: superreview?(bzbarsky)
Attachment #218659 - Flags: review?(cbiesinger)
Comment on attachment 218659 [details] [diff] [review]
use early returns

Single-line ifs should be braced in this code.

Also, I'd like to see both the -w diff and a normal one.
Attachment #218659 - Flags: superreview?(bzbarsky) → superreview-
Comment on attachment 218659 [details] [diff] [review]
use early returns

what bz said
Attachment #218659 - Flags: review?(cbiesinger)
Depends on: 745030
Comment on attachment 650304 [details] [diff] [review]
Use early returns in nsObjectLoadingContent::IsSupportedDocument

Resurrecting from the grave!
Attachment #650304 - Flags: review?(bzbarsky)
Assignee: timeless → jschoenick
OS: Mac OS X → All
Hardware: PowerPC → All
Attachment #218659 - Attachment is obsolete: true
Maybe a version that compiles would be preferable
Attachment #650304 - Attachment is obsolete: true
Attachment #650304 - Flags: review?(bzbarsky)
Attachment #650344 - Flags: review?(bzbarsky)
Comment on attachment 650344 [details] [diff] [review]
Use early returns in nsObjectLoadingContent::IsSupportedDocument

r=me
Attachment #650344 - Flags: review?(bzbarsky) → review+
https://hg.mozilla.org/mozilla-central/rev/08631f0a9b1d
Status: ASSIGNED → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla17
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: