Closed Bug 204532 Opened 21 years ago Closed 21 years ago

more data could be const in content

Categories

(Core :: Layout, defect)

defect
Not set
trivial

Tracking

()

RESOLVED FIXED

People

(Reporter: ataylor, Assigned: ataylor)

References

Details

(Keywords: memory-footprint)

Attachments

(1 file, 1 obsolete file)

There are a number of variables in mozilla/content that could be made const. 
Making them const allows some optimizations not otherwise available, such as
sharing more data between multiple running instances.
Here is a patch that constifies some variables in content.
> -static char* kNullPointer = "null pointer";
> +static const char kNullPointer[] = "null pointer";

How about just copying this string to the one place where it's used (in an
NS_PRECONDITION) and eliminating the symbol entirely?  So that should read:

  NS_PRECONDITION(aInput, "Null input stream pointer");

instead of

  NS_PRECONDITION(nsnull != aInput, kNullPointer);

Comment on attachment 122522 [details] [diff] [review]
constifies some variables in content

nice!
sr=alecf
Attachment #122522 - Flags: superreview+
Here is a new patch that implements Boris' suggestion.
Attachment #122522 - Attachment is obsolete: true
Comment on attachment 122589 [details] [diff] [review]
constifies some variables in content - v2

r=me; please poke me when this gets approval (if you decide to ask for it) or
the tree reopens for 1.5a.
Attachment #122589 - Flags: review+
Comment on attachment 122589 [details] [diff] [review]
constifies some variables in content - v2

sr=alecf
yeah, lets wait on 1.5alpha for this.. I had an ugly landing of some
constifying at one point.
Attachment #122589 - Flags: superreview+
Checked in.
Status: NEW → RESOLVED
Closed: 21 years ago
Resolution: --- → FIXED
Depends on: 1209110
Product: Core → Core Graveyard
Component: Layout: Misc Code → Layout
Product: Core Graveyard → Core
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: