# HG changeset patch # User Jordi GutiƩrrez Hermoso # Date 1310624466 18000 # Node ID c499d54796d62b41268d5f63f479d5f60785ad7a # Parent ad9263d965dc6c6c2db3d8ca2d5f3dadcc4f1422 Minor stylistic fixes to profiler code diff --git a/src/profiler.cc b/src/profiler.cc --- a/src/profiler.cc +++ b/src/profiler.cc @@ -123,7 +123,7 @@ { const int n = times.size (); - Cell result (1, n); + Cell retval (1, n); int i = 0; for (timing_map::const_iterator p = times.begin (); p != times.end (); ++p) { @@ -132,11 +132,11 @@ entry.contents ("name") = octave_value (p->first); entry.contents ("time") = octave_value (p->second); - result (i++) = entry; + retval (i++) = entry; } assert (i == n); - return result; + return retval; } double @@ -168,28 +168,23 @@ Enable or disable the profiler data collection.\n\ @end deftypefn") { - // If there is an output argument, return current (if we change the old) - // status of the profiler. - octave_value_list result; - if (nargout > 0) - { - if (nargout > 1) - error ("profiler_enable: too many output arguments requested"); + octave_value_list retval; - result(0) = profiler.is_active (); - } - - // If there is an input argument, set the status. const int nargin = args.length (); if (nargin > 0) { if (nargin > 1) - error ("profiler_enable: too many arguments specified"); + { + print_usage (); + return retval; + } profiler.set_active (args(0).bool_value ()); } - return result; + retval(0) = profiler.is_active (); + + return retval; } DEFUN (profiler_reset, args, nargout, @@ -198,17 +193,15 @@ Clear all collected profiling data.\n\ @end deftypefn") { - octave_value_list result; + octave_value_list retval; const int nargin = args.length (); if (nargin > 0) - error ("profiler_reset: no arguments expected"); - if (nargout > 0) - error ("profiler_reset: no output argument possible"); + warning ("profiler_reset: ignoring extra arguments"); profiler.reset (); - return result; + return retval; } DEFUN (profiler_data, args, nargout, @@ -217,15 +210,13 @@ Query the timings collected by the profiler.\n\ @end deftypefn") { - octave_value_list result; + octave_value_list retval; const int nargin = args.length (); if (nargin > 0) - error ("profiler_data: no arguments expected"); - if (nargout != 1) - error ("profiler_reset: expected exactly one output argument"); + warning ("profiler_data: ignoring extra arguments"); - result(0) = profiler.get_data (); + retval(0) = profiler.get_data (); - return result; + return retval; }