diff libinterp/corefcn/pr-output.cc @ 23807:336f89b6208b

Use character literals 'c' rather than string literals "c" when possible. Better performance when string constructor isn't required. * Figure.cc, __init_qt__.cc, files-dock-widget.cc, file-editor-tab.cc, file-editor.cc, octave-qscintilla.cc, main-window.cc, octave-dock-widget.cc, octave-qt-link.cc, parser.cc, webinfo.cc, resource-manager.cc, settings-dialog.cc, workspace-view.cc, __magick_read__.cc, balance.cc, debug.cc, dynamic-ld.cc, ft-text-renderer.cc, gl-render.cc, gl2ps-print.cc, graphics.cc, hook-fcn.h, input.cc, load-path.cc, load-save.cc, ls-hdf5.cc, oct-hist.cc, oct-stream.cc, pager.cc, pr-output.cc, qz.cc, symtab.cc, symtab.h, tril.cc, __delaunayn__.cc, __init_fltk__.cc, __voronoi__.cc, audioread.cc, ccolamd.cc, colamd.cc, convhulln.cc, ov-base-int.cc, ov-base-mat.cc, ov-base-scalar.cc, ov-base.cc, ov-bool-mat.cc, ov-cell.cc, ov-class.cc, ov-classdef.cc, ov-colon.cc, ov-complex.cc, ov-cx-mat.cc, ov-fcn-handle.cc, ov-fcn-inline.cc, ov-fcn.h, ov-flt-cx-mat.cc, ov-flt-re-mat.cc, ov-java.cc, ov-oncleanup.cc, ov-range.cc, ov-re-mat.cc, ov-re-sparse.cc, ov-str-mat.cc, ov-struct.cc, ov-usr-fcn.cc, ov.cc, octave.cc, bp-table.cc, jit-ir.cc, jit-ir.h, jit-typeinfo.cc, pt-funcall.cc, pt-idx.cc, pt-pr-code.cc, pt.h, Array.cc, CDiagMatrix.cc, CMatrix.cc, CNDArray.cc, CRowVector.cc, CSparse.cc, Range.cc, boolSparse.cc, dDiagMatrix.cc, dMatrix.cc, dNDArray.cc, dRowVector.cc, dSparse.cc, fCDiagMatrix.cc, fCMatrix.cc, fCNDArray.cc, fCRowVector.cc, fDiagMatrix.cc, fMatrix.cc, fNDArray.cc, fRowVector.cc, idx-vector.cc, intNDArray.cc, CollocWt.cc, DASPK.cc, DASRT.cc, DASSL.cc, LSODE.cc, oct-time.cc, cmd-hist.cc, kpse.cc, lo-array-errwarn.cc, lo-regexp.cc, lo-utils.cc, str-vec.cc, url-transfer.cc, main-cli.cc, main-gui.cc, mkoctfile.in.cc: Replace 1-character string literals "c" with the character literal 'c'.
author Rik <rik@octave.org>
date Fri, 28 Jul 2017 15:40:00 -0700
parents 90689bdbe048
children 01899bdd2a3a
line wrap: on
line diff
--- a/libinterp/corefcn/pr-output.cc	Fri Jul 28 11:45:07 2017 -0700
+++ b/libinterp/corefcn/pr-output.cc	Fri Jul 28 15:40:00 2017 -0700
@@ -404,7 +404,7 @@
           std::ostringstream buf;
           buf.flags (std::ios::fixed);
           buf << std::setprecision (0) << static_cast<int>(n)
-              << "/" << static_cast<int>(d);
+              << '/' << static_cast<int>(d);
           m++;
 
           if (n < 0 && d < 0)
@@ -431,7 +431,7 @@
           std::ostringstream buf;
           buf.flags (std::ios::fixed);
           buf << std::setprecision (0) << static_cast<int>(lastn)
-              << "/" << static_cast<int>(lastd);
+              << '/' << static_cast<int>(lastd);
           s = buf.str ();
         }
     }
@@ -481,7 +481,7 @@
             (prf.f.fmt | prf.f.up | prf.f.sp));
 
   if (fw > 0 && s.length () > static_cast<unsigned int>(fw))
