Bug 144483

Summary: Clean up: Remove unnecessary runtime computation of string length
Product: WebKit Reporter: Daniel Bates <dbates>
Component: WebCore Misc.Assignee: Daniel Bates <dbates>
Status: RESOLVED FIXED    
Severity: Normal CC: achristensen, ap, beidson
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Attachments:
Description Flags
Patch joepeck: review+

Description Daniel Bates 2015-04-30 18:27:37 PDT
Following <http://trac.webkit.org/changeset/183649>, WebCore::fullyQualifiedInfoTableName() computes the strlen() of a string literal as part of concatenating two string literals. Notice that the size of a string literal is known at compile time. It is sufficient to use sizeof() - 1 instead of strlen() to compute the string length of the string literal.
Comment 1 Daniel Bates 2015-04-30 18:29:16 PDT
Created attachment 252127 [details]
Patch
Comment 2 Joseph Pecoraro 2015-04-30 19:39:04 PDT
Comment on attachment 252127 [details]
Patch

r=me
Comment 3 Daniel Bates 2015-04-30 19:41:51 PDT
Committed r183663: <http://trac.webkit.org/changeset/183663>
Comment 4 Darin Adler 2015-05-01 12:03:24 PDT
Comment on attachment 252127 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=252127&action=review

> Source/WebCore/Modules/webdatabase/DatabaseBackendBase.cpp:100
> -        strcpy(qualifiedName + strlen(qualifier), unqualifiedInfoTableName);
> +        strcpy(qualifiedName + sizeof(qualifier) - 1, unqualifiedInfoTableName);

This change is unnecessary for clang or gcc since they already constant-fold this. So in practice this is a at most a Windows-only optimization.