[cfe-commits] r49427 - /cfe/trunk/lib/Rewrite/HTMLRewrite.cpp

Ted Kremenek kremenek at apple.com
Wed Apr 9 08:40:40 PDT 2008


Author: kremenek
Date: Wed Apr  9 10:40:40 2008
New Revision: 49427

URL: http://llvm.org/viewvc/llvm-project?rev=49427&view=rev
Log:
Micro-optimization: Don't use ostringstream when using a C-string literal
will work just fine.

Modified:
    cfe/trunk/lib/Rewrite/HTMLRewrite.cpp

Modified: cfe/trunk/lib/Rewrite/HTMLRewrite.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Rewrite/HTMLRewrite.cpp?rev=49427&r1=49426&r2=49427&view=diff

==============================================================================
--- cfe/trunk/lib/Rewrite/HTMLRewrite.cpp (original)
+++ cfe/trunk/lib/Rewrite/HTMLRewrite.cpp Wed Apr  9 10:40:40 2008
@@ -188,46 +188,34 @@
 
   // Generate header
 
-  {
-    std::ostringstream os;
-    
-    os << "<html>\n<head>\n"
-       << "<style type=\"text/css\">\n"
-       << " body { color:#000000; background-color:#ffffff }\n"
-       << " body { font-family:Helvetica, sans-serif; font-size:10pt }\n"
-       << " h1 { font-size:12pt }\n"
-       << " .code { border-spacing:0px; width:100%; }\n"
-       << " .code { font-family: \"Andale Mono\", monospace; font-size:10pt }\n"
-       << " .code { line-height: 1.2em }\n"
-       << " .num { width:2.5em; padding-right:2ex; background-color:#eeeeee }\n"
-       << " .num { text-align:right; font-size: smaller }\n"
-       << " .num { color:#444444 }\n"
-       << " .line { padding-left: 1ex; border-left: 3px solid #ccc }\n"
-       << " .line { white-space: pre }\n"
-       << " .msg { background-color:#fff8b4; color:#000000 }\n"
-       << " .msg { -webkit-box-shadow:1px 1px 7px #000 }\n"
-       << " .msg { -webkit-border-radius:5px }\n"
-       << " .msg { font-family:Helvetica, sans-serif; font-size: smaller }\n"
-       << " .msg { font-weight: bold }\n"
-       << " .msg { float:left }\n"
-       << " .msg { padding:0.5em 1ex 0.5em 1ex }\n"
-       << " .msg { margin-top:10px; margin-bottom:10px }\n"
-       << " .mrange { background-color:#dfddf3 }\n"
-       << " .mrange { border-bottom:1px solid #6F9DBE }\n"
-       << " .PathIndex { font-weight: bold }\n"
-       << "</style>\n</head>\n<body>";
-    
-    R.InsertStrBefore(StartLoc, os.str());
-  }
-  
+  R.InsertCStrBefore(StartLoc,
+      "<html>\n<head>\n"
+      "<style type=\"text/css\">\n"
+      " body { color:#000000; background-color:#ffffff }\n"
+      " body { font-family:Helvetica, sans-serif; font-size:10pt }\n"
+      " h1 { font-size:12pt }\n"
+      " .code { border-spacing:0px; width:100%; }\n"
+      " .code { font-family: \"Andale Mono\", monospace; font-size:10pt }\n"
+      " .code { line-height: 1.2em }\n"
+      " .num { width:2.5em; padding-right:2ex; background-color:#eeeeee }\n"
+      " .num { text-align:right; font-size: smaller }\n"
+      " .num { color:#444444 }\n"
+      " .line { padding-left: 1ex; border-left: 3px solid #ccc }\n"
+      " .line { white-space: pre }\n"
+      " .msg { background-color:#fff8b4; color:#000000 }\n"
+      " .msg { -webkit-box-shadow:1px 1px 7px #000 }\n"
+      " .msg { -webkit-border-radius:5px }\n"
+      " .msg { font-family:Helvetica, sans-serif; font-size: smaller }\n"
+      " .msg { font-weight: bold }\n"
+      " .msg { float:left }\n"
+      " .msg { padding:0.5em 1ex 0.5em 1ex }\n"
+      " .msg { margin-top:10px; margin-bottom:10px }\n"
+      " .mrange { background-color:#dfddf3 }\n"
+      " .mrange { border-bottom:1px solid #6F9DBE }\n"
+      " .PathIndex { font-weight: bold }\n"
+      "</style>\n</head>\n<body>");
+
   // Generate footer
   
-  {
-    std::ostringstream os;
-    
-    os << "</body></html>\n";
-    R.InsertStrAfter(EndLoc, os.str());
-  }
+  R.InsertCStrAfter(EndLoc, "</body></html>\n");
 }
-  
-  





More information about the cfe-commits mailing list