Mercurial > hg > octave-lojdl
changeset 14076:9aff66860e03 stable
accept abbreviated cellfun option names
* src/DLD-FUNCTIONS/cellfun.cc (get_mapper_fun_options): Accept
abbreviated option names.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Tue, 20 Dec 2011 17:08:42 -0500 |
parents | f90c3facfac3 |
children | b6eeeb67fa3f |
files | src/DLD-FUNCTIONS/cellfun.cc |
diffstat | 1 files changed, 7 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/src/DLD-FUNCTIONS/cellfun.cc +++ b/src/DLD-FUNCTIONS/cellfun.cc @@ -32,6 +32,7 @@ #include <list> #include <memory> +#include "caseless-str.h" #include "lo-mappers.h" #include "oct-locbuf.h" @@ -199,18 +200,17 @@ static void get_mapper_fun_options (const octave_value_list& args, int& nargin, - bool& uniform_output, octave_value& error_handler) + bool& uniform_output, octave_value& error_handler) { while (nargin > 3 && args(nargin-2).is_string ()) { - std::string arg = args(nargin-2).string_value (); + caseless_str arg = args(nargin-2).string_value (); + + size_t compare_len = std::max (arg.length (), static_cast<size_t> (2)); - std::transform (arg.begin (), arg.end (), - arg.begin (), tolower); - - if (arg == "uniformoutput") + if (arg.compare ("uniformoutput", compare_len)) uniform_output = args(nargin-1).bool_value(); - else if (arg == "errorhandler") + else if (arg.compare ("errorhandler", compare_len)) { if (args(nargin-1).is_function_handle () || args(nargin-1).is_inline_function ())