diff libinterp/corefcn/strfns.cc @ 23812:057a894914df

Use C++11 string fcns back() and pop_back() to simplify code. * error.cc (maybe_extract_message): Use "back()" rather than "[length () -1]". * input.cc (base_reader::octave_gets): Use "back()" rather than "[length () -1]". * ls-hdf5.cc (read_hdf5_data)): Use "clear()" rather than "resize (0)" to erase string. * ls-mat-ascii.cc (get_lines_and_columns): Reformat comment. * ls-oct-binary.cc (read_binary_data): Use "clear()" rather than "resize (0)" to erase string. * oct-stream.cc (delimited_stream::getline): Declare and initialize only one variable per line as per Octave coding convention. * oct-stream.cc (textscan_format_list::read_first_row): Use back() and pop_back() to potentially remove last character from string. * strfns.cc (Fstrvcat): Use "empty()" rather than "length() > 0". * sysdep.cc (w32_set_octav_home): Use back() and push_back() to potentially add dir separator to string. * gzip.cc (uchar_array): Space out code for readability. * file-ops.cc (tilde_expand): Call string_vector constructor with size n rather than resize. * file-ops.cc (concat): Use "back()" rather than "[length () -1]". * file-stat.cc (update_internal): Use "back()" rather than "[length () -1]". Use pop_back() rather than resize() to remove last character. * oct-env.cc (do_chdir): Use pop_back() rather than resize() to remove last character. * cmd-edit.cc (do_generate_filename_completions): Reformat comment. * cmd-hist.cc (): Use back() and pop_back() to potentially remove "\n" from end of string. * data-conv.cc (strip_spaces): Initialize string with null character rather than space. * kpse.cc (kpse_tilde_expand): Use "back()" rather than "[length () -1]". * kpse.cc (kpse_expand_kpse_dot, kpse_brace_expand, kpse_path_expand): Use pop_back() to potentially remove last character. * kpse.cc (kpse_brace_expand_element, kpse_element_dir): Use pop_back() to remove last character. * lo-utils.cc (octave_fgetl): Use "back()" rather than "[length () -1]". Use pop_back() rather than resize() to remove last character.
author Rik <rik@octave.org>
date Sun, 30 Jul 2017 09:21:58 -0700
parents 45a6347fdd84
children 56d1e4d9975e
line wrap: on
line diff
--- a/libinterp/corefcn/strfns.cc	Sun Jul 30 09:21:39 2017 -0700
+++ b/libinterp/corefcn/strfns.cc	Sun Jul 30 09:21:58 2017 -0700
@@ -221,7 +221,7 @@
         {
           for (size_t j = 0; j < n; j++)
             {
-              if (s[j].length () > 0)
+              if (! s[j].empty ())
                 n_elts++;
             }
         }