Mercurial > hg > octave-nkf
changeset 20401:64f817945783
Use strrep instead of regexprep where possible in m-files for performance.
* scripts/gui/private/__fltk_file_filter__.m, scripts/io/strread.m,
scripts/plot/util/private/__go_draw_axes__.m,
scripts/testfun/private/html_compare_plot_demos.m:
Replace instances of regexprep with strrep.
author | Rik <rik@octave.org> |
---|---|
date | Thu, 14 May 2015 08:55:05 -0700 |
parents | 38487298513b |
children | 88efded31037 |
files | scripts/gui/private/__fltk_file_filter__.m scripts/io/strread.m scripts/plot/util/private/__go_draw_axes__.m scripts/testfun/private/html_compare_plot_demos.m |
diffstat | 4 files changed, 11 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/gui/private/__fltk_file_filter__.m +++ b/scripts/gui/private/__fltk_file_filter__.m @@ -37,7 +37,7 @@ curr_ext = ostrsplit (curr_ext, ";"); if (length (curr_ext) > 1) - curr_ext = regexprep (curr_ext, '\*\.', ','); + curr_ext = strrep (curr_ext, '*.', ','); curr_ext = strcat (curr_ext{:})(2 : end); curr_ext = strcat ("*.{", curr_ext, "}"); else @@ -48,8 +48,8 @@ if (c == 2) curr_desc = file_filter{idx, 2}; - curr_desc = regexprep (curr_desc, '\(', '<'); - curr_desc = regexprep (curr_desc, '\)', '>'); + curr_desc = strrep (curr_desc, '(', '<'); + curr_desc = strrep (curr_desc, ')', '>'); endif if (length (fltk_str) > 0)
--- a/scripts/io/strread.m +++ b/scripts/io/strread.m @@ -352,7 +352,7 @@ ## Remove comments in str if (comment_flag) ## Expand 'eol_char' here, after option processing which may have set value - comment_end = regexprep (comment_end, "eol_char", eol_char); + comment_end = strrep (comment_end, "eol_char", eol_char); cstart = strfind (str, comment_start); cstop = strfind (str, comment_end); ## Treat end of string as additional comment stop
--- a/scripts/plot/util/private/__go_draw_axes__.m +++ b/scripts/plot/util/private/__go_draw_axes__.m @@ -2345,12 +2345,12 @@ ## FIXME: The symbol font doesn't seem to support bold or italic ##if (bld) ## if (it) - ## g = regexprep (g, '/Symbol', '/Symbol-bolditalic'); + ## g = strrep (g, '/Symbol', '/Symbol-bolditalic'); ## else - ## g = regexprep (g, '/Symbol', '/Symbol-bold'); + ## g = strrep (g, '/Symbol', '/Symbol-bold'); ## endif ##elseif (it) - ## g = regexprep (g, '/Symbol', '/Symbol-italic'); + ## g = strrep (g, '/Symbol', '/Symbol-italic'); ##endif str = [str(1:s(i) - 1) g str(e(i) + 1:end)]; elseif (strncmp (f, "rm", 2)) @@ -2406,12 +2406,12 @@ ## FIXME: The symbol font doesn't seem to support bold or italic ##if (bld) ## if (it) - ## g = regexprep (g, '/Symbol', '/Symbol-bolditalic'); + ## g = strrep (g, '/Symbol', '/Symbol-bolditalic'); ## else - ## g = regexprep (g, '/Symbol', '/Symbol-bold'); + ## g = strrep (g, '/Symbol', '/Symbol-bold'); ## endif ##elseif (it) - ## g = regexprep (g, '/Symbol', '/Symbol-italic'); + ## g = strrep (g, '/Symbol', '/Symbol-italic'); ##endif str = [str(1:s(i) - 1) g str(s(i) + length (flds{j}) + 1:end)]; break;
--- a/scripts/testfun/private/html_compare_plot_demos.m +++ b/scripts/testfun/private/html_compare_plot_demos.m @@ -113,7 +113,7 @@ fprintf (fid, "<img src='%s' style='width: %dpx;'>", ... ffn, in.column_width); else - err_fn = regexprep(ffn, ".png", ".err"); + err_fn = strrep (ffn, ".png", ".err"); if (! exist (err_fn, "file")) warning("File %s doesn't exist...", err_fn); else