[Static Analysis][Big parameter passed by value] In Functions IsHeadRequest, aRequest is passed by value

RESOLVED FIXED in Firefox 48

Status

()

Core
DOM
RESOLVED FIXED
2 years ago
2 years ago

People

(Reporter: andi, Assigned: andi)

Tracking

(Blocks: 1 bug, {coverity})

Trunk
mozilla48
coverity
Points:
---

Firefox Tracking Flags

(firefox47 affected, firefox48 fixed)

Details

(Whiteboard: CID 1346078, CID 1346079)

MozReview Requests

()

Submitter Diff Changes Open Issues Last Updated
Loading...
Error loading review requests:

Attachments

(2 attachments)

(Assignee)

Description

2 years ago
The Static Analysis tool Coverity added that large objects such as CacheRequest and CacheRequestOrVoid are passed by value in:

>> bool IsHeadRequest(CacheRequestOrVoid aRequest, CacheQueryParams aParams)

and

>> bool IsHeadRequest(CacheRequest aRequest, CacheQueryParams aParams)

this can be optimized by passing pointer to that object, thus only passing 4 bytes or 32 bit architecture and 8 bytes on 64 bit architecture.
(Assignee)

Comment 1

2 years ago
Created attachment 8715866 [details] [diff] [review]
repalce pass by value with pass by pointer in IsHeadRequest
Attachment #8715866 - Flags: review?(jst)
Comment on attachment 8715866 [details] [diff] [review]
repalce pass by value with pass by pointer in IsHeadRequest

Any reason why passing the value by reference wouldn't be a better option here? It would make the patch much smaller, and it'd ensure you never get null unless someone goes out of their way...
(Assignee)

Comment 3

2 years ago
Created attachment 8720174 [details]
MozReview Request: Bug 1245868 - repalce pass by value with pass by pointer in IsHeadRequest. r?jst

Review commit: https://reviewboard.mozilla.org/r/35227/diff/#index_header
See other reviews: https://reviewboard.mozilla.org/r/35227/
Attachment #8720174 - Flags: review?(jst)
(Assignee)

Updated

2 years ago
Attachment #8715866 - Flags: review?(jst) → review-
(Assignee)

Comment 4

2 years ago
Hello Johnny,

No reason in particular, is just i'm more biased towards using pointers than references. I've updated the patch accordingly.
Comment on attachment 8720174 [details]
MozReview Request: Bug 1245868 - repalce pass by value with pass by pointer in IsHeadRequest. r?jst

https://reviewboard.mozilla.org/r/35227/#review40085

r=jst
Attachment #8720174 - Flags: review?(jst) → review+
Apologies for this one falling through the cracks! :(

Comment 8

2 years ago
bugherder
https://hg.mozilla.org/mozilla-central/rev/f1cfe4b34e8d
Status: NEW → RESOLVED
Last Resolved: 2 years ago
status-firefox48: --- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla48
You need to log in before you can comment on or make changes to this bug.