[Pkg-octave-devel] Bug#299510: ctave-forge: setfields with empty argument list

"Dr. Jörg-Volker Peetz" "Dr. Jörg-Volker Peetz" , 299510@bugs.debian.org
Wed, 06 Apr 2005 17:25:35 +0200


Package: octave-forge
Version: 2004.11.16-3

The function setfields in the file
/usr/share/octave/2.1.64/site/m/octave-forge/struct/setfields.m
is called with empty argument list, e.g., in the functions optimset and
read_options of the package octave-forge.
It seems to me that the function setfields is expected to return an
empty structure in this case but instead it gives an error message:

	octave:2> optimset ('Display','off')
	error: setfield: called with odd number of arguments

Compare also with bug report #299957.

I suggest a patch like this:

--- setfields.m-orig    2004-12-04 18:09:52.000000000 +0100
+++ setfields.m 2005-04-06 16:27:46.000000000 +0200
@@ -30,6 +30,7 @@
 ##     return error rather than trapping to keyboard

 function s = setfields(s,varargin)
+if nargin == 0, s = {}; return; endif
 if rem(nargin,2) != 1,
       error('setfields: called with odd number of arguments\n') ;
 endif

Regards,
Jörg-Volker.