Mercurial > hg > octave-lyh
diff src/graphics.cc @ 7878:b4ac6bb4114b
graphics.cc (execute_callback, xget_ancestor): pass args by const reference and make explicit copies
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Tue, 10 Jun 2008 13:43:35 -0400 |
parents | ab9fc4e3cdca |
children | 4976f66d469b |
line wrap: on
line diff
--- a/src/graphics.cc +++ b/src/graphics.cc @@ -188,12 +188,8 @@ xset_gcbo (graphics_handle ()); } -// NOTE: "cb" is passed by value, because "function_value" method -// is non-const; passing "cb" by const-reference is not -// possible - static void -execute_callback (octave_value cb, const graphics_handle& h, +execute_callback (const octave_value& cb_arg, const graphics_handle& h, const octave_value& data) { octave_value_list args; @@ -212,6 +208,10 @@ BEGIN_INTERRUPT_WITH_EXCEPTIONS; + // Copy CB because "function_value" method is non-const. + + octave_value cb = cb_arg; + if (cb.is_function_handle ()) fcn = cb.function_value (); else if (cb.is_string ()) @@ -334,8 +334,10 @@ } static graphics_object -xget_ancestor (graphics_object go, const std::string& type) +xget_ancestor (const graphics_object& go_arg, const std::string& type) { + graphics_object go = go_arg; + do { if (go.valid_object ())