Closed Bug 1448586 Opened 2 years ago Closed 2 years ago

Avoid useless use of NS_LITERAL_CSTRING when prefixing query string with question mark

Categories

(Core :: DOM: Core & HTML, defect)

defect
Not set

Tracking

()

RESOLVED FIXED
mozilla61
Tracking Status
firefox61 --- fixed

People

(Reporter: hsivonen, Assigned: hsivonen)

References

Details

Attachments

(1 file)

Let's not do this:
CopyUTF8toUTF16(NS_LITERAL_CSTRING("?") + search, _search);
Comment on attachment 8962081 [details]
Bug 1448586 - Avoid useless use of NS_LITERAL_CSTRING when prefixing query string with question mark. .

https://reviewboard.mozilla.org/r/230928/#review236438

::: dom/url/URLMainThread.cpp:430
(Diff revision 1)
>    nsAutoCString search;
>    nsresult rv;
>  
>    rv = mURI->GetQuery(search);
>    if (NS_SUCCEEDED(rv) && !search.IsEmpty()) {
> -    CopyUTF8toUTF16(NS_LITERAL_CSTRING("?") + search, aSearch);
> +    aSearch.Assign((char16_t)'?');

Isn't the normal style to use u prefix before the literal, not c-style casting.
Same also elsewhere.
Attachment #8962081 - Flags: review?(bugs) → review+
Comment on attachment 8962081 [details]
Bug 1448586 - Avoid useless use of NS_LITERAL_CSTRING when prefixing query string with question mark. .

https://reviewboard.mozilla.org/r/230928/#review236438

> Isn't the normal style to use u prefix before the literal, not c-style casting.
> Same also elsewhere.

Fixed. Thanks.
Pushed by hsivonen@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/04f9d83550c2
Avoid useless use of NS_LITERAL_CSTRING when prefixing query string with question mark. r=smaug.
https://hg.mozilla.org/mozilla-central/rev/04f9d83550c2
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla61
You need to log in before you can comment on or make changes to this bug.