Closed Bug 620445 Opened 9 years ago Closed 9 years ago

useless null check of prefix in XMLToXMLString

Categories

(Core :: JavaScript Engine, enhancement)

enhancement
Not set

Tracking

()

RESOLVED FIXED

People

(Reporter: timeless, Assigned: timeless)

References

(Blocks 1 open bug)

Details

(Keywords: coverity, Whiteboard: fixed-in-tracemonkey)

Attachments

(1 file)

2383 XMLToXMLString(JSContext *cx, JSXML *xml, const JSXMLArray *ancestorNSes,

2388     JSString *str, *prefix, *nsuri;

2508     prefix = GetPrefix(ns);
2509     if (!prefix) {
2525         if (!GetPrefix(xml->name)) {
here, prefix is not null:
2526             prefix = cx->runtime->emptyString;
2527         } else {
2528             prefix = GeneratePrefix(cx, nsuri, &ancdecls.array);
here, if prefix is null, we bail:
2529             if (!prefix)
2530                 goto out;

here we use prefix:
2549         if (prefix->empty()) {
2566     }

at this point, prefix must not be null.

this null check of prefix is useless:
2572     if (prefix && !prefix->empty()) {
compute

2729 out:
2730     js_LeaveLocalRootScopeWithResult(cx, str);
2731     return str;
Attached patch patchSplinter Review
Assignee: general → timeless
Status: NEW → ASSIGNED
Attachment #498931 - Flags: review?(brendan)
Attachment #498931 - Flags: review?(brendan) → review+
Keywords: checkin-needed
Whiteboard: [push to tm]
http://hg.mozilla.org/tracemonkey/rev/bb4470d52f36
Keywords: checkin-needed
Whiteboard: [push to tm] → fixed-in-tracemonkey
http://hg.mozilla.org/mozilla-central/rev/bb4470d52f36
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.