-    os << "*";
+    os << '*';
   else
     os << s;
 
@@ -1588,7 +1588,7 @@
 
           pr_imag_float (os, i, i_fw);
         }
-      os << "i";
+      os << 'i';
     }
 }
 
@@ -1603,14 +1603,14 @@
       if (nr == 0 && nc == 0)
         os << "[]";
       else
-        os << "zeros (" << nr << ", " << nc << ")";
+        os << "zeros (" << nr << ", " << nc << ')';
     }
   else
     {
       os << "[]";
 
       if (Vprint_empty_dimensions)
-        os << "(" << nr << "x" << nc << ")";
+        os << '(' << nr << 'x' << nc << ')';
     }
 }
 
@@ -1621,13 +1621,13 @@
   assert (dims.any_zero ());
 
   if (pr_as_read_syntax)
-    os << "zeros (" << dims.str (',') << ")";
+    os << "zeros (" << dims.str (',') << ')';
   else
     {
       os << "[]";
 
       if (Vprint_empty_dimensions)
-        os << "(" << dims.str () << ")";
+        os << '(' << dims.str () << ')';
     }
 }
 
@@ -1766,7 +1766,7 @@
           os << m;
 
           if (pr_as_read_syntax)
-            os << "]";
+            os << ']';
 
           return;
         }
@@ -1902,7 +1902,7 @@
           os << Matrix (m);
 
           if (pr_as_read_syntax)
-            os << "]";
+            os << ']';
 
           return;
         }
@@ -1948,7 +1948,7 @@
               else
                 os << " ...\n";
             }
-          os << ")";
+          os << ')';
         }
       else
         {
@@ -2042,9 +2042,9 @@
                   buf << ra_idx(k) + 1;
 
                   if (k < ndims - 1)
-                    buf << ",";
+                    buf << ',';
                   else
-                    buf << ")";
+                    buf << ')';
                 }
 
               nm += buf.str ();
@@ -2105,14 +2105,14 @@
   if (rp == 0.0)
     {
       if (ip == 0.0)
-        os << " ";
+        os << ' ';
       else
-        os << "i";
+        os << 'i';
     }
   else if (ip == 0.0)
     pr_plus_format (os, rp);
   else
-    os << "c";
+    os << 'c';
 }
 
 void
@@ -2184,7 +2184,7 @@
           os << cm;
 
           if (pr_as_read_syntax)
-            os << "]";
+            os << ']';
 
           return;
         }
@@ -2322,7 +2322,7 @@
           os << ComplexMatrix (cm);
 
           if (pr_as_read_syntax)
-            os << "]";
+            os << ']';
 
           return;
         }
@@ -2368,7 +2368,7 @@
               else
                 os << " ...\n";
             }
-          os << ")";
+          os << ')';
         }
       else
         {
@@ -2467,7 +2467,7 @@
           os << Matrix (m);
 
           if (pr_as_read_syntax)
-            os << "]";
+            os << ']';
 
           return;
         }
@@ -2516,7 +2516,7 @@
               else
                 os << " ...\n";
             }
-          os << ")";
+          os << ')';
         }
       else
         {
@@ -2903,9 +2903,9 @@
                   buf << ra_idx(k) + 1;
 
                   if (k < ndims - 1)
-                    buf << ",";
+                    buf << ',';
                   else
-                    buf << ")";
+                    buf << ')';
                 }
 
               nm += buf.str ();
@@ -3168,9 +3168,9 @@
                   buf << ra_idx(k) + 1;
 
                   if (k < ndims - 1)
-                    buf << ",";
+                    buf << ',';
                   else
-                    buf << ")";
+                    buf << ')';
                 }
 
               nm += buf.str ();
@@ -3276,9 +3276,9 @@
                   buf << ra_idx(k) + 1;
 
                   if (k < ndims - 1)
-                    buf << ",";
+                    buf << ',';
                   else
-                    buf << ")";
+                    buf << ')';
                 }
 
               nm += buf.str ();
@@ -3315,7 +3315,7 @@
                 }
 
               if (pr_as_read_syntax)
-                os << "]";
+                os << ']';
             }
           else
             {