all string classes should allow dependent assignment

NEW
Unassigned

Status

()

Core
String
P3
normal
12 years ago
5 years ago

People

(Reporter: dbaron, Unassigned)

Tracking

Trunk
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: [patch])

Attachments

(1 attachment, 1 obsolete attachment)

(Reporter)

Description

12 years ago
Performance optimization using our string classes would be helped if all string
classes allowed dependent assignment rather than just nsDependent[C]S[ubs]tring.
 Dependent substring assignment would require a check that the class type
supports it -- and fallback to Assign (perhaps with assertion, although I'm
currently thinking without) if it doesn't.  I'd also want a version of
ns[C]AutoString that doesn't imply termination.

Preliminary patch coming.
(Reporter)

Comment 1

12 years ago
Created attachment 195479 [details] [diff] [review]
untested patch

Untested, but compiles through xpcom.

Comment 2

12 years ago
Comment on attachment 195479 [details] [diff] [review]
untested patch

nsString implies termination (remember nsAFlatString).	I think it will be hard
to change that.

It confuses me to see nsTAutoSubstring inherit from nsTAutoString since
nsTAutoString eventually inherits from nsTSubstring.

I sort of think that it's only going to work to allow setting a dependent and
null-terminated buffer on a nsTString.
(Reporter)

Updated

12 years ago
Priority: -- → P1
Whiteboard: [patch]
Target Milestone: --- → mozilla1.9alpha
(Reporter)

Comment 3

12 years ago
(In reply to comment #2)
> nsString implies termination (remember nsAFlatString). I think it will be hard
> to change that.

I didn't change that, with the one exception of nsTAutoSubstring.

> It confuses me to see nsTAutoSubstring inherit from nsTAutoString since
> nsTAutoString eventually inherits from nsTSubstring.
>
> I sort of think that it's only going to work to allow setting a dependent and
> null-terminated buffer on a nsTString.

Yeah, it's odd, but it's also exactly what nsStandardURL::BuildNormalizedSpec
should have been using, and I don't see any other easy way to do it.
(Reporter)

Comment 4

11 years ago
Created attachment 251295 [details] [diff] [review]
untested patch

This is tested in that I had it in my tree for months (I'm just removing it now) and it didn't break anything, but I haven't really tested the new stuff.
Attachment #195479 - Attachment is obsolete: true

Updated

5 years ago
Assignee: dbaron → nobody
Priority: P1 → P3
Target Milestone: mozilla1.9alpha1 → ---
You need to log in before you can comment on or make changes to this bug.