[Webkit-unassigned] [Bug 136183] WebKit and WebKit2: Use ASCIILiteral where possible
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Sun Aug 24 11:39:17 PDT 2014
https://bugs.webkit.org/show_bug.cgi?id=136183
--- Comment #3 from Darin Adler <darin at apple.com> 2014-08-24 11:39:25 PST ---
(From update of attachment 237010)
View in context: https://bugs.webkit.org/attachment.cgi?id=237010&action=review
Seems like some of this code may be overusing String where we could use string literals. The problem is we have no better type for a string literal than "const char*" and that type does not pass the length through nor does it communicate the fact that the entire string is ASCII. And also if do hard code something to be a string literal than it’s troublesome if we want to compute its value in one case.
>> Source/WebKit/cf/WebCoreSupport/WebInspectorClientCF.cpp:86
>> *setting = "";
>
> Unrelated but that looks like a bad use of strings. When a value does not exist, the return should be a null string, not an empty string.
Maybe, but I don’t think that’s universally true. Sometimes the handy value to use for "not existing" is a null string, other times it’s better to always return a non-null string. I don’t think there’s a clear rule of thumb. Of course, it’s more efficient to use emptyString() rather than "" for an empty WTF::String.
>> Source/WebKit2/WebProcess/Plugins/PDF/PDFPluginTextAnnotation.mm:57
>> + return ASCIILiteral("left");
>
> I hope clang only generate one constructor here.
Or the return value from this could just be const char* instead of const String.
--
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
More information about the webkit-unassigned
mailing list