The default bug view has changed. See this FAQ.

Add VoidString() or NullString() or NullDOMString()

RESOLVED FIXED in mozilla12

Status

()

Core
String
RESOLVED FIXED
5 years ago
5 years ago

People

(Reporter: smaug, Assigned: smaug)

Tracking

unspecified
mozilla12
x86_64
Linux
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

Atm, one needs to explicitly call SetIsVoid(). Would be nice to have something
close to EmptyString()
Something like
#define NullString() nsXPIDLString()
#define NullCString() nsXPIDLCString()
Assignee: nobody → bugs
Or better to implement it like Empty(C)String
Created attachment 582680 [details] [diff] [review]
something like this

Since nsXPIDLString has the behavior anyway, we should be able to reuse that.

https://tbpl.mozilla.org/?tree=Try&rev=ec49c8378fd2
SetDOMStringToNull exists.
This is not about a method which sets a string to null, but having a null string, which can be easily passed as a parameter to methods, or used in ctor member initialization.
Attachment #582680 - Flags: review?(benjamin)
Comment on attachment 582680 [details] [diff] [review]
something like this

glandium, will this cause a static ctor to run, and do you think that's a profile? Otherwise I think this is fine.
Attachment #582680 - Flags: review?(benjamin) → review?(mh+mozilla)
The patch as is won't cause a static ctor, but will cause a mutex being used each time NullString and NullCString are used.
IRC:
glandium >	smaug: mmm actually looking at the code gcc generates, it only acquires the lock if it the constant wasn't already initialized, so it's not as bad as i suggested

That doesn't sound bad to me, and EmptyString has the same behavior.
Comment on attachment 582680 [details] [diff] [review]
something like this

rs=me
Attachment #582680 - Flags: review?(mh+mozilla) → review+
https://hg.mozilla.org/mozilla-central/rev/3328809425d2
Status: NEW → RESOLVED
Last Resolved: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla12
You need to log in before you can comment on or make changes to this bug.